nima66
Member
I designed a feature in the application where the user can set an alarm.
The alarm is attached to an activity and selecting it will show the activity if it is not visible.
As per Erel instructions, I added the following code in the manifest:
But it still shows the following error:
The alarm is attached to an activity and selecting it will show the activity if it is not visible.
As per Erel instructions, I added the following code in the manifest:
B4X:
AddPermission(android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK)
SetServiceAttribute(alarmService, android:foregroundServiceType, "mediaPlayback")
But it still shows the following error:
B4X:
android.app.ForegroundServiceStartNotAllowedException: startForegroundService() not allowed due to mAllowStartForeground false: service idea.game.management/.alarmservice
at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:54)
at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:50)
at android.os.Parcel.readParcelableInternal(Parcel.java:4870)
at android.os.Parcel.readParcelable(Parcel.java:4852)
at android.os.Parcel.createExceptionOrNull(Parcel.java:3052)
at android.os.Parcel.createException(Parcel.java:3041)
at android.os.Parcel.readException(Parcel.java:3024)
at android.os.Parcel.readException(Parcel.java:2966)
at android.app.IActivityManager$Stub$Proxy.startService(IActivityManager.java:6503)
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1942)
at android.app.ContextImpl.startForegroundService(ContextImpl.java:1917)
at android.content.ContextWrapper.startForegroundService(ContextWrapper.java:841)
at anywheresoftware.b4a.keywords.Common.StartServiceImpl(Common.java:924)
at anywheresoftware.b4a.keywords.Common.StartService(Common.java:911)
at idea.game.management._alarm_status_check(club.java:3033)
at idea.game.management._load_data(club.java:10720)
at idea.game.management$ResumableSub_Activity_Resume.resume(club.java:1711)
at idea.game.management._activity_resume(club.java:1662)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:221)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
at idea.game.management$ResumeMessage.run(club.java:317)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:224)
at android.os.Looper.loop(Looper.java:318)
at android.app.ActivityThread.main(ActivityThread.java:8790)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:561)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)