views:

449

answers:

1

Hello everbody,

I've been trying to find out how to create an intent that will open the user's preferred browser without specifying the URL. I know how to open it by giving a specific URL like this:

Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(android.net.Uri.parse("http://www.google.com"));
context.startActivity(intent);

I don't want to open the browser to any page in particular, just the set homepage or whatever page the user was on last. I've thought about looking up the homepage set within the app but you can't do it with the default Browser app because it is private. Does anybody know of a way to do this?

+1  A: 

The homepage URL specified by the user will be stored in the preferences for whichever browser app they're using. With Androids 'sandbox' model for apps, you'll have no access to this unless the app has a Content Provider which allows access. In addition, the content provider will differ between the browser apps and you'll have a hard time covering the ones that do exist.

Have you tried opening to a web page which attempts to update the users homepage URL through the use of JavaScript?

Matty F
No, I haven't tried this approach as I was mainly thinking about the use of intents. I'm not much of a web developer, but I'll have a look at it though! Are there any useful javascript API's that can go to the homepage?
developer_7
I have looked for a way to retrieve a browser's homepage and for a way to go to a browser's homepage using javascript but haven't had any luck. I don't think it is possible to do this. Someone care to prove me wrong.
developer_7