要使用 API,您首先需要调用:
/** This permission framework is used to avoid confused deputy style attack to the VPN
* calling this will give null if the app is allowed to use the external API and an Intent
* that can be launched to request permissions otherwise */
Intent prepare (String packagename);
你需要在你的清单中有:
<!-- Copy the <permission> block to your app when using the REMOTE API. Otherwise OpenVPN for
Android needs to be installed first -->
<permission
android:name="de.blinkt.openvpn.REMOTE_API"
android:description="@string/permission_description"
android:label="Control OpenVPN"
android:permissionGroup="android.permission-group.NETWORK"
android:protectionLevel="dangerous" />
<uses-permission android:name="de.blinkt.openvpn.REMOTE_API">
请注意该权限之前的评论...