M Mike1970 Well-Known Member Licensed User Longtime User May 27, 2024 #1 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: Copy 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
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: Copy 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 May 27, 2024 #2 Mike1970 said: Can I put this method inside a Service instead of main somehow? Click to expand... NO. https://developer.android.com/reference/android/app/Activity#onUserInteraction() It is a method of Activity which can be override in an Activity only. Last edited: May 27, 2024 Upvote 1
Mike1970 said: Can I put this method inside a Service instead of main somehow? Click to expand... NO. https://developer.android.com/reference/android/app/Activity#onUserInteraction() It is a method of Activity which can be override in an Activity only.