我試圖做一個RemoteService,我按照這個指南: http://www.techotopia.com/index.php/Android_Remote_Bound_Services_%E2%80%93_A_Worked_Example服務意向必須是明確的:意向
這是在清單我的服務宣言:
<service android:name=".RemoteService"
android:process=":InnolertRemoteProcess"
android:exported="true">
<intent-filter>
<action android:name="myService.RemoteService"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</service>
這是怎麼我綁定到服務,從我的客戶端應用程序:
Intent intent = new Intent("myService.RemoteService");
bindService(intent, myConnection, Context.BIND_AUTO_CREATE);
我得到這個異常:
java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=myService.RemoteService }
你必須使用一個'PackageManager'爲了得到明確的'Intent',例如'PackageManager#resolveService'或'PackageManager #queryIntentServices' – pskink