Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Xamarin Forms - trigger local notification on android background


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.