How can you create an XML file that is referenced by the metadata of an accessibility service?

Viewed 177

This question might seem very simple to answer, but I seem to be having a problem with adding an XML that's referenced by my accessibility service's metadata. I tried many things, but couldn't find a solution. I placed the reference XML file for the metadata under res>xml and I don't see why it shouldn't work.

This is the code I have for my AndroidManifest.xml file:

'''

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapplication">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <service android:name=".myAccessibilityService"
            android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
            android:label="detectClick">


            <intent-filter>
                <action android:name="android.accessibilityservice.AccessibilityService" />
            </intent-filter>

            <meta-data
                android:name="android.accessibilityservice"
                android:resource="@xml/accessibility_service_config" />


        </service>
    </application>

</manifest>

'''

This is how my XML file looks like:

''' '''

I expected the "android" to be color-coded, but it doesn't seem that way, causing my service to not request certain permissions (which means it's not working). Something interesting that happened was that when I deleted the XML file for the metadata, the error detector tried to automatically create an XML with fields I wasn't familiar with. I was thinking it had something to do with this, but wasn't sure:

''' '''

Any help would be greatly appreciated.

1 Answers

I seemed to solve the problem by fiddling around a little. Take a look:

<accessibility-service android:accessibilityEventTypes="typeViewClicked|typeViewFocused"
android:packageNames="com.example.android.myFirstApp, com.example.android.mySecondApp"
android:accessibilityFeedbackType="feedbackSpoken"
android:notificationTimeout="100"
android:settingsActivity="com.example.android.apis.accessibility.TestBackActivity"
android:canRetrieveWindowContent="true"
xmlns:android="http://schemas.android.com/apk/res/android" />
Related