简体   繁体   中英

Is it possible to retrieve Android Shared Preferences in Xamarin that were stored in Java

I have an Android app that was previously written in Java and used SharedPreferences to store some details. This app was left dormant for a number of years and wasn't updated with framework updates. So, when it came to updating it the decision was made to re-write it using Xamarin. The app was written with the same package name and details so it could be built and rolled out as an update to the current app.

Now... What I'd like to do if possible, is retrieve the SharedPreferences stored to the phone in the java version of the app for use in the Xamarin version of the app.

I have the original code so I know what they were naming the Store and the variables. I have the old app installed on a device and have stored some details by using the app.

I have also added the necessary code to the new Xamarin app to get the shared preferences and debugged this on the same device. However, I'm not getting any values returned, just the default values defined.

What I'd like to know is if anyone has been able to do this before or if what I'm trying is not possible since we're crossing languages now.

I assumed the latter however I wasn't going to give up without first trying and asking the community.

Any thoughts or assistance would be greatly appreciated!

Yes. The shared preference file is just XML. There's nothing special about what language is used to read or write it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM