Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Trust Agents in android app

I'm trying to use recently added TrustAgents. Manifest made by comments in official Android sources on Git. As there is said after implementing such manifest I will be able to extend classes from TrustAgentService.

That's it:

<uses-permission android:name="android.permission.CONTROL_KEYGUARD" />
<uses-permission android:name="android.permission.PROVIDE_TRUST_AGENT" />

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

    <service android:exported="true"
             android:label="@string/app_name"
             android:name=".CustomTrustAgent"
             android:permission="android.permission.BIND_TRUST_AGENT">

        <intent-filter>
            <action android:name="android.service.trust.TrustAgentService" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>

        <meta-data android:name="android.service.trust.trustagent"
                   android:value="@xml/trust_agent" />

    </service>

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

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

But I still can't extend from TrustAgentService. Using API 22. SDK is updated to latest version.

like image 634
Long Smith Avatar asked Oct 25 '25 03:10

Long Smith


1 Answers

Unfortunately you can't use these APIs..and me neither..

The reason why you can't directly subclass the TrustAgentService is that it's hidden from SDK jars by the @SystemApi annotation.

Furthermore the android.permission.BIND_TRUST_AGENT requires having the signature permission.

like image 70
simekadam Avatar answered Oct 26 '25 23:10

simekadam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!