diff --git a/app/src/main/java/com/jens/automation2/receivers/PhoneStatusListener.java b/app/src/main/java/com/jens/automation2/receivers/PhoneStatusListener.java index 41d816b..0790b75 100644 --- a/app/src/main/java/com/jens/automation2/receivers/PhoneStatusListener.java +++ b/app/src/main/java/com/jens/automation2/receivers/PhoneStatusListener.java @@ -160,6 +160,41 @@ public class PhoneStatusListener implements AutomationListenerInterface, Executo } } + public static class IncomingCallsReceiverNew() + { + void start() + { + TelephonyManager telephonyManager = (TelephonyManager) AutomationService.getInstance().getSystemService(Context.TELEPHONY_SERVICE); + + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) + { + Executor executor = new Executor() + { + @Override + public void execute(Runnable runnable) + { + + } + }; + + TelephonyCallback callback = new TelephonyCallback(); + + telephonyManager.registerTelephonyCallback(context.mainExecutor, new TelephonyCallback()); + object : TelephonyCallback(), TelephonyCallback.CallStateListener { + override fun onCallStateChanged(state: Int) { + } + }) + } + else + { + telephonyManager.listen(object : PhoneStateListener() { + override fun onCallStateChanged(state: Int, phoneNumber: String?) { + } + }, PhoneStateListener.LISTEN_CALL_STATE) + } + } + } + static void setLastPhoneDirection(int i) { lastPhoneDirection = i;