Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 6.0.1 - security patch level 1 don't work #412

Closed
FedericoTorsello opened this issue Aug 7, 2016 · 4 comments
Closed

Android 6.0.1 - security patch level 1 don't work #412

FedericoTorsello opened this issue Aug 7, 2016 · 4 comments

Comments

@FedericoTorsello
Copy link

Expected behavior

Scanning for detect the beacons nearby and getting information.

Actual behavior

The scanning start but on didRangeBeaconsInRegion anybody beacon is detected.
The method onRequestPermissionsResult is correctly set.
The Bluetooth work correctly in other applications (Bluetooth LE Scanner) that use classic onLeScan(...) method.

Other test: Locate application don't detect nothing.
Test with Locate:

  1. bluetooth start disabled/enabled
  2. wifi start disabled/enabled
    no change detected...

Steps to reproduce this behavior

Start application e start scanning, but the size of the variable beacons of "final Collection beacons" is always zero.

Mobile device model and OS version

ASUS_Z00LD (http://specdevice.com/showspec.php?id=9275-2ed6-b72b-0cbf5429c89f), Android 6.0.1 - security patch level 1, API 23

Android Beacon Library version

2.9

@davidgyoung
Copy link
Member

To clarify, it sounds like you are suggesting that this ASUS_Z00LD 6.0.1 OS image breaks scanning on the newer Android 5+ BLE scanning APIs. Correct?

To confirm the library still works with the older 4.3 APIs, can you try adding the line:

beaconManager.setAndroidLScanningDisabled(true);

And retesting to see if scanning works?

I will note that I have successfully scanned beacons with the library using the Android L APIs on the Nexus 9 and Nexus 5X with 6.0.1.

@FedericoTorsello
Copy link
Author

On the basis of my tests:

  1. if in build.gradle(Module: app) I set: minSdkVersion 18 and targetSdkVersion 23
    1. beaconManager.setAndroidLScanningDisabled(true); don't have effect. The scanning start but the Collection is always size zero.
    2. with the default config, the scanning start but the Collection is always size zero.
  2. if in build.gradle(Module: app) I set: minSdkVersion 18 and targetSdkVersion 18 the app works without any problems.

It would seem a problem connected to the permissions of Android 6.

The code I used is: [copy and paste of android-beacon-library-reference project]

    @Override
    public void onRequestPermissionsResult(int requestCode,
                                           String permissions[], int[] grantResults) {
        switch (requestCode) {
            case PERMISSION_REQUEST_COARSE_LOCATION: {
                if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                    Log.d(TAG, "coarse location permission granted");
                } else {
                    final AlertDialog.Builder builder = new AlertDialog.Builder(this);
                    builder.setTitle("Functionality limited");
                    builder.setMessage("Since location access has not been granted, this app will not be able to discover beacons when in the background.");
                    builder.setPositiveButton(android.R.string.ok, null);
                    builder.setOnDismissListener(new DialogInterface.OnDismissListener() {

                        @Override
                        public void onDismiss(DialogInterface dialog) {
                        }

                    });
                    builder.show();
                }
                return;
            }
        }
    }

P.S.
Locate Beacon (https://play.google.com/store/apps/details?id=com.radiusnetworks.locate&hl=en) does not work exactly such as my application.

@davidgyoung
Copy link
Member

davidgyoung commented Aug 8, 2016

Do you get prompted for location permission? What do you see if you go to Settings -> Locate -> Permissions? (Same question for your app.). Is location permission on?

screenshot_20160808-081107

@FedericoTorsello
Copy link
Author

Ok, my app work if I set On in Settings -> Location (High accuracy or Battery saving mode).

It is not the same for AltBeacon Loc. I have reinstalled him, but something goes wrong.
I checked in Settings -> App -> AltBeacon Loc -> Permissions and Location is set on.

I'm happy to have solved, but I really feel AltBeacon Loc does not work.

Thank You!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants