Xamarin.Forms - Read SharedPreferences of old version apk

andreMetal 46 Reputation points

Hello, this is my situation: I have an Android application written in java using Android Studio already distributed in the store. Recently with my team we decide to rewrite the app using Xamarin.Forms. The old version app used SharedPreferences to store and read some settings. We tried to read the same setting with the new xamarin forms version without success. My first question is: is it possible to do what we are trying to? If yes, is there a good way to do?
Thanks in advance for the reply.

A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,301 questions
{count} votes

Accepted answer
  1. JarvanZhang 23,951 Reputation points


    Welcome to our Microsoft Q&A platform!

    Hi, AndreaTizzoni-0935. I created a basic sample to test the function in debug mode, the data which is saved in as cannot be get in Xamarin. It seems that it uninstall the java version and install xamarin version instead of overwriting the previous version.


    This will work fine in release mode, installing the c# version application with the same keystore of the java app will make it.

    Best Regards,

    Jarvan Zhang

    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

1 additional answer

Sort by: Most helpful
  1. Alessandro Caliaro 4,181 Reputation points


    Take a look to this.
    I see also a

            mSharedPrefs = PreferenceManager.GetDefaultSharedPreferences(mContext);

    that seems you are not using