Android Question [B4XPages] Put onUserInteraction event inside a Service

Mike1970

Well-Known Member
Licensed User
Longtime User
Hi everyone,
The app I'm developing needs to detect user interaction in every part of the screen at any time in order to reset a Timeout timer.
I did this currently with B4XPages exploiting this Java method, but this needs to be put in an Activity module, more specifically, in case of B4XPages it must be placed in Main module to work.

B4X:
Sub User_Interaction
    Log("interaction")
End Sub

#if Java
@Override
public void onUserInteraction() {
    processBA.raiseEventFromUI(null, "user_interaction");
}
#End If

The question is:
Can I put this method inside a Service instead of main somehow? It seems more logical to me in my case to have a "TimeoutService" with its methods that every B4XPage can access without problem, since it must NOT depend on the page showed on the screen.

Thanks in advance
 

DonManfred

Expert
Licensed User
Longtime User
Last edited:
Upvote 1
Top