As the title says I am wanting to share a Sqlite database between an Android app written in Java and one written in C# using Xamarin. I can successfully share a database between two Java apps (With the help of this question) but when I try the same thing in Xamarin I am getting the following error:
Android.Database.Sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
I think I have two problems.
I am not correctly setting the Shared UserId. Currently I am placing the following attribute above my main activity.
[Register("my.user.id")]
I tried using the
android:sharedUserId="my.user.id"
in the Manifest file but that was throwing errors and wouldn't deploy to my device.I don't know how the whole signing of the app works. So maybe my device sees the two apps as coming from a different publisher for each device and is not allowing the two to share context.
EDIT :
Just wanted to add how I signed both applications with the same certificate for future refrence.
The Android cert is noramlly "C:\Users\userName\.android\debug.keystore"
and the Xamarin cert is noramlly in "C:\Users\userName\AppData\Local\Xamarin\Mono for Android\debug.keystore"
. I built the Xamarin app first so I copied the debug.keystore file from the xamarin folder to the android one. (I'm sure it would work the other way around but haven't tested it)