Xamarin Forms - trigger local notification on android background

bcjteixeirabcjteixeira PTMember


I'm currently working on one app (ios and android) to scan beacons (iBeacon/Eddystone URL). All is good on both platforms when I have the app running in foreground. Once in background things are a bit harder. I already have iOS version working correctly in background, meaning even if I have app terminated, iOS will signal when a beacon is in the phone region and sends a local notification to user, but for android things are more complex. I'm building android to minimal API 26, since backgrounding changed on that version with a couple limitations.

Currently I've been testing a couple solutions:
- Job Scheduler;
- PendIntent;
- Foreground Services;
- Dependency Services;
- BroadcastReceiver;

And none of this is performing what I expect. I'm looking for the app to be terminated, but Android still able to send a local notification to user every time a beacon enters region. I read some solutions implementing Job Scheduler (only once every 15 minutes) and then with some foreground services meanwhile in order to make it able to keep scanning for beacons, but still cannot find a sample working correctly.

Is there anyone that can give me some clues on how I should develop this?

Any help is much appreciated.
Thank you,

Sign In or Register to comment.