0

Before posting this question I have seen already seen similar questions and their answers such as this and this, but their answers are mostly for Xamarin iOS.

With the time (as compared one of the linked question asked 2 years ago) Xamarin Form has evolved. So, I am trying to figure out if there is any way to bundle and re-use prebuilt Realm database (or any file for that matter) on a PCL xamarin forms project?

If this can't be achieved through PCL alone then what would be platform specific (android, iOS, UWP) modification for the same.

Whatever code parts I have tried with the help of linked questions, I couldn't solve this problem.

Dr. Atul Tiwari
  • 1,085
  • 5
  • 22
  • 46

1 Answers1

0

You could flag the Realm DB as an assembly resource in order to embed it at compile time in your .NetStd/PCL assembly and then extract/save it to a file at runtime like any other .Net embedded resource.

But, static embedded resources will consume runtime memory of your app and while this is not really an issue in desktop world where memory is plentiful, in the mobile world, I highly recommend against using embedded assembly resources of any kind.

Use the native bundling techniques that are supported on the native platforms, iOS' Bundle resources, Android Asset or Raw resources, and UWP Content based Asset resources, thus the Linked answers are still valid today.

SushiHangover
  • 73,120
  • 10
  • 106
  • 165