![]() ![]() There is so many API changes from version to version in Android that a single change can easily escape, even despite following the news. ![]() I just bumped the compileSdk, and without any warning or explanation my app stopped working as expected. My guess is that there are some security reasons to prevent malicious applications from trying to launch other application Services and not to make it easier to use them… but come on. Only painstaking work through the documentation of the changes introduced by API 30 led me to the solution. Blogpost with an explanation of the changes, does not mention bindService() at all, and I haven’t found a clear answer to my problem anywhere. Even this does not help much, because the information “service not found”, and which can be launched with the same Intent with adb, only intensifies the confusion. I had to engrave in logs without an application filter. It took me far too long to find the cause of this problem… The bindService() method only returns True / False with no specific error message, although it can throw a SecurityException in the absence of permissions. This can be seen in the Logcat logs, without filtering for only selected application:Īlternatively you can stay with compileSdk 29 but I don’t recommend that :) Rant over Android The absence of this entry in the Manifest make 3rd party application services invisible and bindService() returns False. Anyway, Android decided to do something about it, and from API 30, applications only have access to the 3rd party packages listed in their own Manifest inside attribute. It could be a violation of the user’s privacy… or something, more info here. Before Android 11 (API 30), any application could check all other applications installed on the system using the queryIntentActivities() method. It is described in more detail in the documentation, but in general it is about improving the security of the application. Back to API 29 - and everything works again, so it wasn’t a typo in service package or something.Īfter a while of googling, digging through StackOverflow, ritual cleaning of the project and Android Studio cache, I found the cause. The call to the bindService() method returned False, which usually means the Service is not present in the Manifest - but it was. I already had a Proof of Concept project ready that I wanted to show to someone at work, so I cleaned it up a bit, bumped target and compileSdk version to the API 30 and… it stopped working. It is quite simple to use, on the basis of the Bound Service, more info here. Without going into details, Messenger seems to be the most suitable for my case. Overall, there are 3 ways to achieve this: Broadcasts, AIDL, and Messenger. I am recently working on communication between applications in Android. Without it, `bindService()` will return `False` and the logs will tell you that an Intent-compatible service has not been found. If you want to use bindService() with external application services built with API 30 and above, add the attribute with the service package name to the client app manifest. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |