Back to project page whoisit-android.
The source code is released under:
MIT License
If you think the Android project whoisit-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.mitchbarry.android.whoisit.core; /*from w w w . j a va2s . co m*/ import android.content.Context; import android.content.Intent; import android.support.v4.content.WakefulBroadcastReceiver; import android.telephony.TelephonyManager; import static android.telephony.PhoneStateListener.LISTEN_CALL_STATE; /** * Created by Mitchell on 12/9/13. */ public class PhoneCallReceiver extends WakefulBroadcastReceiver { static PhoneCallListener phoneListener; @Override public void onReceive(Context context, Intent intent) { if (phoneListener == null) { phoneListener = PhoneCallListener.getPhoneCallListener(context); TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); telephony.listen(phoneListener, LISTEN_CALL_STATE); } } }