How to change the default Android browser's homepage within an app?

后端 未结 6 1126
刺人心
刺人心 2020-12-11 10:07

Within my app, is it possible to programatically change the Android browser\'s homepage url? If so, how can I accomplish this?

For example, if you run this popular

6条回答
  •  悲&欢浪女
    2020-12-11 10:22

    I authored the app called My Home Page (https://play.google.com/store/apps/details?id=com.aac.myhomepage) where I needed to accomplish this exact task. I looked everywhere possible and couldn't find a method of doing this so I ended up using two workarounds which really aren't great options in my opinion.

    1) I offer a root option for those who have rooted devices where I simply access the SharedPreferences XML file of the browser and, using regular expressions, swap out the value of the home page with the one needed.

    2) Copy the URL to the clipboard and tell the user how to accomplish changing the default home page.

    Note that I did not use root access without the user's permission nor did I change the home page without the user's permission. This is the purpose of the app and the home page isn't changed without the user explicitly doing so.

    I recently noticed that the ad SDKs were doing this but something tells me that they aren't doing it in a proper manner and I don't have any interest i

提交回复
热议问题