Android Question delay in handle outgoing call

omidaghakhani1368

Well-Known Member
Licensed User
Longtime User
Hi.
I have service for handle outgoing call.
I register receiver and can handle call but not first.
I log outcoming call number but i must be dial atleast one time and next log number
How detect number first dial?

B4X:
Dim broadcast As BroadCastReceiver
broadcast.Initialize("BroadcastReceiver")
    broadcast.addAction("android.intent.action.NEW_OUTGOING_CALL")
    broadcast.SetPriority(9147483647)
    broadcast.registerReceiver("")

Sub BroadcastReceiver_OnReceive (Action As String,i As Object)
Try
    Dim i2 As Intent
    i2 = i 
    Dim X As String : X = i2.ExtrasToString
    Dim Z As String : Z = X.IndexOf("NUMBER=")
    Dim y As String
    y = X.SubString2(Z+7,Z+24)
    y= y.replace(" ","")
    y= y.replace(",","")
    y= y.replace("a","")
    y= y.replace("n","")
    y= y.replace("d","")
    y= y.replace("r","")
    y= y.replace("o","")
    y= y.replace("i","")
    y= y.replace("d","")
    y= y.replace(".","")
    y = y.replace("+98","")
    log(y)
Catch
    Log(LastException.Message)
End Try
 

omidaghakhani1368

Well-Known Member
Licensed User
Longtime User
Do you mean that the you want to intercept the intent quicker? It is not possible.
Thank you Erel,I solve problem.
I use ExitApplication in my project and when ExitApplication then service receiver unregister and not detect number first.
But cannot kill call.is there any way to kill call?
Is there a way to kill ussd code?
 
Upvote 0

Cemil TANIK

New Member
Licensed User
I am very new to b4a and I Also Need to handle the outgoing call number. I succeed for incoming call that uses PE_PhoneStateChanged.
I Tried to above code to get "outgoing call number" but BroadcastReceiver_OnReceive sub is not firing. please help me
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…