Search code examples
androidcordovalocal-storagehybrid

How to give access to local storage of existing app to the new app of same package name and same keys in android once it installed


I want to give access of local storage of app 'A' to another app 'B' which is of same package name and same keys to that of 'A' .

Note:- App 'A' is a hybrid app and using Cordova local storage plugin and app 'B' is a native app.

I want to achieve this so that the user who has installed app 'A' and then update the app to 'B' it should work in the same way.


Solution

  • Using a single update I think it's not possible you can do it in 2 updates.

    1. First update

      • Move all your local storage data to native shared preference using Shared preference plugin(Assuming you are using ionic/cordova).
      • Do this migration in the app component only once after the upgrade and use the preference plugin afterward.
      • Make sure all your users have updated to the latest app after the upgrade(You can make the user force upgrade or you can see in play store whether all users have updated their app or not).
    2. Second update

      • In this update, your native app will go live.
      • Make sure you use the preference name that you have used in your hybrid app.

    Then enjoy your native app experience :).