diff --git a/Samples/Samples.Android/Properties/AndroidManifest.xml b/Samples/Samples.Android/Properties/AndroidManifest.xml
index a6cae2b47..1f6679d75 100644
--- a/Samples/Samples.Android/Properties/AndroidManifest.xml
+++ b/Samples/Samples.Android/Properties/AndroidManifest.xml
@@ -12,5 +12,11 @@
-
+
+
+
\ No newline at end of file
diff --git a/Samples/Samples.Android/Resources/xml/my_backup_rules.xml b/Samples/Samples.Android/Resources/xml/my_backup_rules.xml
new file mode 100644
index 000000000..6f6f333b9
--- /dev/null
+++ b/Samples/Samples.Android/Resources/xml/my_backup_rules.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Samples.Android/Samples.Android.csproj b/Samples/Samples.Android/Samples.Android.csproj
index a11b22283..bd3d7e5e8 100644
--- a/Samples/Samples.Android/Samples.Android.csproj
+++ b/Samples/Samples.Android/Samples.Android.csproj
@@ -134,6 +134,11 @@
+
+
+ Designer
+
+
\ No newline at end of file
diff --git a/Xamarin.Essentials/SecureStorage/SecureStorage.android.cs b/Xamarin.Essentials/SecureStorage/SecureStorage.android.cs
index 2535e63c7..20fde9c2c 100644
--- a/Xamarin.Essentials/SecureStorage/SecureStorage.android.cs
+++ b/Xamarin.Essentials/SecureStorage/SecureStorage.android.cs
@@ -26,7 +26,15 @@ static Task PlatformGetAsync(string key)
{
var encData = Convert.FromBase64String(encStr);
var ks = new AndroidKeyStore(context, Alias, AlwaysUseAsymmetricKeyStorage);
- decryptedData = ks.Decrypt(encData);
+ try
+ {
+ decryptedData = ks.Decrypt(encData);
+ }
+ catch (AEADBadTagException)
+ {
+ System.Diagnostics.Debug.WriteLine($"Unable to decrypt key, {key}, which is likely due to an app uninstall. Removing old key and returning null.");
+ PlatformRemove(key);
+ }
}
return Task.FromResult(decryptedData);