According to Google druging developing instant apps
"Best practices" is "Keeping user state after app installation"
https://developer.android.com/topic/instant-apps/ux-best-practices.html#keep_user_state_after_app_installation
I tried to use Internal Storage in instant app and installed app, but it doesn't work, because there are different paths:
Of course, external storage also doesn't work, because instant app could receive permission to it.
Does anybody know or has idea how to resolve that problem, which should be solved according to Google "Best practices"?
You can migrate data from InstantApp to installed app using StorageApi, example is here: google sample storage api. Just access
InstantApps.getInstantAppsClient(this).instantAppData
and you have it, addOnSuccessListener
and here you go.
Storage transfer from instant to installed app happens automatically on O+, but for platforms below O, you need to use this API. Please refer to Android Instant Apps FAQ: “How do I transfer data from an instant app to an installed app?”
https://developer.android.com/topic/instant-apps/faqs.html
For devices running Android 8.0 (API level 26) or higher, the instant app's data is transferred automatically when the APK installation begins. For devices running Android 7.1.1 (API level 25) or lower, call compatibility API in Google Play Services.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With