2

I have an Android app that has a WebView that embeds through iframe a website. The problem is that the specific website requires a domain to be whitelisted.

Is it possible to provide a domain for the app to be recognized by the website? I know that when creating an Android app you set a domain that is being used to generate the package name, but providing the package doesn't help.

Philipos D.
  • 2,036
  • 1
  • 26
  • 33

1 Answers1

3

A domain to be whitelisted

By default, Android devices don't restrict web requests made from an app. If the domain is restricted for some reason, there's probably another reason for that.

However, that doesn't answer the question :). To whitelist a domain, I can imagine two paths forward. Option one is pretty crude but effective: just put it in the Manifest.

{
    "packageName": "com.jetblue.JetBlueAndroid",
    "managedConfiguration": {
        'com.android.browser:URLBlacklist': ['*'],
        'com.android.browser:URLWhitelist': ['jetblue.com']
    }
}

Check out this answer for that example and a little more about this method of whitelisting.

Another option for some serious domain control is an Android Proxy Controller. From the Android docs

ProxyConfig proxyConfig = new ProxyConfig.Builder()
                                         .addProxyRule("myproxy.com")
                                         .addBypassRule("www.excluded.*")
                                         .build();
Executor executor = ...
Runnable listener = ...
ProxyController.getInstance().setProxyOverride(proxyConfig, executor, listener);
...
ProxyController.getInstance().clearProxyOverride(executor, listener);

Carson
  • 2,700
  • 11
  • 24