2

I am writing an Android widget using AppWidgetProvider. To store some values (f.e. downloaded JSON data) I am using Xamarin.Forms.Application.Current.Properties.

Unfortunately I am getting a null pointer exception (app crashes) after a while (I guess when the system is killing the application in background).

Because I can't just call LoadApplication(new App()) from my AppWidgetProvider instance I am wondering what to do to prevent Xamarin.Forms.Application.Current from being null. Am I doing something wrong here in general? Maybe Xamarin.Forms.Application.Current.Properties is not meant to be used like this.

kaolick
  • 4,817
  • 5
  • 42
  • 53
  • If can't use `Properties`, in android, you can use [SharedPreferences](https://developer.android.com/reference/android/content/SharedPreferences.html) to store your data. – Robbit Apr 19 '18 at 10:57

0 Answers0