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:)