Hi everbody,
I read (downloaded and tried) almost the entire b4a site looking for a really working example for phoneevents with dual sim calling
This is the code used to call
B4X:
'sim = 0 SIM1, = 1 SIM2
Sub Call_SIM(num As String, sim As Int)
Dim i As Intent
i.Initialize(i.ACTION_CALL, "tel:" & num)
i.putExtra("simSlot", sim)
i.putExtra("com.android.phone.force.slot", True)
i.putExtra("Cdma_Supp", True)
i.putExtra("com.android.phone.extra.slot", sim)
StartActivity(i)
End Sub
The problem with dual sims feature is that it wasn't officially supported in older versions of Android, so you will not find a simple and reliable way to use this feature.
Where does this intent come from? If you want to convert a Java intent to B4A then post the Java code and we will help you port it.
Ok... if so I can change to a single sim
Is there somewhere a working example?
I need to call sequentially about five numbers (conference call) and re-call several time if one of them is busy
This will be complicated. The best you can do is to monitor the PhoneStateChanged event with PhoneEvents. Not all the information you need is available.
@Marco Gioia,
Android does not allow to detect that the call is answered. Answer machine is impossible.
You can only make call, and kill it.
B4X:
Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
Main.PhoneState = State
'Log("State=" & State)
'Log(Intent.ExtrasToString)
If State = "RINGING" AND IncomingNumber<>"" Then 'incoming call
Main.LastInNumber = IncomingNumber
PhoneFlag = 1
'Log("Incoming detected " & DateTime.Time(DateTime.Now))
DoEvents
'ToastMessageShow("Calling " & IncomingNumber, True)
Return
End If
If State = "OFFHOOK" AND IncomingNumber="" AND PhoneFlag = 1 Then 'answering to incoming call
PhoneFlag = 2
Return
End If
If State = "OFFHOOK" AND IncomingNumber="" AND PhoneFlag = 0 Then 'outgoing call
Main.LastInNumber = IncomingNumber
PhoneFlag = 4
WaitingTimer.Enabled = True
Log("PhoneFlag = 4, out call")
'AR.Start
Return
End If
If State = "IDLE" AND Main.LastInNumber <> "" AND PhoneFlag = 2 Then 'just income call finished
PhoneFlag = 3
Return
End If
If State = "IDLE" AND Main.LastInNumber <> "" AND PhoneFlag = 1 Then 'just rejected income call
PhoneFlag = 0
Return
End If
If State = "IDLE" AND PhoneFlag = 4 Then 'just finished outgoing call
PhoneFlag = 5
Return
End If
'Log("PhoneStateChanged, State = " & State & ", IncomingNumber = " & IncomingNumber & "; PhoneFlag = " & PhoneFlag)
End Sub
I haven't tried the app but I believe it is possible the app is probably using some kind of third-party services which provides this kind of services accessible through rest-api.
Also, it is not unheard of device manufacturers, such as Samsung and others, that opens "backdoors" against a fee. Read that TeamViewer had made a deal which let their software remotely control Samsung android devices.