has New Call - Android android.telephony

Android examples for android.telephony:TelephonyManager

Description

has New Call

Demo Code


//package com.java2s;

import android.content.Context;

import android.telephony.TelephonyManager;

public class Main {
    public static boolean hasNewCall(Context context) {
        return getCallState(context) == TelephonyManager.CALL_STATE_RINGING;
    }//from   w w  w .  j a v  a  2 s  .  co  m

    public static int getCallState(Context context) {
        TelephonyManager tm = ((TelephonyManager) context
                .getSystemService(Context.TELEPHONY_SERVICE));
        return tm.getCallState();
    }
}

Related Tutorials