如何检测在android系统掉话 [英] How to detect a call Drop in android

查看:212
本文介绍了如何检测在android系统掉话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写的电话交谈中对后台运行,并记录坐标到一个文件中有谈话结束后,我知道的Andr​​oid电话API可以检测到一个呼叫手动断开用户*一个应用程序(纠正我,如果我'错了)*,

I'm writing an app that runs on background during a telephone conversation and logs the coordinates to a file after the conversation has end,I know Android telephony API can detect a call manual disconnect by user*(correct me,if I'm wrong)*,

但我要的是知道服务断线是否因导致调用下降,有一个方法或API我可以用它来实现这一目标,

But what I want is to know whether the service disconnection have caused due to call drop,is there a way or an API I can use to achieve this,

所有我需要的是通过编程区分断开连接的呼叫和掉话。

All what I need is to programmatically differentiate a disconnected call and a dropped call.

请帮助..

推荐答案

试试这个code,但我不知道..

Try this code, but I am not sure..

private getCallFailedString(Call call) { 

    Phone phone = PhoneApp.getInstance().phone; 
    Connection c = call.getEarliestConnection(); 

    Connection.DisconnectCause cause = c.getDisconnectCause(); 

    switch (cause) { 
        case BUSY: 
        break; 

    case CONGESTION: 
         break; 

    case LOST_SIGNAL: 
         break; 

    case LIMIT_EXCEEDED: 
         break; 

    case POWER_OFF: 
         break; 

    case SIM_ERROR: 
         break; 

    case OUT_OF_SERVICE: 
         break; 

    default: 
         break; 

    } 

} 

这篇关于如何检测在android系统掉话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆