[英]android service running in the background
I would like to make a service that runs in the background and monitors the quality. 我想提供一个在后台运行并监视质量的服务。 I have thought of a separate service that exposes an aidl interface to an activity, the aidl would have some monitor related functions that an activity can call.
我想到了一个单独的服务,该服务向活动公开了一个辅助接口,辅助将具有活动可以调用的一些与监视器相关的功能。 To give an example of how my service should work think of the ebuddy application that runs in the background and waits for incoming calls (I believe this is done by a service).
为了举例说明我的服务如何工作,请考虑运行在后台并等待传入呼叫的ebuddy应用程序(我相信这是由服务完成的)。
Ok so to make the notification you simply have to do 好的,只需发出通知即可
mNotification = new Notification( icon, text, when );
mNotification.flags |= Notification.FLAG_ONGOING_EVENT;
and notify using notification manager. 并使用通知管理器进行通知。
If someone needs to run something on the background (not a background thread) then you have to extend service class,you have to bind to the service and get a stub, you can then call methods that the stub exposes through it's aidl file. 如果有人需要在后台运行某些内容(而不是后台线程),则必须扩展服务类,必须绑定到该服务并获取一个存根,然后可以调用该存根通过其aidl文件公开的方法。 for more information you can check out the Remote service example that comes with the SDK, its located in:/src/com.example.android.apis/app
有关更多信息,您可以查看SDK随附的远程服务示例,该示例位于:/src/com.example.android.apis/app
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.