0
在啓動時啓動服務的代碼.....我甚至包括清單文件的權限,如前所述...但服務不啓動...我必須通過startService(Intent ..)命令明確地開始...我在做什麼時有任何錯誤?無法啓動整個應用程序的引導加載活動
public class BootReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent arg1) {
Intent serviceIntent = new Intent(BackgroundService.class.getName());
context.startService(serviceIntent);
}
}
<receiver android:name="BootReceiver">
<intent-filter>
<action
android:name="android.intent.action.BOOT_COMPLETED">
</action>
</intent-filter>
</receiver>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
即使這對我也不適用....清單中應用程序節點外部的 ... –
2011-04-02 05:34:35
當我這樣做,服務應該開始在應用程序加載權... – 2011-04-02 05:35:10
仔細檢查你的代碼和清單。也看看這個問題:http://stackoverflow.com/questions/1056570/how-to-autostart-an-android-application – Olegas 2011-04-03 18:47:44