Android Question Wher etu put the default SMS app check ?

marcick

Well-Known Member
Licensed User
Longtime User
Hi all,
I'm using this code to prompt the user to change the default SMS app, but after the related window pop-up, the code that follow is executed. I need instead the the app wait for the result and behave differently if the user click Yes or No. Hopo this is clear.
I'm trying to put this code in different places, Activity create, Activity resume, but I'm not able to hold my app to wait for the decision of the user.

B4X:
Dim context As JavaObject = Activity
context = context.RunMethod("getContext", Null)
Dim so As JavaObject
Dim package As String = so.InitializeStatic("android.provider.Telephony.Sms").RunMethod("getDefaultSmsPackage", Array As Object(context))
If package <> "it.mycompany.myapp" Then
   Dim i1 As Intent
    i1.Initialize("android.provider.Telephony.ACTION_CHANGE_DEFAULT", "")
    i1.PutExtra("package", "it.mycompany.myapp")
    StartActivity(i1)

'' I want my app wait here for the result of the above intent

end if
 

marcick

Well-Known Member
Licensed User
Longtime User
Thanks Erel.
I moved that code in Activity_Resume instead of Activity_Create and now it works as expected.
 
Upvote 0
Top