简体   繁体   English

Android服务或广播接收器

[英]Android Service or Broadcast Receiver

My app is for tracking, have to send to php all I got. 我的应用程序用于跟踪,必须将所有信息发送到php。 I have methods such as postData to php, my location listener class and getMyPhoneNumber. 我有诸如postData到php的方法,我的位置侦听器类和getMyPhoneNumber。 My question is what should I choose to develop that app? 我的问题是我应该选择开发哪个应用程序? I have read Android Service and Broadcast Receiver documents and I still can't figure it out. 我已经阅读了Android服务和广播接收器文档,但仍然无法弄清。 Which one of them is more suitable? 其中哪一个更合适? PS, Thanks in advance PS,预先感谢

suitable depends upon requirment . 合适取决于要求。 if you want to receive particular broadcast or in other words want to do some operation on specific event like location change use broadcase Reciever while if you want something to happen consistently use srvice . 如果您想接收特定的广播,或者换句话说,要对特定事件进行某些操作(例如位置更改),请使用大写接收者;而如果您想要连续进行某些事情,请使用服务。

service will always run (in background) while BroadCastReceiver will receive related broadcast and run 服务将始终(在后台)运行,而BroadCastReceiver将接收相关的广播并运行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM