Closed nedimf closed 4 years ago
Seems like problem was at permission enabling on device. I had to give permission for location service to work. One more question before I close this, what is scanResult
returning, I'm having issue to get any scanned results still (I can only access ones that are called by peripheralCallback).
In provided code peripheralCallback calling is not present.
I'm not using this library anymore, so I'm closing the issue.
P.S
Never solved it. But my investigation showed checkForPermission > 23
is needed.
@RequiresApi(api = Build.VERSION_CODES.M)
private void checkBTPermissions() {
if(Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP){
int permissionCheck = this.checkSelfPermission("Manifest.permission.ACCESS_FINE_LOCATION");
permissionCheck += this.checkSelfPermission("Manifest.permission.ACCESS_COARSE_LOCATION");
if (permissionCheck != 0) {
this.requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, 1001); //Any number
}
}else{
Log.d("TAGG", "checkBTPermissions: No need to check permissions. SDK version < LOLLIPOP.");
}
}
Maybe you should check out the testapp that is part of this repo and familiarize yourself with that. That shows how to scan and connect to devices as well as asking for the right permissions.
I have been trying to implement your library to a project but having problem with getting any devices found?