Skip to content Skip to sidebar Skip to footer

Android 11: Starting A Service Of Another App

First app has a service:

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://docs.microsoft.com/en-us/answers/questions/517132/startactivity-throws-error-in-android-11-api-30.html

https://www.ibm.com/docs/en/trusteer-mobile-sdk/5.3?topic=android-step-1-modify-app-manifest-androidmanifestxml

https://pretagteam.com/question/android-11-sdk-30-launch-external-app-doesnt-work

https://proandroiddev.com/the-quick-developers-guide-to-migrate-their-apps-to-android-11-e4ca2b011176

Post a Comment for "Android 11: Starting A Service Of Another App"