我有一个以编程方式注册的广播接收器.它响应了PACKAGE_REMOVED一个包被删除时触发的意图.
问题是,它没有得到这个消息.我认为这是因为当我离开活动并转移到另一个活动以卸载应用程序时,意图被触发,因此原始活动暂停.可能暂停活动(接收器未注册onPause)也会暂停接收器吗?
有没有人知道如何听CLICK或HOVER等鼠标事件,这样当我点击或悬停任何元素时,它会在第二个浏览器中发生相同的事情?抱歉不包括代码.
<script>
// creating a new websocket
var socket = io.connect('http://localhost:8000');
// on message recived we print the new data inside the #container div
socket.on('notification', function (data) {
$("p").click(function () {
alert("Hello");
//or change the color
$(this).css({"color": "red"});
});
var usersList = "<div id='aaa'>";
$.each(data.users, function (index, user) {
usersList += "<p>" + user.users + "</p>";
});
usersList += "</div>";
$('#container').html(usersList);
});
</script>
<p>Click me!</p>
Run Code Online (Sandbox Code Playgroud)