java - Sending Scroll event to another application -


i think question bit crazy, want send scroll event app app ( eg chrome ). if chrome opened , when user press vol or down button, background activity listen button event , if event scroll chrome opened webpage or down. not sure possible because reading through doc's google , saying need root permission sent event 1 app another. don't have code yet. 1 know possible android api ?

thanks

i cannot answer in context of chrome. however, can serialize need , send via intent system application.

as example, in first application, receive touch event

boolean ontouch(motionevent event){     if(event.getactionmasked() == motionevent.action_up){         intent startotherapplication = new intent();         startotherapplication.putextra("action_up_x",event.getx());         startotherapplication.putextra("action_up_y",event.gety());         startotherapplication.setcomponent(new componentname("com.your.other.application", "com.your.other.application.activityyouwanttohandletouch"));         startactivity(intent);     } } 

you extract intent in activity (activityyouwanttohandletouch) in other application.

public void oncreate(bundle savedinstancestate){     super.oncreate(savedinstancestate);     intent fetchedintent = getintent();     boolean hasupaction = false;             int x = 0;     int y = 0;             if(fetchedintent != null){              hasupaction = (fetchedintent.getextra("action_up_x")!=null);              x = fetchedintent.getextra("action_up_x");              y = fetchedintent.getextra("action_up_y");      } } 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -