简体   繁体   中英

How to inform a service, that an activity has finished

I have a service, that starts an activity like this:

    Intent i = new Intent();
    i.setClass(this, MyActivity.class);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(i); 

How to inform the service, that MyActivity has finished?

Any hints appreciated, Marcus

在活动的OnDestroy方法中,可以调用服务的方法,如果有服务类对象,则没有,请使用Broadcast Receiver向Service发送一些消息,然后在Service中实现该Broadcast Receiver 。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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