0

I am currently migrating my code from one app to another.

Is it possible to migrate my current Realm database to the new app?

There are some user preferences stored inside the Realm database such as bookmarked page, and some html stuff.

I am wondering is it possible for the new app able to get the Realm database via sharing a same app id?

jwpfox
  • 5,124
  • 11
  • 45
  • 42
wenyang9319
  • 180
  • 2
  • 13
  • Check this link https://realm.io/docs/java/latest/#migrations – Febi M Felix Nov 08 '16 at 08:55
  • Hi, thanks for your suggestion, But what I am going to do is moving the code to another codebase. – wenyang9319 Nov 08 '16 at 08:58
  • Hi, check out the comment here in the link http://stackoverflow.com/questions/28966881/realm-share-database-between-apps – Febi M Felix Nov 08 '16 at 09:01
  • @FebiMathew , thanks for your patience. I am wondering is that possible the new app able to get the realm database via sharing a same app id. – wenyang9319 Nov 08 '16 at 09:11
  • If you have the same APP ID (package name for application) then it will count as the SAME application, which means you'll inherit the `/data` folder of the application along with it, which means you'll be able to access the Realm just like the previous app could. – EpicPandaForce Nov 08 '16 at 09:39
  • @EpicPandaForce Million thanks for your answer! – wenyang9319 Nov 08 '16 at 10:17
  • I had to do this with an SQLite database before, checking if it's there and migrate the data out of it if it was there - the base principles are the same :D but this applies if you actually do have the **same** app id, which means you'll install the new app as an update over the old app. – EpicPandaForce Nov 08 '16 at 10:20
  • @EpicPandaForce alright, thanks for your answer, panda =D will try it later – wenyang9319 Nov 08 '16 at 12:54

0 Answers0