Category : phone-state-listener

i am trying to detect incoming calls by using this broadcast <receiver android:name=".IncomingCallReceiver" android:enabled="true" android:exported="true"> <intent-filter android:priority="2147483647"> <action android:name="android.intent.action.PHONE_STATE" /> </intent-filter > <intent-filter android:priority="2147483647"> <action android:name="android.intent.action.NEW_OUTGOING_CALL" /> </intent-filter> </receiver> and this is java code public void onReceive(Context context, Intent intent) { if (intent.getAction().equals("android.intent.action.NEW_OUTGOING_CALL")) { // savedNumber = intent.getExtras().getString("android.intent.extra.PHONE_NUMBER"); } else{ String stateStr = intent.getExtras().getString(TelephonyManager.EXTRA_STATE); String ..

Read more

public static String getUniqueIMEIId(Context context) { try { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); AppData.imei = telephonyManager.getDeviceId(); Log.e("imei", "=" + AppData.imei); if (AppData.imei != null && !AppData.imei.isEmpty()) { return AppData.imei; } else { return android.os.Build.SERIAL; } } catch (Exception e) { e.printStackTrace(); } return "not_found"; }`enter code here` Source: Android Studio..

Read more