I am trying to update my Samsung accessory provider app to target Android 12 (API 31)
com.samsung.android.sdk.accessory.ServiceConnectionIndicationBroadcastReceiver tries to bring up the service but it can not.
As described here:
Android 12 does not allow starting a foreground service except a few special cases.
So my service crash with this error:
2022-04-05 15:06:28.927 28310-28310/com.mycom.gear E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mycom.gear, PID: 28310
java.lang.RuntimeException: Unable to start receiver com.samsung.android.sdk.accessory.ServiceConnectionIndicationBroadcastReceiver: android.app.ForegroundServiceStartNotAllowedException: startForegroundService() not allowed due to mAllowStartForeground false: service com.mycom.gear/.service
at android.app.ActivityThread.handleReceiver(ActivityThread.java:4766)
at android.app.ActivityThread.access$1800(ActivityThread.java:310)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2288)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8633)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1133)
Caused by: android.app.ForegroundServiceStartNotAllowedException: startForegroundService() not allowed due to mAllowStartForeground false: service com.mycom.gear/.service
at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:54)
at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:50)
at android.os.Parcel.readParcelable(Parcel.java:3345)
at android.os.Parcel.createExceptionOrNull(Parcel.java:2432)
at android.os.Parcel.createException(Parcel.java:2421)
at android.os.Parcel.readException(Parcel.java:2404)
at android.os.Parcel.readException(Parcel.java:2346)
at android.app.IActivityManager$Stub$Proxy.startService(IActivityManager.java:6914)
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1926)
at android.app.ContextImpl.startForegroundService(ContextImpl.java:1892)
at android.content.ContextWrapper.startForegroundService(ContextWrapper.java:796)
at com.samsung.android.sdk.accessory.m.a(Unknown Source:51)
at com.samsung.android.sdk.accessory.m.a(Unknown Source:2)
at com.samsung.android.sdk.accessory.ServiceConnectionIndicationBroadcastReceiver.onReceive(Unknown Source:72)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:4757)
at android.app.ActivityThread.access$1800(ActivityThread.java:310)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2288)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8633)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1133)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.am.ActiveServices.startServiceLocked(ActiveServices.java:771)
at com.android.server.am.ActiveServices.startServiceLocked(ActiveServices.java:679)
at com.android.server.am.ActivityManagerService.startService(ActivityManagerService.java:14013)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2943)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3034)
is there a solution to this within Samsung accessory sdk ?
what can I do ?
thank you.
I’ll do that. But the forums are losing its value day by day.
I had a few issues recently , and for none of them I could get a solution…
Yes I submitted but the first answer is weird. It says:
" Galaxy Accessory SDK is not supported for API 31. Currently there is no plan to upgrade the Galaxy Accessory SDK. We recommend you to not to update the Target SDK as of now."
However, Google Play Policy says that we have to upgrade our apps to Android 12 (API 31) until 2023
If we can’t update, companion apps will not be available to new users for download.
We need an update on the Samsung Accessory SDK, otherwise me, and I am sure many more developers, will need to drop the support for galaxy watches in our companion apps because of the Google Play restrictions.
Also, how do we explain to our users that they can no longer use their galaxy watch when their device gets upgraded to Android 12?
@r.liechty_SDR
This question is not about “query packages” permission. It was a different issue in Android 11 and was solved with the solution in the thread you wrote.
But this question is about another problem starting in Android 12.
It is about starting a foreground service in Android 12 which is prohibited.
Unfortunately I could not find a solution to this. I also wrote it as a problem to Developer Support
But could not receive a reasonable response yet.
I know Wear OS watches do not need SAP but the older Tizen watches still need this to work with our apps.
SO Samsung;
We ARE WAITING FOR HELP on this matter !!!
Hi ilkeraktuna I looked in the support data base and couldn’t find your request. Do you have the ticket number. I don’t have quick access to all of the support database.
Thanks I checked out the support request. And I understand it a bit better now.
The reason there is no response from support is that they have gotten no response from the Galaxy Accessory SDK Development team. They note every time they remind the team and every 4 weeks they update the reminder.
From reading the report I am betting that this is a security issue. It looks to me like you need to run your watch app in the foreground when you send a service request to the mobile.
Since there is a date to comply it probably means it is required for GDPR and other governments privacy regulations.
I wish I had better news, my guess is it is not going away.
Thanks for checking and for the information. Unfortunately I could not find a way in SAP implementation to run the process in foreground when there is a service request to the mobile app.
If there is an example/sample app without a “service” , I would be happy to implement it.
Btw, it is not a GDPR issue. Android prevents background/foreground service to minimize battery usage by services. But if it is possible to start a foregorund process from a SAP service request, that would be enough for me.
This is not you. They implemented something Friday that broke the seller Portal sign in process (and other services) they fixed it for Samsung.com and Developer Portal . The way I had to go was sign into Developer Support and from there go to the seller portal and click on the sign in it should bypass the credentials there and go straight to your account page.
Since it is a weekend in Korea and I assume they thing they fixed the problem it will be Monday before I can notify them.
nfortunately I could not find a way in SAP implementation to run the process in foreground when there is a service request to the mobile app.
If there is an example/sample app without a “service” , I would be happy to implement it.
Btw, it is not a GDPR issue. Android prevents background/foreground service to minimize battery usage by services. But if it is possible to start a foregorund process from a SAP service request, that would be enough for me.