我在这个主题上使用了B4A并转换了Java代码 Sending message automatically in Dual Sim 到B4a代码,但此代码只是在SimCard 1上发送短信以及何时使用Simcard 2 ID仍然通过Simcard 1发送
AnyOne可以知道这个问题吗?
此致
Sub Globals
Private txtpm As EditText
Private txtname As EditText
Dim sim_card As SimCard
Private Content_Resolver As ContentResolver
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("send_sms_layout")
sim_card.Initialize()
StartService(modSMS)
End Sub
Sub Btn_Sim2_Click
Dim msg As Map
Dim Content_Values As ContentValues
Dim Uri_ As Uri
Try
If sim_card.IsDualSIM = True Then
Content_Values.Initialize
Dim sim_id1 As String
Dim sim_id2 As String
Dim r As Int
sim_id1 = sim_card.GetSimSerialNumber1
sim_id2 = sim_card.GetSimSerialNumber2
Content_Values.PutString("value",sim_id2 )
Uri_.Parse("content://settings/system")
r = Content_Resolver.Update(Uri_,Content_Values,"name='sms_sim_setting'",Null)
End If
Catch
ToastMessageShow(LastException,True)
End Try
Try
msg.Initialize
msg.Put("message",txtpm.Text)
msg.Put("to",txtname.Text)
SendSMS(msg)
Catch
ToastMessageShow(LastException.Message,True)
End Try
End Sub