Injecting events to other applications/activities is not allowed.

On Jan 25, 9:57 am, swapnil kamble <[email protected]> wrote:
> Hi,
>    I have added this line in my androidManifest.xml
>
> <uses-permission android:name="android.permission.INJECT_EVENT"/>
>
> I am trying to execute following code,
>
>                         long downTime = SystemClock.uptimeMillis();
>                         long eventTime = SystemClock.uptimeMillis();
>
>                         Instrumentation inst = new Instrumentation();
>
>                         MotionEvent event = MotionEvent.obtain(downTime,
> eventTime,
>                         MotionEvent.ACTION_DOWN, x, y, 0);
>
>                         Log.d( LOG_TAG,"injecting motion event down" );
>                         *inst.sendPointerSync(event);
>                         //wm.injectPointerEvent( event,true );*
>
> Both above lines are throwing exception W/System.err(  762):
> java.lang.SecurityException: Injecting to another application requires
> INJECT_EVENT permission.
>
> Do we need anything else too to get it working ?
>
> Thanks in advance

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to