这是我的清单,它在官方 dashclock 应用程序中运行良好,但在任何其他插件主机中都没有(我测试了侧边栏和一些类似的应用程序)。我在 logcat 中总是遇到同样的错误:调用者不是官方的 dashclock 应用程序,扩展名不是 worldReadable。
<service
android:name=".DashClockService"
android:icon="@drawable/ic_dashclock"
android:label="@string/app_name"
android:permission="com.google.android.apps.dashclock.permission.READ_EXTENSION_DATA" >
<intent-filter>
<action android:name="com.google.android.apps.dashclock.Extension" />
</intent-filter>
<meta-data android:name="protocolVersion" android:value="2" />
<meta-data android:name="worldReadable" android:value="true" />
<meta-data android:name="description" android:value="@string/extension_description" />
<meta-data android:name="settingsActivity" android:value=".DashClockSettingsActivity" />
</service>
编辑:这是日志。
12-06 14:41:32.667: W/System.err(1735): java.lang.NullPointerException
12-06 14:41:32.683: W/System.err(1735): at com.google.android.apps.dashclock.api.DashClockExtension.publishUpdate(DashClockExtension.java:354)
12-06 14:41:32.683: W/System.err(1735): at com.myapp.DashClockService.update(DashClockService.java:126)
12-06 14:41:32.683: W/System.err(1735): at com.myapp.DashClockService.onCreate(DashClockService.java:41)
12-06 14:41:32.687: W/System.err(1735): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2573)com.myapp12-06 14:41:32.687: W/System.err(1735): at android.app.ActivityThread.access$1700(ActivityThread.java:145)
12-06 14:41:32.687: W/System.err(1735): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1489)
12-06 14:41:32.687: W/System.err(1735): at android.os.Handler.dispatchMessage(Handler.java:102)
12-06 14:41:32.687: W/System.err(1735): at android.os.Looper.loop(Looper.java:137)
12-06 14:41:32.687: W/System.err(1735): at android.app.ActivityThread.main(ActivityThread.java:5062)
12-06 14:41:32.691: W/System.err(1735): at java.lang.reflect.Method.invokeNative(Native Method)
12-06 14:41:32.691: W/System.err(1735): at java.lang.reflect.Method.invoke(Method.java:515)
12-06 14:41:32.691: W/System.err(1735): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
12-06 14:41:32.691: W/System.err(1735): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
12-06 14:41:32.691: W/System.err(1735): at dalvik.system.NativeStart.main(Native Method)
12-06 14:41:32.953: E/DashClockExtension(1735): Caller is not official DashClock app and this extension is not world-readable.
12-06 14:41:32.960: W/Binder(1735): Caught a RuntimeException from the binder stub implementation.
12-06 14:41:32.960: W/Binder(1735): java.lang.SecurityException: Caller is not official DashClock app and this extension is not world-readable.
12-06 14:41:32.960: W/Binder(1735): at com.google.android.apps.dashclock.api.DashClockExtension$1.onInitialize(DashClockExtension.java:289)
12-06 14:41:32.960: W/Binder(1735): at com.google.android.apps.dashclock.api.internal.IExtension$Stub.onTransact(IExtension.java:52)
12-06 14:41:32.960: W/Binder(1735): at android.os.Binder.execTransact(Binder.java:404)
12-06 14:41:32.960: W/Binder(1735): at dalvik.system.NativeStart.run(Native Method)
添加一些附加信息:扩展显示为可用,但不会更新或初始化。服务正在运行。