Android: delete history after loading the main page

Hey android noob needs help here.

I am trying to get a web browser browser to delete the browser history after loading the home page (so that the next user who comes around this public application does not see the previous session)

I made a webview client and put

public void onPageFinished(WebView webView, String Url ) {
     Browser.clearHistory();

but I don’t know how to change String Url to the URL of the main application page.

I also tried adding a second function to my homebutton onclicklistener, but no luck if someone wants to help, I can also insert this bit of code.

thank

+3
source share
3 answers

Here is how I did it:

@Override
public void onPageFinished(WebView view, String url) {
    junc.pg.setVisibility(View.INVISIBLE);
    if(url.indexOf("a_string_unique_to_your_homepage")!=-1) {
        view.clearHistory();
    }
}

URL-. , URL-

www.example.com

www.example.com?12345abc

12345abc. , .

+1

, Android.

.. > > > OK

0

What about?

Browser.clearHistory(getContentResolver());
Browser.clearSearches(getContentResolver());
0
source

Source: https://habr.com/ru/post/1789808/


All Articles