Android的 - 在Android上使用ICS广播接收器工作(第4版) [英] android - working with broadcastReceiver on android ICS (version 4)

查看:115
本文介绍了Android的 - 在Android上使用ICS广播接收器工作(第4版)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到(第4版)在Android ICS问题,广播接收器。请帮助:

i'm having a problem on android ICS (version 4) and broadcastReceiver . please help:

我想要听的网络连接变化的一个简单的意图。我尝试了一个教程(在单独的清单中定义的广播接收器 - 该网站的第一部分):
http://www.xinotes.org/notes/note/1526/
在ICS,它不捕获任何意图,和任何其他版本它工作得很好。

i'm trying to listen to a simple intent of network connectivity change . i've tried the next tutorial (with the broadcastReceiver defined in the manifest alone - the first part of the website ) : http://www.xinotes.org/notes/note/1526/ on ICS , it doesn't capture any intent , and on any other version it works just fine .

谁能告诉我有什么不对?我是否需要添加除侦听CONNECTIVITY_CHANGE的另外一个新的意图过滤器?
已经阻止谷歌上听ICS这样的意图?在那里为ICS已更改的任何其他新的规则?

can anyone please tell me what's wrong? do i need to add a new intent filter other than the one that listens to CONNECTIVITY_CHANGE ? has google blocked listening to such intents on ICS ? are there any other new rules for ICS that have changed ?

我认为其他broadcastReceivers也不会使用清单ICS工作。

i think that other broadcastReceivers also won't work on ICS using the manifest .

推荐答案

在该链接显示的示例code可以工作,但它需要一个活动。在Android 3.1以上版本,应用程序被安装在一个停止状态。而在这种状态下,没有广播接收器将工作,直到用户手动启动从应用程序的活动。该应用程序将返回到这个停止状态,如果用户强制停止从设置的应用程序。

The sample code shown in that link may work, but it needs an activity. On Android 3.1+, an application is installed in a "stopped" state. While in that state, no BroadcastReceiver will work, until the user manually launches an activity from the application. The application will return to this "stopped" state if the user force-stops the application from Settings.

所以,一个活动添加到您的项目中,启动它一次,然后看看你的接收器的工作原理。

So, add an activity to your project, launch it once, and then see if your receiver works.

这篇关于Android的 - 在Android上使用ICS广播接收器工作(第4版)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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