1

I'm trying to use the new fingerprint gesture callback from android O.

I've declared these in the manifest

<uses-feature android:name="android.hardware.fingerprint"/>
<uses-permission android:name="android.permission.USE_FINGERPRINT"/>

My accessibility service xml looks like this:

<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
                   android:description="@string/accessibility_service_description"
                   android:accessibilityEventTypes="typeAllMask"
                   android:accessibilityFlags="flagRequestFingerprintGestures"
                   android:accessibilityFeedbackType="feedbackAllMask"
                   android:notificationTimeout="100"
                   android:canRetrieveWindowContent="false"
                   android:canRequestEnhancedWebAccessibility="false"
                   android:settingsActivity="com.example.finger.MainActivity"/>

..and then in the accessibility service onServiceConnected method I'm trying to register a callback with the following

 FingerprintGestureController.FingerprintGestureCallback callback = new 
 FingerprintGestureController.FingerprintGestureCallback(){

            @Override
            public void onGestureDetectionAvailabilityChanged(boolean available) {
                LogUtil.d("available: " + available);
                super.onGestureDetectionAvailabilityChanged(available);
            }

            @Override
            public void onGestureDetected(int gesture) {
                LogUtil.d("gesture: " + gesture);
                super.onGestureDetected(gesture);
            }
        };

 FingerprintGestureController controller = 
 this.getFingerprintGestureController();
 controller.registerFingerprintGestureCallback(callback, null);

The accessibility service registers fine and the code above to register the callback gets called ok, but I never get a call to the onGestureDetectionAvailabilityChanged and onGestureDetected

The documentation around it is somewhat lacking so I'm not sure what else I need to be able to get the callback working.

greywolf82
  • 21,813
  • 18
  • 54
  • 108
Andrew
  • 7,548
  • 7
  • 50
  • 72

1 Answers1

0

You need to add android:canRequestFingerprintGestures="true" to the xml file

greywolf82
  • 21,813
  • 18
  • 54
  • 108
  • Didn't worked for me: – user531069 Sep 08 '17 at 20:51
  • It seems obvious why, the parameter must be inserted in the XML, not in the manifest – greywolf82 Sep 08 '17 at 20:53
  • I tried it in XML as well but still not getting any callbacks. protected void onServiceConnected() { FingerprintGestureController gestureController = getFingerprintGestureController(); Log.e(TAG, "Is available: " + gestureController.isGestureDetectionAvailable() ); // This always returns FALSE even though swipes are enabled in system and through accessibility as well } – user531069 Sep 08 '17 at 21:27
  • I posted new question with all my code: https://stackoverflow.com/questions/46125945/android-o-fingerprint-gesture-callback-not-working – user531069 Sep 09 '17 at 00:06