Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Web browser homepage

I have seen several apps and advertising networks like startapp changing the android web browser homepage by code. How is this possible?

I have taken a look at the startapp sdk but i have not managed to find the part where they change the homepage.

I have also taken a look at the BrowserSettings in com.android.browser.BrowserSettings

In BrowserSettings, there is a interface called setHomepage(Context, String).

public void setHomePage(Context context, String url) {
    Editor ed = PreferenceManager.
            getDefaultSharedPreferences(context).edit();
    ed.putString(PREF_HOMEPAGE, url);
    ed.commit();
    homeUrl = url;
}

I dont know a lot java/android, so correct me if i am wrong: The setHomepage() is not declared static so it can not be called from other activities. So i can not use this.

I cant see any Mode applied to the Shared Preferences so it means that it will by default take Private as is Mode and i cant edit the Shared Preferences or ?

Some people have said that it may would be possible to do with contentProvider/Resolver.

Link for BrowserSettings.java

Any help or thoughts would be appreciated:)

like image 829
Anonym.. Avatar asked Sep 10 '12 13:09

Anonym..


2 Answers

I'm with Diane HackBorn (Google's Android Engineer) on this one: this shouldn't be possible, as it would be a platform security flaw.

If it happens to be possible, would be through some sort of hack (i.e.: an App with root access that can write into the Browser app Settings file directly).

like image 109
tinsukE Avatar answered Nov 17 '22 04:11

tinsukE


I see that you mentioned startapp. I have looked through their decompiled SDK but i cant find anything about the "changing homepage part".

Also i know that they do this but i cant find it in the SDK. Maybe somebody with better understanding for android can take a look at it. I have a android phone with 2.2 without root access and they managed to change the homepage.

like image 21
AndDev Avatar answered Nov 17 '22 05:11

AndDev