'webview whitelist urls possibly from external file

We have locked down tablets deployed that are going to be using a webview based app that will allow our users to interact with our web app, website, and a few other whitelisted URL's like social media pages.

I know I can easily accept a single URL and reject all others with something like this:

 public class MyWebViewClient extends WebViewClient {
    public boolean shouldOverrideUrlLoading (WebView view, String url) {
        if (Uri.parse(url).getHost().equals("http://Your_website_url")) {
             // This is my web site, so do not override; let my WebView load the page
             return false;
        }

        // reject anything other
        return true;
    }
}


mWebview.setWebViewClient(new MyWebViewClient());  //set the webviewClient

I could possibly adapt this to allow for multiple URL's but it seems somewhat messy and cumbersome. Ideally, I think an external XML file that can be updated without the app needing to be redeployed to all devices may be the way to go, I am a little unsure how to make that happen though and no one seems to have done this before that I can find.

I am fairly new to this so any help would be greatly appreciated.



Solution 1:[1]

Have your tablets reach back to a server for updated permission lists. You can look at Spring Cloud Config Server as a real-world example.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 David Medinets