Hide service when monitoring beacons

Hello,

I’m using latest Proximity SDK (alpha 5) and I’m not able to hide the permanent notification on Android. I know this is a trick and it’s now impossible to hide in latest Android release (8.0), but before that, you could hide it.

I’ve tried:

Notification notification = new Notification.Builder(context)
    .setContentTitle("Title")
    .setContentText("Monitoring Beacons …")
    .setSmallIcon(R.drawable.ic_notification)
    .build();

And old compat notification (with and without icon) with lowest priority, the only way IIRC to hide the notification.

 NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
 builder.setPriority(Notification.PRIORITY_MIN);
 Notification notification = builder.setContentTitle("Title").setContentText("Monitoring Beacons…").build();

ProximityObserver.Handler observationHandler = proximityObserver.addProximityZones(zones)
    .withBalancedPowerMode()
    .withOnErrorAction(errorAction)
    .startWithScannerInForegroundService(notification);

Is this normal at this stage? It could be very nice to be have this behavior.

Hey @MBach

You can use .startWithSimpleScanner() instead - no notification at all.
By the way - what is your use case? Are you trying to scan when app is in the foreground, or run long lasting scan in the background?

Hello @paweldylag

I’m interested with background monitoring because I push notifications with both Geofence Areas and Beacons inside a big building. When someone is entering in an area where onEnter or onExit is detected, I push with OneSignal a custom notification. I think background monitoring is the best for me, because I don’t care how far or near I am from the Beacon, like Indoor Location SDK.

So it might be annoying for the user to always have a “non-swippable” notification with something like “Monitoring for Beacons…” all the time.

I cannot use startWithSimpleScanner according to your documentation, because the service is killed when the App is closed.