Bhoomika Patel
Bhoomika Patel

Reputation: 1925

Fetch last call log details after Call end using Broadcast Receiver

I want to fetch last call details after call end via broadcast receiver. How i can fetch it? I have tried with receiver, but call state is IDEL when i receive call. I want to fetch call detailes after call end or disconnect.

Upvotes: 4

Views: 356

Answers (1)

imjaydeep
imjaydeep

Reputation: 978

public class PhoneStateBroadcastReceiver extends BroadcastReceiver{

    @Override
    public void onReceive(Context context, Intent intent) {
        //UDF.createTablesIfNotExists(context);
        TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        telephonyManager.listen(new CustomPhoneStateListener(context), PhoneStateListener.LISTEN_CALL_STATE);
    }
}

Upvotes: 2

Related Questions