推 gpc:確實該篇是錯誤的 不過居然是兩年前的文章. 06/06 23:10
※ 引述《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