Detecting outgoing call answered on Android -


i know has been asked many times already, no answers, still hope has solved problem.

the problem: have non-rooted device running android 2.3. need create service which:

  1. makes phone call;
  2. waits until call answered;
  3. hangs phone after call answered (with timeout);

like many others, i've got stuck #2. below summary of solutions ever suggested:

  • use phonestatelistener (most popular): not work, outgoing call cannot detect need.
  • use com.android.internal.telephony.callmanager , methods registerforprecisecallstatechanged (e.g., this one): not work, no phones registered within it, events not fire.
  • use com.android.internal.telephony.phonefactory obtain com.android.internal.telephony.phone instance (which key everything): not work, factory not initialized; attempts initialize makedefaultphones call result in security exception (like here).
  • detect outgoing ringtone (link): author - dany poplawec - states detecting ringtones may solve problem, not provide details, not able try technique.

it looks has been tried already, there still may 1 more trick save me :)

i'm trying , can't find solution yet.

looking on android source code found these lines in ~/kitchen/jellybean/frameworks/opt/telephony/src/java/com/android/internal/telephony/call.java

public enum state {     idle, active, holding, dialing, alerting, incoming, waiting, disconnected, disconnecting;      public boolean isalive() {         return !(this == idle || == disconnected || == disconnecting);     }      public boolean isringing() {         return == incoming || == waiting;     }      public boolean isdialing() {         return == dialing || == alerting;     } } 

i think 1 know if outgoing call answered checking active state, don't know how read value app, maybe modifying framework adding specific function like:

    public boolean isactive() {          return == active;     } 

this idea, i'm not sure how implement this, because other modifications have done accessing new function application layer.

if find viable or know how it, , feedback appreciated.


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -