Skip to content

iBeacon Scan stops when using two Services #59

@ganddev

Description

@ganddev

Hi
I'm trying to use GCM and iBeacon in one app. For the registration to GCM I use a service and start it as following in the onCreate of the activity:

startService(new Intent(this, MessageReceivingService.class));

After that I want to scan for iBeacons, with the BeaconManager.

beaconManager = new BeaconManager(this);

beaconManager.setRangingListener(new BeaconManager.RangingListener() {
            @Override
            public void onBeaconsDiscovered(Region region, List<Beacon> beacons) {
                for (Beacon b : beacons) {
                    if (Utils.proximityFromAccuracy(Utils.computeAccuracy(b))
                            .equals(Utils.Proximity.NEAR)) {
                        Log.d(TAG, b.toString());
                        SharedPreferences prefs = getSharedPreferences(getString(R.string.preferences), Context.MODE_PRIVATE);

                        if(prefs != null && !prefs.getBoolean(getString(R.string.first_launch), true))
                        {
                            ApiService.notifyCustomer(b);
                        }
                    }
                }
            }
        });

The problem is that the app doesn't start BLE scan for iBeacons. When I don't start the GCM Service, everything works fine. Is it a bug in the SDK or do I something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions