Beacon background service working properly only on stock android

I am trying to run a background service to detect if the phone is in beacons range when the application is not running.
When the app is not on active memory I can fire a event(in this case opening a activity) and see the the scanning in the android log too for stock android phones(I have tried with MotoG3 and MotoX play).

But the same thing is not running unless the app is in active memory for modified android os, like EUI 5.8(Le eco 1s) and ZEN UI (asus zenfone).

Please Help.

Here is the code:

package com.Tier5.Tier5SProximityContentJt6;

import android.app.Application;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.Tier5.Tier5SProximityContentJt6.estimote.NearableID;
import com.Tier5.Tier5SProximityContentJt6.estimote.Product;
import com.Tier5.Tier5SProximityContentJt6.estimote.ShowroomManager;
import com.estimote.sdk.Beacon;
import com.estimote.sdk.BeaconManager;
import com.estimote.sdk.EstimoteSDK;
import com.estimote.sdk.Nearable;
import com.estimote.sdk.Region;
import com.estimote.sdk.Utils;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

public class MyApplication extends Application {

    private BeaconManager beaconManager;
    private Region region;

    private static final String TAG = "kingsukmajumder";

    private ShowroomManager showroomManager;

    @Override
    public void onCreate() {
        super.onCreate();

        EstimoteSDK.initialize(getApplicationContext(), "tier5-s-proximity-content--jt6", "fd8423aedad957ca3de590bd006917e9");

        beaconManager = new BeaconManager(this);
        region = new Region("ranged region",
                UUID.fromString("B9407F30-F5F8-466E-AFF9-25556B57FE6D"), 38706, 35995);

        beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
            @Override
            public void onServiceReady() {
                beaconManager.startRanging(region);
            }
        });

        beaconManager.setRangingListener(new BeaconManager.RangingListener() {
            @Override
            public void onBeaconsDiscovered(Region region, List<Beacon> list) {
                if (!list.isEmpty()) {
                    Beacon nearestBeacon = list.get(0);

                    if(nearestBeacon.getMacAddress().toStandardString().equals("C9:AF:3A:1D:B0:68"))
                    {
                        Log.i("kingsukmajumder","beacon's distance : "+ Utils.computeAccuracy(nearestBeacon));

                        if(Utils.computeAccuracy(nearestBeacon)<1)
                        {
                            Log.i("kingsukmajumder",""+list.size());
                            Log.i("kingsukmajumder",nearestBeacon.getMacAddress().toStandardString());

                            if(TriggerHelper.getStatus())
                            {
                                Intent i = new Intent();
                                i.setClass(MyApplication.this, MainActivity.class);
                                i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                                startActivity(i);

                                TriggerHelper.setStatus(false);
                            }
                        }
                        else
                        {
                            //textView.setText("Not in beacon's range…");
                            //relativeLayout.setBackgroundColor(Color.rgb(102,51,51));
                        }

                    }
                    else
                    {
                        //textView.setText("Looking for beacons …");
                    }
                }
            }
        });

        //Codes for nearables
        Map<NearableID, Product> products = new HashMap<>();
        // TODO: replace with identifiers of your own nearables
        products.put(new NearableID("19cc106c8bcde68f"), new Product("Picked up Bed??",
                "These super cool headphones will make sure you'll re-discover your favorite Taylor Swift song anew. You just can't put a price tag on that!"));
        products.put(new NearableID("1f0eb3b17b647162"), new Product("Picked up a shoe.",
                "Rush down the local streets with this amazing bike, leaving a trail of rainbow behind you, to the awe of everyone around."));
        showroomManager = new ShowroomManager(this, products);
        showroomManager.setListener(new ShowroomManager.Listener() {
            @Override
            public void onProductPickup(Product product) {
               
                Log.i(TAG,product.getName()+"picked up");
            }
            @Override
            public void onProductPutdown(Product product) {
                
                Log.i(TAG,product.getName()+"put down");
            }
        });

        showroomManager.startUpdates();

    }



    public void showNotification(String title, String message) {
        Intent notifyIntent = new Intent(this, MainActivity.class);
        notifyIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
        PendingIntent pendingIntent = PendingIntent.getActivities(this, 0,
                new Intent[] { notifyIntent }, PendingIntent.FLAG_UPDATE_CURRENT);
        Notification notification = new Notification.Builder(this)
                .setSmallIcon(android.R.drawable.ic_dialog_info)
                .setContentTitle(title)
                .setContentText(message)
                .setAutoCancel(true)
                .setContentIntent(pendingIntent)
                .build();
        notification.defaults |= Notification.DEFAULT_SOUND;
        NotificationManager notificationManager =
                (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        notificationManager.notify(1, notification);
    }


}

Hi @Kingsuk_Majumder!

It’s great to see that background scanning works fine on official Android OS version. Unfortunately, we do not provide support for modified Android OS versions. We strongly recommend you using oficial releases to be perfectly sure about Estimote SDK reliability and stability.

I see your point. Unfortunately, we are not planning to support other built distribution of Android than official one in the near future.