Getting touch event in any view (Android) - android

I need to make a service that capture all touch events, not in a specific view or when an specific activity is open. This service is started when the boot is completed (and I have an app to stop/play this service when I want it). So it write something (in a Toast) when the user touch any place in the screen.
Can I do this? Or only in specifics things (with OnTouchListener and adding specifics views, for example)?
Sorry for my bad english.
thanks

If you override the View itself and build your own ROM, you will be able to have these kind of things. So, straight answer will be just no. Sorry.

Related

Automatic touch on android device(sending touch impulses)

I want to know if it is possible to generate automatic touch at regular intervals of time, say 5 seconds in another application.
For example..I want to develop an application which will create a touch response just as we touch the screen, at a particular coordinate at regular fixed interval.
Please help.
It's possible to create and dispatch touch events in your application. It's pretty easy. Look at View.dispatchTouchEvent method and parameters. You have to override that method in root view group so you can pass your events to all views in the activity.
It's not possible to access other applications though (due to security reasons).
edit: seems like dispatchTouchEvent is public, so no need to override

Where does an event go when injecting it into /dev/input/eventx?

I think I have read all post related with my query, some of them helped but I still can´t find the correct approach.
Im trying to develope an app which has to inject touch events into the system. As I was reading if you dont have system signature you can´t use the "logic" way, so we have to manage it using /dev/input/eventX.
Said that, I also attach photo of how events go through the system:
http://imageshack.us/f/201/eventosenandroid.png/
So I want to be sure that I understand how system manage events.
What I suppose is: When you inject a touch event in /dev/input/eventX the sequence for the event will finish into the activity which is currently "in the screen"
I just need to be sure if I can assume that it works like that or not really.
Thanks in advance
You managed to get somewhere with that? If not, did you have a look here?
Android INJECT_EVENTS permission
http://developer.android.com/reference/android/Manifest.permission.html#INJECT_EVENTS

ViewFlipper in AppWidgets and Don't keep activities

I am trying to implement a Appwidget using view flipper. I declared two views in my view flipper and everything working fine. Now from developer options select "Don't keep activities option" and come back to home screen. You will find appwidget with viewflipper is hang.
Remove appwidget from screen and resinstall. It will start workin normally till you are on home screen. Launching any activity will result in same problem. Your appwidget stop working.
From the logs there are nothing coming to your appwidget provider. Every time we launch any activity Home screen activity get killed.
This problem happens every time with ViewFlipper in particular.
I am really frustrated, with every new release Google adding more instability. Android should decide either handle activity cycle OR simply handle it like iOS.
If any body able to get around this problem with View flippers on Appwidget please enlighten me. Or If anyone think better not use viewflipper on appwidget , please share.
Oh! this is my problem, I thought I just wasn't handling low memory situations with the appwidget id's correctly
this app uses viewflippers on a widget https://play.google.com/store/apps/details?id=co.ccltd.maplights.nyc.freemium&feature=nav_result#?t=W251bGwsMSwxLDMsImNvLmNjbHRkLm1hcGxpZ2h0cy5ueWMuZnJlZW1pdW0iXQ..
what I did increase the widget update time, which is now 30 minutes. for my particular application this is adequate. Basically it the viewflippers and pendingintents will hang after android deprioritizes it (won't even be able to get a response after a click), but after the widget updates it will be working again.
or so I think, more testing is needed! but its good to know that its not only my handling of appwidget ids in low memory situations, but possibly a glitch

Is there a way to know why your application was not given priority as a receiver

I'm trying to override the default incoming screen, something that I know is possible in all edition of Android as fullscreencallerid does it (and well).
If I register a receiver and start an activity, I successfully replace the view with my activity. If however I start filtering by EXTRA_STATE, the default incoming call screen appears.
I suppose what would help is somehow seeing what the hell is android thinking at that point, and why it preferred the default receiver.
Is there a way to trace application lifecycle, even if it involves some heavy tweaking (It's purely for learning purposes).
Thank you.

Android detecting the touch state from any application

Is it possible to detect touch events from within another application, specifically swipes? I'd like to be able to detect if the user has swiped left or right (even with 2 fingers - but not required). Perhaps there is a service or broadcast I can listen to.
or failing that, is there some API perhaps that I can poll say 10 times a second to get the touch state and I can compute the rest (why, I remember writing a mouse driver strobing the COM1 port with IN OUTs in 8086 assembler coded in a TSR on a XT...)!
Anyway, any help appreciated. (I think it could be done by hijacking the primary Launcher and having a transparent click-through on-top activity, but that's seriously fraud with danger!)
Is it possible to detect touch events from within another application, specifically swipes?
Fortunately, no.
or failing that, is there some API perhaps that I can poll say 10 times a second to get the touch state and I can compute the rest
Fortunately, no.
I think it could be done by hijacking the primary Launcher and having a transparent click-through on-top activity
Fortunately, no.
You are welcome to write your own home screen application, in which case you can track your own touch events on your own home screen. You are welcome to write an ordinary application and track your own touch events on your own activities.

Categories

Resources