aimango
aimango

Reputation: 1567

How to Avoid Loading Local Page in New Tab on Default Android Browser

I want to do the opposite of this: Android Browser: open several URLs, each on new window/tab (programmatically)

In there, the answer was to use b.putBoolean("new_window", true); but what is the equivalent for same tab or same window?

For some reason I'm only having this issue on tablets (tested on 3.1 and 4.0.3). We open URLs correctly on the same window or same tab on phones.

Please don't tell me to use a webview, what I'm trying to do is do things in the background while a user is browsing on the default Android browser.

Thanks.

Upvotes: 1

Views: 2196

Answers (1)

aimango
aimango

Reputation: 1567

Okay I found the fix. Basically, phones running 2.3 and lower use com.android.browser, with activity name com.android.browser.BrowserActivity. I believe in 3.0, ApplicationIDs were introduced.

Tablets still use the same Browser package name, but has an ApplicationID of com.android.browser, while ICS 4.0.2+ uses com.google.android.browser as the package name, and com.google.android.browser as the appId (same Activity name is used). So I just had to add that into my BrowserData.

After this, one must use the EXTRA_APPLICATION_ID flag on their browser intent to avoid the automatic opening of a new tab. More on that here: http://developer.android.com/reference/android/provider/Browser.html

Upvotes: 3

Related Questions