It seems to be phone specific problem, as a lot of vendor implement dual SIM differently. It is usually quite difficult to make it works properly if it deviates too much from the standard. Mine (LP 5.1) doesn't trigger when SIM selection pop up. Only after SIM is selected, the flow will be triggered. You need to tell us your phone model and android version.
The workaround is to use Control UI after the trigger, to loop wait before the Call UI appear. Use the Overlay Control, make a call. When choosing the SIM, tap on the "Info" and see if there is any unique element that only appear in this SIM selection. Usually it is the SIM 1 and SIM 2 element. Tap and choose the value = existElementById() to copy it to clipboard (so you can paste the Id later). After the SIM was selected, find another unique element that only appear after call is made (most likely end button call). Use that element as the identifier. So we have 2 identifier, 1 for SIM selection and another for after SIM selection
Example at my phone, SIM selection identified as
"com.android.contacts:id/detail_card1_view" (for SIM1, or can use SIM2 as well; just need one of them), and the end call button identified from the overlay control as
"com.android.dialer:id/floating_end_call_action_button" So I will loop the sleep timer after the flow is triggered, as long as the SIM selection exists. After it no longer exists, I will check for the End call button. Control UI :
Code: Select all
while(existsElementById("com.android.contacts:id/detail_card1_view"))
sleep(200); //sleep as long as the SIM selection opened
sleep(100);
call = false;
if(existsElementById(com.android.dialer:id/floating_end_call_action_button)
call = true; //if end call button detected, call is in progress.
After this Control UI, put condition expression to check the call value.
Just that, since we have set the value to either true or false. If true, call is in progress, continue to your main flow. If false (end call button is not detected), then do nothing. Maybe during the SIM selection, you change your mind and press back button. So the End call button won't be detected, the flow still got triggered, but won't continue to the main flow because of this expression. That End button call button can't be checked using expression, as function existsElementById() only works in Control UI script. That's why we have to set the result to another variable, the {call}.
So your flow from
Trigger >> Main flow
changed to
Trigger >> Control UI >> Expression >> (True) Main flow
This is a very spesific workaround for certain phone. The element Id is probably different on each phone. You gotta find it out by yourself using the overlay control from Control UI. The same Script won't work at mine, as the Outgoing offhook at my phone, only triggered after the SIM selection is done.
PS: Control UI need Accessibility service to be turned on. Make sure you have enable it for Automagic.