我对android平台还很陌生。我想导出我的服务以供公众使用。
我在开发人员文档中找到了一些内容
android:exported
其他应用程序的组件是否可以调用该服务或与其交互 - 如果可以,则为“true”,如果不能,则为“false”。当值为“false”时,只有同一应用程序的组件或具有相同用户 ID 的应用程序才能启动该服务或绑定到该服务。
但我不明白
谁能告诉我一个如何使用它的简短示例?
“导出”的目的是让其他应用程序可以访问某项服务。
例如,\android-sdk-windows\samples\android-8\SampleSyncAdapter\AndroidManifest.xml
<service
android:name=".authenticator.AuthenticationService"
android:exported="true">
<intent-filter>
<action
android:name="android.accounts.AccountAuthenticator" />
</intent-filter>
<meta-data
android:name="android.accounts.AccountAuthenticator"
android:resource="@xml/authenticator" />
</service>
<service
android:name=".syncadapter.SyncService"
android:exported="true">
<intent-filter>
<action
android:name="android.content.SyncAdapter" />
</intent-filter>
<meta-data
android:name="android.content.SyncAdapter"
android:resource="@xml/syncadapter" />
<meta-data
android:name="android.provider.CONTACTS_STRUCTURE"
android:resource="@xml/contacts" />
</service>
然后可以在示例文件夹中找到与这些服务匹配的源代码
\android-sdk-windows\samples\android-8\SampleSyncAdapter\src\com\example\android\samplesync\authenticator\AuthenticationService.java
and
\android-sdk-windows\samples\android-8\SampleSyncAdapter\src\com\example\android\samplesync\syncadapter\SyncService.java
使用此功能的示例可能位于...
\android-sdk-windows\samples\android-8\SampleSyncAdapter\src\com\example\android\samplesync\client\NetworkUtilities.java (3 hits)
Line 63: "https://samplesyncadapter.appspot.com";
Line 238: // Succesfully connected to the samplesyncadapter server and
Line 287: // Succesfully connected to the samplesyncadapter server and
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)