Android Question Remember the activity that called a service

SteveTerrell

Active Member
Licensed User
Longtime User
I have a service that does work for different activities (in the same application) at different times, something like a client-server arrangement.

The service is asked to perform a time dependent operation action by a CallSubDelayed from an Activity and "replies" to it some time later with its own CallSubDelayed.

I can pass the calling Activity as a parameter to the service but it cannot be stored in the Service Process_Globals.

Is there some way that the Service can "remember" which activity requested the operation so that the reply CallSubDelayed goes to the correct activity?
 

SteveTerrell

Active Member
Licensed User
Longtime User
You can store it as a process global variable. You should use:
B4X:
CallSubDelayed2("...", Me)

'in service
Sub SomeSub(CallBackModule As Object)

You can then use this object to make the call back event.

Thanks,

It was saving the sender activity as an Object that I had missed.

Steve
 
Upvote 0
Top