I’ve got the following to open up a browser from within an Android app.
String url = "http://www.example.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
How do you get the user back to the app after they have viewed the page?
Edit
I have android:noHistory="true" set in my manifest for the Activity calling the Intent.
If the calling Activity is in the
Backstack(as default) the user would press “back” to peal the top layer off the stack.However if the browser closes, the Activity does too, and the last Activity in the
Backstackcomes to the fore. If you own the site your going to and can put a “back” button in it (With javascriptwindow.close()or similar), the activity will close and your applications topmost activity in the stack will resume.If your Activity isn’t in the backstack then I would suggest instead of sending the user to the browser
Taskuse a customActivitycontaining aWebViewgiving you full control (such as manually starting the original Activity through an Intent)