Android Question Wher etu put the default SMS app check ?

Discussion in 'Android Questions' started by marcick, Mar 19, 2015.

  1. marcick

    marcick Well-Known Member Licensed 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.

    Dim context As JavaObject = Activity
    context = context.RunMethod(
    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

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

    end if
  2. Erel

    Erel Administrator Staff Member Licensed User

    You cannot hold the code execution while waiting for the result. Instead you should wait for Activity_Resume to be called after the user has hopefully returned to your app.
    Peter Simpson likes this.
  3. marcick

    marcick Well-Known Member Licensed User

    Thanks Erel.
    I moved that code in Activity_Resume instead of Activity_Create and now it works as expected.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice