简体   繁体   English

适用于Android Studio应用的VPN连接

[英]VPN Connection for Android Studio Apps

I'm hoping to write an app in Android Studio which will require me to connect to a VPN. 我希望在Android Studio中编写一个应用程序,这将需要我连接到VPN。

I've read through the documentation on this, but I'm having trouble understanding some things about it, which the source code provided at the bottom of the article hasn't completely clarified to me. 我已经阅读了有关此文档的内容,但是在理解某些内容时遇到了麻烦,本文底部提供的源代码尚未完全阐明。

  • Will this VpnService mean that I don't need to develop a separate VPN app for my main app to use for a VPN connection? 这个VpnService意味着我不需要为自己的主应用程序开发单独的VPN应用程序以用于VPN连接?

  • When the app opens for the very first time, I'll need to present a page for the user to enter the VPN details (IP address etc.) However, after these settings have been saved, how do I then open the VPN connection on app startup? 首次打开应用程序时,我需要显示一个页面供用户输入VPN详细信息(IP地址等)。但是,在保存了这些设置之后,我该如何在以下位置打开VPN连接应用启动?

Answering your points. 回答你的观点。

  1. You don't need to develop a separate app for VPN. 您无需为VPN开发单独的应用。 You can use the vpn service class for creating vpn connections. 您可以使用vpn服务类来创建vpn连接。
  2. Just take the input from the user and pass them when configuring the vpn connection. 在配置VPN连接时,只需从用户那里输入并传递它们即可。 Save the values in shared preferences and load from it for the next time use. 将值保存在共享首选项中,并从中加载以供下次使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM