My Android App gets the Exception:
Java.Lang.IllegalStateException: System services not available to Activities before onCreate().
This is the code part throwing the exception:
WifiManager wifiManager;
try
{
wifiManager = this.GetSystemService(WifiService) as WifiManager;
}
catch (IllegalStateException ex)
{
return false;
}
My MainActivity is:
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
Forms.Init(this, bundle);
this.SetPage(App.GetMainPage());
}
So my OnCreate is called and as far as i know X.Forms uses only one activity. So how can this happen?
My app needs to access the WifiService to work. Is this because i am in another thread?