Re: [問題] Service在開機時啟動
※ 引述《milochen (N=NP)》之銘言:
: Sorry, I cannot type Chinese now.
: But, here I can start Service easily here
: Actually, It's just need to understand INTENT
: And there are just three step if you want to start Service at booting
: Step 1. In AndroidManifest.xml, add Intent filter for BOOT_COMPLETED
: example.
: -----------------------------------------
: <application ...>
: <service ... >
: <intent-filter>
: <action android:name="android.intent.action.BOOT_COMPLETED" />
: </intent-filter>
: </service>
: </application>
: -------------------------------------
樓上這篇對我沒用...
找了四個小時找到另外一個解決方法
不是在<service>裡面加 <intent-filter>
而是開一個BroadcastReceiver
詳情..
http://stackoverflow.com/questions/4562734/android-starting-service-at-boot-time
縮網址
http://ppt.cc/geyH
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.166.46.224
推
06/06 23:10, , 1F
06/06 23:10, 1F
討論串 (同標題文章)
AndroidDev 近期熱門文章
PTT數位生活區 即時熱門文章