I have a Xamarin Forms App that makes a request to a web service passing an chached authentication token after receiving a push notification. This works fine on Android and iPhone when the app is running in the foreground or minimised. But if the app is force closed it will still receive the push notification but will fail getting the cached Azure Authentication Context at this line:
var authContext = new AuthenticationContext(authority);
Giving the error:
Error authenticating: You MUST call Xamarin.Forms.Init(); prior to using it.
This is the same code regardless of whether the app is running or closed.
Can anyone let me know how to authenticate when the app is closed? Or how to call Forms.Init() when a push notification is received.
Any help would be greatly appreciated.