1. 程式人生 > >安卓Service無法啟動的解決辦法

安卓Service無法啟動的解決辦法

直接上程式碼

<service
android:name=".DownLoadService"
android:label="SmartCamService"
android:enabled="true"
>
    <intent-filter>
        <action android:name="android.intent.action.RESPOND_VIA_MESSAGE"  />
    </intent-filter>
</service>
在Manifest中如此註冊,下面是啟動程式碼
//啟動Service的方法
Intent intent = new Intent(MainActivity.this, DownLoadService.class); intent.setAction("android.intent.action.RESPOND_VIA_MESSAGE"); MainActivity.this.startService(intent);
在開發過程中遇到的小問題,隨手記錄一下