I have developed apps for screen mirroring one is for server and other is receiving server's screens.
Now, i am working on adding Touch events in receiver app and send touch event to server app. As both apps are on different devices so i am making connection using DLNA protocol for the communication.
But i am not able to inject touch event from receiver to server app and not able to achieve the functionality. I want to inject touch events without rooting my devices.
Following is the code that i am using:
m_Instrumentation = new Instrumentation();
AsyncTask.execute(new Runnable() {
@Override
public void run() {
//TODO your background code
m_Instrumentation.sendPointerSync(MotionEvent.obtain(SystemClock.uptimeMillis(),
SystemClock.uptimeMillis(),MotionEvent.ACTION_DOWN,x, y,0));
m_Instrumentation.sendPointerSync(MotionEvent.obtain(SystemClock.uptimeMillis(),
SystemClock.uptimeMillis(),MotionEvent.ACTION_UP,x, y,0));
}
});
The above code giving error that is Request Permission to inject event
As inject_event permission is a system permission so i have to make app as system app. For making system app i have to sign app with system certificates. So i followed the link How to compile Android Application with system permissions And if i am able to generate app as system app then i have to install it as /system/app
but when i am searching for adding app as system app then is asking for root device to get read/write
access from OS. But i don't want to root the device.
Any helps would be appreciated deeply.