Handling Permissions: Making one activity of a large app into an instant app

给你一囗甜甜゛ 提交于 2021-01-29 07:11:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!