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

1

1

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.

Boggess answered 10/2, 2012 at 1:57 Comment(0)
B
3

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

Boggess answered 16/2, 2012 at 22:19 Comment(1)
For those curious, I answered @quiel here: #9902725Boggess

© 2022 - 2024 — McMap. All rights reserved.