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:
- makes phone call;
- waits until call answered;
- 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, methodsregisterforprecisecallstatechanged(e.g., this one): not work, no phones registered within it, events not fire. - use
com.android.internal.telephony.phonefactoryobtaincom.android.internal.telephony.phoneinstance (which key everything): not work, factory not initialized; attempts initializemakedefaultphonescall 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
Post a Comment