Localmachine data is lost on every Android version increment or change

Vuyiswa Maseko 351 Reputation points
2022-10-08T08:22:46+00:00

Good Day all

am using BlobCache(Akavache.Core) to store the token

https://www.nuget.org/packages/akavache.core/

public static async Task Store_Token(TOKEN_MODEL Token)  
    {  
        try  
        {  
           await BlobCache.LocalMachine.InsertObject("TOKEN", Token);  
        }  
        catch (KeyNotFoundException ex)  
        {  
            throw ex;  
        }  
    }  

and retrieve it like this

   public async static Task<TOKEN_MODEL> Retrieve_Token()  
    {  
        TOKEN_MODEL Userinfo = new TOKEN_MODEL();  
        try  
        {  
            try  
            {  
                Userinfo = await BlobCache.LocalMachine.GetObject<TOKEN_MODEL>("TOKEN");  
            }  
            catch (KeyNotFoundException)  
            {  
            }  
        }  
        catch (Exception)  
        {  
        }  
        return Userinfo;  
    }  

i realized that every time i do a release this token is lost. so when a user do an update on the app this token is lost. so i tested this by changing the version of the android project. if i leave it , it keeps the token but if change it it wipes also the token

Thanks

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

1 answer

Sort by: Most helpful
  1. Vuyiswa Maseko 351 Reputation points
    2022-10-08T21:47:02.887+00:00

    Thanks , i changed it to Secure and its working well.

    0 comments No comments