在开机的时候启动的Andr​​oid服务的Andr​​oid 4.0 [英] Start Android Service on boot time Android 4.0

查看:140
本文介绍了在开机的时候启动的Andr​​oid服务的Andr​​oid 4.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我triying启动机器人服务于Android 4.0的时候,设备启动,开机时间,但它的IMPOSIBLE,我曾使用许多codeS,复制和粘贴。我用了code从这里开始,对别人的例子和问题计算器,但对我来说是IMPOSIBLE。我使用的是安卓4.0.1表中的宏碁Iconia A501。我把我的code在这里。有人也可以试试这个code ???这是网页:此页面请,很容易

I'm triying to start a android service in android 4.0 when the device is booting, in boot time, but it's imposible , I had be used many codes, copy and paste. I had used code from here, stackoverflow of others examples and questions , but for me is imposible. I'm using android 4.0.1 in a table Acer Iconia A501. I put my code here. Somebody Can it try this code??? this is the page :This page please, it is easy

推荐答案

您需要注册一个广播接收器为广播在启动时的意图。有ZERO疑问,这是你需要做的。

You need to register a broadcast receiver for the intent that is broadcast on startup. There is ZERO doubt that this is what you need to do.

请参阅:<一href="http://stackoverflow.com/questions/5051687/broadcastreceiver-not-receiving-boot-completed">BroadcastReceiver没有收到BOOT_COMPLETED

您需要做的是一样的。注册一个广播接收器,并首先确保您正赶上BOOT_COMPLETED事件。然后做了startService它只是一个问题。

You need to do the same. Register a broadcast receiver and first make sure that you are catching the BOOT_COMPLETED event. Then its just a matter of doing a startService.

现在的问题是最有可能的清单。检查是否有准确的名字的一切。请注意。像.MyBroadcastReceiver的名字,这些都是非常重要的。缺少一样东西会引起问题。

The problem is most likely in the Manifest. Check that you have exactly the right name for everything. Note the . in names like .MyBroadcastReceiver These are important. Missing just one thing will cause a problem.

接收机和服务的定义必须是完美的。同时检查logcat的,并告诉我们什么错误都在那里。

Both the Receiver and Service definition must be perfect. Also check logcat and tell us what errors are there.

这篇关于在开机的时候启动的Andr​​oid服务的Andr​​oid 4.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆