anOparator Active Member Licensed User Longtime User Aug 9, 2023 #1 In 2016 it was not allowed to automatically CLOSE the "android.settings.WIFI_SETTINGS" activity. Close Android Intent I am using the following to load "android.settings.WIFI_SETTINGS". Sub imgWiFiAvail_Click Dim i As Intent i.Initialize("android.settings.WIFI_SETTINGS", "") StartActivity(i) End Sub In my "Starter" service, I do monitor the Connectivity Changed and write this to a variable... www.b4x.com In my app I select a poem, start an SMS intent, edit the poem and Send, ending up in Messenger. Is there a way to Return to my app OR programmatically close the SMS activity? Code: Copy Sub txnd_Click Dim itxt As Intent itxt.Initialize(itxt.ACTION_VIEW, "sms:") itxt.PutExtra("sms_body", story.Text) StartActivity(itxt) Activity.Finish Log("after Finish") ' Messenger stays in foreground Activity.RemoveAllViews Log("after RemoveAllViews") ' Messenger stays in foreground ' Activity.GetStartingIntent ' Return End Sub
In 2016 it was not allowed to automatically CLOSE the "android.settings.WIFI_SETTINGS" activity. Close Android Intent I am using the following to load "android.settings.WIFI_SETTINGS". Sub imgWiFiAvail_Click Dim i As Intent i.Initialize("android.settings.WIFI_SETTINGS", "") StartActivity(i) End Sub In my "Starter" service, I do monitor the Connectivity Changed and write this to a variable... www.b4x.com In my app I select a poem, start an SMS intent, edit the poem and Send, ending up in Messenger. Is there a way to Return to my app OR programmatically close the SMS activity? Code: Copy Sub txnd_Click Dim itxt As Intent itxt.Initialize(itxt.ACTION_VIEW, "sms:") itxt.PutExtra("sms_body", story.Text) StartActivity(itxt) Activity.Finish Log("after Finish") ' Messenger stays in foreground Activity.RemoveAllViews Log("after RemoveAllViews") ' Messenger stays in foreground ' Activity.GetStartingIntent ' Return End Sub
anOparator Active Member Licensed User Longtime User Aug 12, 2023 #2 Ok so I've just learned that Activity.Finish and ExitApplication written within the Intent that called it won't close the SMS Intent. I also gave up testing 'Close Intent' via Resumable Subs. I've always wanted to send a SMS from an app and be returned to the app after "message sent" occurs and I still welcome code snippets, ideas, or even a definitive 'can't be done'. ThanksInAdvance Upvote 0
Ok so I've just learned that Activity.Finish and ExitApplication written within the Intent that called it won't close the SMS Intent. I also gave up testing 'Close Intent' via Resumable Subs. I've always wanted to send a SMS from an app and be returned to the app after "message sent" occurs and I still welcome code snippets, ideas, or even a definitive 'can't be done'. ThanksInAdvance
drgottjr Expert Licensed User Longtime User Aug 13, 2023 #3 the activity that you start via an intent can return something to you (StartActivityForResult). it's easy enough if the activity you start is yours. with 3rd party apps, it only works if that app has been written to return something. many - if not most - are not. in the case of sending an sms, there is an additional issue: if you are not publishing on play, it would not be difficult to add the necessary code to your sms sender. if your idea is to publish the app, then you will have a problem because google will not usually allow you to override the system sms app. another possibility: the app started by your intent could restart your app with an intent of its own. your original activity (the caller) can check to see if it's being started by the system or by another activity and act accordingly. in some ways this could be an interesting option. but, in the end, the real issue boils down to which app sends the sms. if it's yours, no problem. if it's the pre-installed app, then you need to know if it exposes setResult() or if it can use an intent to start another activity (ie, yours). or you'll have to convince google to allow you to override the default app. Upvote 0
the activity that you start via an intent can return something to you (StartActivityForResult). it's easy enough if the activity you start is yours. with 3rd party apps, it only works if that app has been written to return something. many - if not most - are not. in the case of sending an sms, there is an additional issue: if you are not publishing on play, it would not be difficult to add the necessary code to your sms sender. if your idea is to publish the app, then you will have a problem because google will not usually allow you to override the system sms app. another possibility: the app started by your intent could restart your app with an intent of its own. your original activity (the caller) can check to see if it's being started by the system or by another activity and act accordingly. in some ways this could be an interesting option. but, in the end, the real issue boils down to which app sends the sms. if it's yours, no problem. if it's the pre-installed app, then you need to know if it exposes setResult() or if it can use an intent to start another activity (ie, yours). or you'll have to convince google to allow you to override the default app.
anOparator Active Member Licensed User Longtime User Aug 14, 2023 #4 Great overview thanks. Ok so a good animation on the page where user selects send SMS or TextMssg asking user to "press Back button to return to my app" solves everything. also I just found this from 2018 : Google has changed their policy regarding the following permissions: Code: Copy READ_SMS, SEND_SMS, WRITE_SMS, RECEIVE_SMS READ_CALL_LOG, WRITE_CALL_LOG, PROCESS_OUTGOING_CALLS Only the default phone or messaging apps can use these permissions: Upvote 0
Great overview thanks. Ok so a good animation on the page where user selects send SMS or TextMssg asking user to "press Back button to return to my app" solves everything. also I just found this from 2018 : Google has changed their policy regarding the following permissions: Code: Copy READ_SMS, SEND_SMS, WRITE_SMS, RECEIVE_SMS READ_CALL_LOG, WRITE_CALL_LOG, PROCESS_OUTGOING_CALLS Only the default phone or messaging apps can use these permissions: