How to set a whitelist in web view with Android Management API

删除回忆录丶 提交于 2020-07-23 01:57:19

问题


I am using Chrome Managed Configurations to set a whitelist with this code in my policy:

{
    "packageName": "com.android.chrome",
    "managedConfiguration": {
        'URLBlacklist': ['*'],
        'URLWhitelist': ['chrome://*', 'google.com', 'stackoverflow.com'],
        'ForceGoogleSafeSearch': True,
        'NTPContentSuggestionsEnabled': False,
    }
}

Now, in the Chrome enterprise docs it says there is a way to apply the same settings to Android Web view with the com.android.browser:URLBlacklist restriction, but it does not explain where I would put this in my policy.

The following code does not work:

{
    "packageName": "com.android.chrome",
    "managedConfiguration": {
        'com.android.browser:URLBlacklist': ['reddit.com', 'youtube.com'],
        'com.android.browser:URLWhitelist': ['stackoverflow.com', 'google.com']
    }
}

It shows an error in chrome://policy on the phone.

com.android.browser is not even a real app.

Where do I need to use this com.android.browser:URLBlacklist to apply restrictions to all web views on the phone?


回答1:


You have to set the blacklist/whitelist for each app individually.

For example:

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

This code blocks all domains within the JetBlue app besides for JetBlue.com

There are some things to be aware of: 1. Be careful not to block any domains the app needs to function (including login pages, etc.). 2. If an app uses a direct API to display content, not a web view, then these restrictions will not apply.



来源:https://stackoverflow.com/questions/58773799/how-to-set-a-whitelist-in-web-view-with-android-management-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!