java - Android HTC sense 4 and HTC sense 5 - answer incoming call feature doesnt work -


hi write app answers incoming call on press overlayed button . working perfect on android 4.0.3 - 4.3 not on htc sense 4 , htc sense 5 . know how bring in life function htc sense ?

thanks lot )

code use in regular android call acceptation : ///////////////////////////////////////////////////////////////////////////////////////////////

public static void answerincomingcall(context context) {      intent = new intent(intent.action_media_button);     i.putextra(intent.extra_key_event, new keyevent(keyevent.action_up, keyevent.keycode_headsethook));     context.sendorderedbroadcast(i, null); } 

///////////////////////////////////////////////////////////////////////////////////////////////

not worked htc sense. after modified bit , worked on htc opensens emulator didnt work on real htc sense 5 , 4 :

///////////////////////////////////////////////////////////////////////////////////////////////

public static void answerincomingcallhtc(context context)  {      intent = new intent(intent.action_media_button);     i.putextra(intent.extra_key_event, new keyevent(keyevent.action_up ,keyevent.keycode_headsethook));     context.sendorderedbroadcast(i, "android.permission.call_privileged");  } 

///////////////////////////////////////////////////////////////////////////////////////////////

i tried use open sesne api in htcdev portal. , found 2 possible options both didn't work :(

1st :

phonecalluiservice.phonecalluistate phone = new phonecalluistate(context); phone.setcallstate( phonecalluiservice.phonecalluistate.call_state_offhook); 

but got no class found exception ....

2nd: tried bind open.phone service didn't succeed bound service

///////////////////////////////////////////////////////////////////////////////////////////////

public static void answerincomingcallhtc(context context)  {      /// defines callbacks service binding, passed bindservice()      serviceconnection mconnection = new serviceconnection() {          @override         public void onserviceconnected(componentname classname, ibinder service) {             // we've bound localservice, cast ibinder , localservice instance             log.d(tag,"binding htc service");             mservice = (phonecalluiservice) service;             mbound = true;         }          @override         public void onservicedisconnected(componentname arg0) {             mbound = false;             log.d(tag,"disconnected htc service");         }     };       intent intent = new intent(context, phonecalluiservice.class);     context.bindservice(intent, mconnection,  context.mode_private);     if(mbound) {         log.d(tag,"before htc call");         mservice.performaction(phonecalluiservice.action_answer_call, 1, new bundle());         log.d(tag,"after htc call");      }     else          log.d(tag,"the htc service not bounded");       }  } 

///////////////////////////////////////////////////////////////////////////////////////////////

it eat mind. please help.

tnx.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

c++ - Clear the memory after returning a vector in a function -

erlang - Saving a digraph to mnesia is hindered because of its side-effects -