Android Question How to handle System Events?


Licensed User
Longtime User
Is it possible to intercept system events like touch/multitouch action.

If I understand correctly, any action (toch, button click, orientation, etc) firstly occured at system level and then, depending on current situation(active application) considering as a system call or passed to active activity or become available for running services.

My goal is to detect in my service definite multitouch action, regardless of current activity. I.e. with any active application(browser, game, etc).

For example, long touch on the launcher screen invokes wallpaper setup dialog. I need to react before this dialog happened.

What I need it for, is to use this multitouch event to put/wake the device in/from sleep mode.

Some devices(e.g. Chuwi V89) has very limited sensor set and programs like Smart Lock are unusable.

But if we made some conductive pattern on the cover, it will acts as multitouch in the predefined regions and so can be used for lock/unlock function.

Intuitevely I feel that it's not a simple task and may be it can not be realized with B4A. May be it is possible with tools like a Tasker.