据谷歌称,开发即时应用程序受到迷药
“最佳实践” is “安装应用程序后保留用户状态”
https://developer.android.com/topic/instant-apps/ux-best-practices.html#keep_user_state_after_app_installation https://developer.android.com/topic/instant-apps/ux-best-practices.html#keep_user_state_after_app_installation
我尝试在即时应用程序和安装的应用程序中使用内部存储,但它不起作用,因为有不同的路径:
- 即时应用程序:/data/user/0/com.google.android.instantapps.supervisor/files/hosted/package_name/files
- 安装的应用程序:/data/user/0/package_name/files
当然,外部存储也不起作用,因为即时应用程序可以获得它的权限。
有谁知道或知道如何解决这个问题,这应该根据谷歌“最佳实践”来解决?
您可以使用 StorageApi 将数据从 InstantApp 迁移到已安装的应用程序,示例如下:谷歌存储 API 示例 https://github.com/android/app-bundle-samples/blob/master/InstantApps/storage-api/app/src/main/java/com/instantappsample/storage/StorageApiActivity.kt。只需访问InstantApps.getInstantAppsClient(this).instantAppData
你拥有它,addOnSuccessListener
就这样吧。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)