Android Question Need help for ussd code

jahswant

Well-Known Member
Licensed User
Let me share this code. Request permissions to make calls.
SSCODE:
Sub CallUSSD(Command As String,Operator As Int)
    Dim i As Intent
    i.Initialize(i.ACTION_CALL, "tel:" & Command.Replace("#", "%23"))
    i.PutExtra("com.android.phone.extra.slot", Operator)
    i.Flags = 268435456
    StartActivity(i)
End Sub


Sub btcontinuarsending_Click
    If spnType.SelectedIndex = 0 Then
        OrangeURI = "*800*1#"
        If spnSimNumber.SelectedIndex = 0 Then
            CallUSSD(OrangeURI ,0)
        Else if spnSimNumber.SelectedIndex = 1 Then
            CallUSSD(OrangeURI ,1)
        End If
    Else if spnType.SelectedIndex = 1 Then
        MtnURI = "*436*4#"
        If spnSimNumber.SelectedIndex = 0 Then
            CallUSSD(MtnURI ,0)
        Else if spnSimNumber.SelectedIndex = 1 Then
            CallUSSD(MtnURI ,1)
        End If
    End If
End Sub
 

User.aaaa

New Member
Thank you jahswant
But the code doesn't work.
I guess anyway, this code won't work just by pressing the button.

I want Code that executes the USSD command, and I want to treat the result of executing this query as text

I also want to specify in the code whether to execute this query on sim1 or sim2

And I don't want to use the intent appears to the user
 

jahswant

Well-Known Member
Licensed User
I want Code that executes the USSD command,
This the code to make a USSD CALL.
B4X:
Sub CallUSSD(Command As String,Operator As Int)
    Dim i As Intent
    i.Initialize(i.ACTION_CALL, "tel:" & Command.Replace("#", "%23"))
    i.PutExtra("com.android.phone.extra.slot", Operator)
    i.Flags = 268435456
    StartActivity(i)
End Sub
, and I want to treat the result of executing this query as text
You cannot get or manipulate USSD results from experience.
I also want to specify in the code whether to execute this query on sim1 or sim2
Check the second parameter of CallUSSD its the sim. i.PutExtra("com.android.phone.extra.slot", Operator) specifies the slot. Use 0 or 1

And I don't want to use the intent appears to the user
This code will not hemp you.
 
Last edited:

User.aaaa

New Member
Is there any way to read the USSD result inside my program
I want to make a program whose basis is to analyze the results of USSD
Is it reasonable that I can't do that.
 
Top