How to contact the service from the Activity launched by this service

I have a "MyService" service running in the background that fires the "MyActivity" action for a specific event (code below).

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

"MyActivity" performs some action and should return to "MyService", but I do not know how to do this, since there is no link to the service.

Please note: "MyService" extends "HostApduService". I just checked in the docs that HostApduService declared 'onBind' final

@Override
public final IBinder onBind(Intent intent) {
    return mMessenger.getBinder();
}

So, I can’t use the service binding mechanism, right?

Any pointers please?

Thanks
iuq

0

Source: https://habr.com/ru/post/1547719/


All Articles