Xamarin forms android application targeting api level 26 crashes with java.lang.IllegalStateException: Not allowed to start service Intent
when receiving notification in background.
From Notification in oreo, what i understood is only during the app whitelisted duration only the app can make services. How to properly handle this situvation, i call and update my databases when i receive notification, how can i properly manage this.
One answer shows
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) {
context.startForegroundService(new Intent(context, ServedService.class));
} else {
context.startService(new Intent(context, ServedService.class));
}
But how can i implement this in a xamarin forms application for properly receiving push notifications.