Reputation: 4185
I'm writing the library for Android apps which will report all crashes to the server. I need to report the last user clicks or user interactions with the app before the crash.
So the question is - Is there anyway to track all the clicks in whole android application?
In my library I have only Application instance.
Upvotes: 0
Views: 1006
Reputation: 16110
I am not sure its possible to catch all UI clicks. but you can make the developers add code to specific actions that will track this. like have your implementation of the onClick Listener, on touch listener that developers will extend to use with onTouch, on click.
Other than that i don't think its possible apart from adding a container view that will intercept all touch events as the root view.
For instance. you can provide extended basic components such as FrameLayout, RelativeLayout etc.. which override onInterceptTouchEvent
and track the events there. The developers will use your layouts for the root views for each of their screens.
Having a global touch handler which you would just plug into the Application class is not possible i believe. Java enables you to set default exception handlers as ACRA and the others do for this purpose.
Upvotes: 1