问题
I have been asked to make an instant app module openable from play store in a base app which I am working on.
The base app is large with lots of activities. It also uses many more permissions than those allowed for instant apps.
Is it possible that I make the instant app module from only one of the activities which utilizes only the allowed permissions?
If yes, how should I go about it?
In other words, can I declare the allowed permissions in the manifest file of the instant app module (instant/AndroidManifest.xml) even though the base app uses many more permissions?
I am asking this question because the official documentation doesn't mention a way to declare permissions in instant/AndroidManifest.xml
回答1:
In other words, can I declare the allowed permissions in the manifest file of the instant app module (instant/AndroidManifest.xml) even though the base app uses many more permissions?
Yes, you can declare permissions that only exist in your com.android.feature modules. It is done no different than in your main manifest, see an example from googlesamples/android-instant-apps/analytics/feature/AndroidManifest.xml
note: if this feature is also a part of the installed-app via implementation project(':feature')
in the application module's gradle, then its manifest contents will be merged, permissions included, so you don't need to duplicate those permissions.
But as your permissions diversify between your instant and installed apps, you may run into Google Play Console error - Non-upgradable to installed app errors that you'll have to watch out for. Just make sure that your permissions, uses-feature, and uses-implied-feature (ie Play filters) are synced between them so that the targetable devices for your installed app is not narrower than your instant app.
来源:https://stackoverflow.com/questions/54080801/handling-permissions-making-one-activity-of-a-large-app-into-an-instant-app