服务和广播接收器在Android的区别 [英] Difference between Service and Broadcast receivers in android

查看:120
本文介绍了服务和广播接收器在Android的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道的服务和广播接收器之间的差异,任何人都可以指出,可以在机器人的移动设备可观察的一个例子。 谢谢

I want to know the difference between services and broadcast receivers, can anyone point out an example that can be observed on android mobile devices. Thanks

推荐答案

服务:如果你想做些什么的背景下,这将是在后台始终运行,即使在应用程序关闭。您可以在单独的进程中创建这个,你也可以给你的服务,其他的应用程序,如果你想。下载任何内容或音乐是很好的例子。

Service: If you want to do something in background , this will be running always in background even if the application closed. You can create this in separate process and also you can give your service to other app if you want. Downloading any content or Music is good example

广播Reciever:通常系统会发送一些信息,可以通过你的应用程序进行:收到,如果你希望,通过注册。你可以做你想要的东西时的事情发生使用的onReceive方法是什么。 示例是系统会发送BroadcastReceiver的时候新的短信息到达或引导完成

Broadcast Reciever: Usually system will send some info which can be recieved by your app if you would wish to ,by registering. And you can do something what you want when that thing happens by using onReceive method. Example is the system will send BroadcastReceiver when new sms arrives or Booting done

下面是一篇好文章:服务和BroadcastReceiver的

这篇关于服务和广播接收器在Android的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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