Beacon not detect after long time

Hello I am Hardik Patel Android developer,
i am using ‘com.estimote:proximity-sdk:1.0.3’ SDK and app work fine when it is in foreground but when i kill app or put in background then after long time it will automatically exit from beacon range even beacon is near to device. and if i restart/reinstall app then also it not detect beacon but for the same situation if i exit from beacon range and come again in beacon range it will started working.
when i used ‘com.estimote:sdk’ this will work on same case but using ‘proximity’ sdk it not work for me.
I have used foreground service to run all my login and ‘withScannerInForegroundService(notification)’ used this method as well as per mentioned in doc

Here how i use to connect

Intent notificationIntent = new Intent(this, DbTestService.class);
        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
        NotificationCompat.Builder builder = new NotificationCompat.Builder(this, this.getResources().getString(R.string.app_name))
        Notification notification =;
        if (Build.VERSION.SDK_INT >= 26) {
            NotificationChannel channel = new NotificationChannel(this.getResources().getString(R.string.app_name), this.getResources().getString(R.string.app_name), NotificationManager.IMPORTANCE_DEFAULT);
            NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        startForeground(NOTIFICATION_ID, notification);
        EstimoteCloudCredentials cloudCredentials =
                new EstimoteCloudCredentials(appName, appToken);
        this.proximityObserver =
                new ProximityObserverBuilder(getApplicationContext(), cloudCredentials)
                        .onError(new Function1<Throwable, Unit>() {
                            public Unit invoke(Throwable throwable) {
                                Log.e("Proximity app", "proximity observer error: " + throwable);
                                return null;

ProximityZone zone1 = new ProximityZoneBuilder()
                .onEnter(new Function1<ProximityZoneContext, Unit>() {
                    public Unit invoke(ProximityZoneContext proximityZoneContext) {
                        Log.e(TAG, "invoke: Proxomity green enter");
                        return null;
                .onExit(new Function1<ProximityZoneContext, Unit>() {
                    public Unit invoke(ProximityZoneContext proximityZoneContext) {
                        Log.e(TAG, "invoke: Proxomity Green exit");
                        return null;

I have this problem too! Did you have solution?

Does this happen on Android 7.x by any chance? For a short time, Android 7.x introduced a 30-minute restriction on Bluetooth scanning, which means you essentially have to restart the scanning every 30 minutes. That restriction was later removed in Android 8.0 for hardware-filtered scans (which Proximity SDK uses, and which most (probably all?) modern Android smartphones support).

I’ve tested proximity scanning in android 8 and 9 and also found that proximityObserver stop scanning after long period of time. The following code is in onStartCommand and the service has startForeground(…)

        val estimoteMessageListener = EstimoteMessageListener(this.applicationContext)
        val proximityObserver = ProximityObserverBuilder(this, (this.applicationContext as ConnectApplication).cloudCredentials)
                .onError { throwable ->
                    Log.e("app", "proximity observer error: $throwable")

        val zone = ProximityZoneBuilder()
                .onContextChange { contexts ->
        proximityObserverHandler = proximityObserver.startObserving(zone)