Skip to content

Latest commit

 

History

History
45 lines (34 loc) · 1.56 KB

README-en.md

File metadata and controls

45 lines (34 loc) · 1.56 KB

AndroidBleManager

android BLE device scan and connect manager, this library

Functions

Permission Explanation

You will need the following permissions to access the Bluetooth Hardware

  • android.permission.BLUETOOTH
  • android.permission.BLUETOOTH_ADMIN

if SDK >= 23, add permission

  • android.permission.ACCESS_COARSE_LOCATION
  • android.permission.ACCESS_FINE_LOCATION

TODO

  • Tidy up Javadoc. There is quite a lot of it that is template
  • Add parsers for common Ad Records.
  • Can not scan any device(SDK >= 21), link
//
private boolean checkLocationPermission() {
        return checkPermission(Manifest.permission.ACCESS_COARSE_LOCATION) || checkPermission(Manifest.permission.ACCESS_FINE_LOCATION);
    }

    private boolean checkPermission(final String permission) {
        return ContextCompat.checkSelfPermission(mContext, permission) == PackageManager.PERMISSION_GRANTED;
    }
    
    public static boolean isGpsProviderEnabled(Context context){
            LocationManager service = (LocationManager) context.getSystemService(context.LOCATION_SERVICE);
            return service.isProviderEnabled(LocationManager.GPS_PROVIDER);
        }
  • open or close log: BleManager.getInstance().setLogDebugMode(BuildConfig.DEBUG);

Links

Apk