PhoneStatusListener

This commit is contained in:
Jens 2023-04-02 23:51:09 +02:00
parent 81a6c68f73
commit af8b1fded8

View File

@ -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;