Android 11: Starting A Service Of Another App
Solution 1:
The app that starts a service of another app must include the next declaration in manifest:
<queries><packageandroid:name="com.example.anotherapp" /></queries>
or
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
(apps like Automate and Tasker have this permission)
Thanks to CommonsWare Android 11: starting a service of another app
Solution 2:
I also was looking how to open exprnal app, when I can't get info is this app installed on phone or not. You can try to startActivity() and handle ActivityNotFoundException, if it's present, that mean that app is not installed on the phone or can't open links like this. And also there are intent flags which can also make ActivityNotFoundException in case intent starts browser or pick activity dialog: FLAG_ACTIVITY_REQUIRE_NON_BROWSER, FLAG_ACTIVITY_REQUIRE_DEFAULT
Here is more official and other info on this case:
Open external apps in Android:
https://developer.android.com/training/package-visibility/use-cases
https://developer.android.com/training/package-visibility
https://developer.android.com/training/basics/intents
Tells when we can use QUERY_ALL_PACKAGES permission: https://support.google.com/googleplay/android-developer/answer/10158779
https://developer.android.com/training/package-visibility/use-cases
https://medium.com/androiddevelopers/package-visibility-in-android-11-cc857f221cd9
https://pretagteam.com/question/android-11-sdk-30-launch-external-app-doesnt-work
Post a Comment for "Android 11: Starting A Service Of Another App"