The following code works great on my Nexus 9 running Android 5.1.1 (Build LMY48M), but won\'t work on a Nexus 9 running Android 6.0 (Build MPA44l)
List
I had a similar problem with an app connecting to bluetooth. Not LE ScanFilter, but it was a permissions issue just like the OP had.
Root cause is that starting with SDK 23, you need to prompt the user for permissions at runtime using Activity's requestPermissions() method.
Here's what worked for me:
Add one of the following two lines to AndroidManifest.xml, inside the root node:
In your Activity, before attempting to connect to bluetooth, call Activity's requestPermissions() method, which opens a system dialog to prompt the user for the permission. The permissions dialog opens in a different thread, so be sure to wait for the result before trying to connect to bluetooth.
Override Activity's onRequestPermissionsResult() to handle the result. This method will really only need to do something if the user refused to grant the permission, to tell the user that the app can't do the bluetooth activity.
This blog post has some example code that uses AlertDialogs to tell the user what's going on. It is a good starting point but has some shortcomings:
requestPermissions() thread to finishrequestPermissions() seems extraneous to me. A bare call to requestPermissions() is sufficient.