Started to work on the Service class.
Created a broadcastReciever too that receives the intent sent from after device finishes booting up. This will help me be able to start the service as soon as boot is over.
However, the service class is really causing me trouble. I discovered that it is not possible for services to detect motionEvents. That is the first problem. Even if i did make it able to detect motionEvents, there is still the second problem. Due to safety and security, we can only detect motionEvents for our own activities. Beyond that and its pretty much something like a TouchScreen Keylogger. =/
I got close to figuring out the problem when I accidentally came across the term Tapjacking. When used maliciously, its potentially dangerous. But if used without ill intentions, it can definitely give me what I need to be able to detect touch events on the very top layer of apps. However, this does feel like I’m experimenting in exploiting a flaw I’m not supposed to touch. =[
I was successful in getting it to detect touch responses on top of other activities. However, it will only detect Action_Outside events and that’s not what I need. I discovered that this was from me using the FLAG_WATCH_OUTSIDE_TOUCH flag with TYPE_SYSTEM_OVERLAY.
I was slightly able to fix the problem by changing to TYPE_SYSTEM_ALERT. I’m now able to detect Action_Down, Action_Move, and Action_Up events. I was slightly excited by this, however I soon noticed that although I was able to detect the events now, I had somehow made the touch events to not be detected by the activity it was above. This would be very helpful in causing a person to no longer be able to use the touchscreen on his phone, but useless to my app if I am unable to use the apps underneath.
Must experiment some more.