0

When the application goes to the background, didExitRegion() of MonitorNotifier callback is called automatically.

How can I prevent that automatic call?

@Override
    public void **onBeaconServiceConnect**() {
        System.out.println("call onBeaconServiceConnect()");
        try {
            System.out.println("call notifier ");


            mBeaconManager.setRangeNotifier(this);
            mBeaconManager.startMonitoringBeaconsInRegion(mAllBeaconsRegion);


            mBeaconManager.setMonitorNotifier(new MonitorNotifier() {
                @Override
                public void didEnterRegion(Region region) {
                    System.out.println("monitor enter " + region.getId1());
                }


                @Override
                public void didExitRegion(Region region) {
                    System.out.println("monitor exit " + region.getId1());
                }


                @Override
                public void didDetermineStateForRegion(int i, Region region) {
                    System.out.println("monitor " + region.getId1());
                }
            });

            mBeaconManager.startRangingBeaconsInRegion(mAllBeaconsRegion);

        } catch (RemoteException e) {
            e.printStackTrace();
            System.out.println("call notifier exception"+e.toString());
        }
    }
user2231294
  • 153
  • 1
  • 1
  • 10
  • Please watch your spelling and grammar if you want answers. I fixed that for you. – Dakkaron Jun 24 '15 at 09:47
  • This is not expected behavior. There may be a problem with the way this is programmed it your app that is causing the isdue. Please edit your question to show your code. – davidgyoung Jun 24 '15 at 12:12
  • See i have edited my question. – user2231294 Jun 24 '15 at 12:32
  • Thanks. Are you using BackgroundPowerSaver? Do you customize the scan intervals in the library? How long after you put the app to the background do you get the exit callback? – davidgyoung Jun 25 '15 at 03:11
  • This is the code snippet of BackgroundPowerSaver. BackgroundPowerSaver backgroundPowerSaver = new BackgroundPowerSaver(this); mBeaconManager.setBackgroundBetweenScanPeriod(1); mBeaconManager.setBackgroundMode(true); mBeaconManager.setBackgroundScanPeriod(1); What i need to change? – user2231294 Jun 25 '15 at 06:03
  • The app goes in background,The exit method calls after 4-5 second. – user2231294 Jun 26 '15 at 06:34

0 Answers0