How can you set the http proxy programmatically?

后端 未结 6 1940
暗喜
暗喜 2020-12-06 05:30

I\'m looking for a programmatic way to set-up http proxy settings for android handsets. I\'ve tried using android.provider.Settings.System.putString() to set System.HTTP_PR

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-06 06:08

    It's not possible to do this as a 3rd-party app. You get this message:

    12-07 12:39:37.736: W/PackageManager(85): Not granting permission android.permission.WRITE_SECURE_SETTINGS to package com.mgranja.xxxxxxx (protectionLevel=3 flags=0xbe46)
    

    Only apps that are signed with the same key as system apps can get this permission (i.e.: if you cook your own rom, you could add that funcionality)

    More info about permission levels on this question, specially adamk's answer.

    Why are these permissions being refused?

提交回复
热议问题