1
我嘗試通過論壇Dictionary Api翻譯一個詞。 Here更多關於ForaApi。這裏是我的代碼:無法啓動服務意圖。論壇詞典
String query = "com.ngc.fora.action.QUERY";
Intent foraIntent = new Intent(query);
foraIntent.putExtra("QUERY_ID", new Long("1"));
foraIntent.putExtra("QUERY", lword);
foraIntent.putExtra("MAX_RESULTS", 2);
foraIntent.putExtra("AS_PAGE", true);
foraIntent.putExtra("CALLBACK_ACTION", "com.myAPP.ServiceForFora.TRANSLATE");
foraIntent.putExtra("CALLBACK_PACKAGE", "com.myAPP");
foraIntent.putExtra("CALLBACK_CLASS", ".ServiceForFora");
startService(foraIntent);
但是當佛拉字典嘗試發送意圖我的服務(ServiceForFora)我得到這個:
6月5日至7日:20:40.440:W/ActivityManager(52) :無法啓動服務意向{行動= com.myAPP.ServiceForFora.TRANSLATE CMP = com.myAPP/.ServiceForFora(有演員)}:找不到
這裏是我的服務:
epublic class ServiceForFora extends Service{
@Override
public IBinder onBind(Intent intent) {
Toast.makeText(this, "onBind", Toast.LENGTH_LONG).show();
return null;
}
@Override
public void onCreate() {
//code to execute when the service is first created
Toast.makeText(this, "onCreate", Toast.LENGTH_LONG).show();
super.onCreate();
}
@Override
public void onDestroy() {
//code to execute when the service is shutting down
super.onDestroy();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
//code to execute when the service is starting up
super.onStart(intent, startId);
return Service.START_STICKY;
}
}
和明顯的符號:
<application><service android:name="com.myAPP.ServiceForFora"
android:exported="true">
<intent-filter>
<action android:name="com.myAPP.ServiceForFora.TRANSLATE"/>
</intent-filter>
</service>
.............................
</application>
感謝的
嗨,你知道爲什麼它不起作用嗎?我有相同的情況:( –