1

我使用 B4A 并在此主题上转换 Java 代码 在 Dual Sim 中自动发送消息 到 B4a 代码但此代码仅在 SimCard 1 上发送 SMS 并且当使用 Simcard 2 时 ID 仍由 Simcard 1 发送

任何人都可以知道这个问题吗?

问候


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
4

0 回答 0