作者asadman1523 (黑炭)
看板AndroidDev
标题Re: [问题] Service在开机时启动
时间Thu Jun 6 17:03:32 2013
※ 引述《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
1F:推 gpc:确实该篇是错误的 不过居然是两年前的文章. 06/06 23:10