【问题标题】:Using Trust Agents in android app在 Android 应用中使用信任代理
【发布时间】:2015-07-23 18:44:29
【问题描述】:

我正在尝试使用最近添加的 TrustAgent。 由 cmets 在 Git 上的官方Android sources 中制作的清单。正如在实施此类清单后所说的那样,我将能够从 TrustAgentService 扩展类。

就是这样:

<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>

但我仍然无法从 TrustAgentService 扩展。使用 API 22。SDK 已更新到最新版本。

【问题讨论】:

    标签: android android-service android-5.0-lollipop trust


    【解决方案1】:

    很遗憾,您不能使用这些 API..我也不能..

    不能直接继承 TrustAgentService 的原因是它被 @SystemApi 注释隐藏在 SDK jar 中。

    此外,android.permission.BIND_TRUST_AGENT 需要具有签名权限。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-08-18
      • 2019-01-08
      • 2016-11-16
      • 1970-01-01
      • 2012-11-24
      • 2020-10-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多