Integrate oneconnect SDK for Android
OneConnect SDK Android Library
OneConnect SDK is an Android library that provides easy access to OneConnect API, allowing you to retrieve server information for VPN services. You can use this library to fetch both free and premium servers for your VPN application.
Installation
To use this library, you should add jitpack repository.
Add this to root build.gradle
Add this in Androidmainfest.xml
To use OneConnect SDK in your Android project, add the following dependency to your app-level build.gradle file:
Usage
Here's how you can use OneConnectLib to fetch server information for your VPN application:
In the code snippet above:
Create a new thread to perform network operations asynchronously.
Initialize the OneConnect instance with your API key.
Use oneConnect.fetch(true) to retrieve free servers and oneConnect.fetch(false) to retrieve premium servers.
Connect VPN
Parameters:
this - The activity context
config - configuration file
countryName - Text to be displayed in the notification
userName - handle by SDK itself
passWord - handle by SDK itself
Disconnect VPN
Parsing JSON Response
Once you have fetched server information, you can parse the JSON response to obtain the server details. Here's an example of how to convert the JSON response into an ArrayList of Countries objects:
Make sure to replace Countries with the appropriate data model in your project.
Ready demo project
Here we have ready demo project , you can frog from GitHub and use
Usage
This SDK Project is Created By OneConnect Team.
This Project Content OneConnect Library
For Use, the SDK Required OneConnect API Key,
Visit on this Website https://developer.oneconnect.top and Create Account and get the Key.
Once You have the OneConnect API Key, Then You have Put inside SplashScreen.java
You will Get the Key inside API Tab https://developer.oneconnect.top/dashboard/api/ After that, You need to Put Your App Package Name Inside OneConnect API Tab.
You have to Put inside SplashScreen.java Please See Screenshot
# This Project Content AdMob & Facebook Ads those developers want to Add Another Ads SDK they need to follow the Exiting Method of Ads SDK and Also Have IAP Subscription.
And Need to Put Your Google-Services.JSON file inside Project, You will get from Firebase.
Note :- Any Developer, those who want to Use or Sell for end Client
they need to make the sufficient Changes in the Original Demo Project.
Just Smile after get the Project..... (^_^)
Last updated