c# - How do I share a sqlite database between a Xamarin app and Java Android app -
as title says wanting share sqlite database between android app written in java , 1 written in c# using xamarin. can share database between 2 java apps (with of question) when try same thing in xamarin getting following error:
android.database.sqlite.sqlitecantopendatabaseexception: unknown error (code 14): not open database
i think have 2 problems.
i not correctly setting shared userid. placing following attribute above main activity.
[register("my.user.id")]
i tried using
android:shareduserid="my.user.id"
in manifest file throwing errors , wouldn't deploy device.i don't know how whole signing of app works. maybe device sees 2 apps coming different publisher each device , not allowing 2 share context.
edit :
wanted add how signed both applications same certificate future refrence.
the android cert noramlly "c:\users\username\.android\debug.keystore"
, xamarin cert noramlly in "c:\users\username\appdata\local\xamarin\mono android\debug.keystore"
. built xamarin app first copied debug.keystore file xamarin folder android one. (i'm sure work other way around haven't tested it)
xamarin.android
not support shareduserid
via applicationattribute
. (i guess no 1 every filed issue it)
ref: android.app.applicationattribute
add shared user id via manifest , work fine:
example:
<application android:allowbackup="true" android:shareduserid="com.sushihangover" android:icon="@mipmap/icon" android:label="@string/app_name"></application>
note: make sure manually uninstall both apps, add shareduserid
, rebuild , reinstall both apps.
note: make sure using same signing certificate both java , xamarin apps.
Comments
Post a Comment