1.Add this in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}2.Add permissions in your manifest file:
<permission android:name="android.permission.INTERNET" /> 3.Add these dependencies in your module app build.gradle:
dependencies {
implementation 'com.github.anmol2805:CanopySDK:0.2.0'
}canopyAuthCallback = object : CanopyAuthCallback {
override fun onLoginSuccess(loginresponse: Boolean?) {
if (loginresponse!!){
System.out.println("loginstatus true")
}
}
override fun onLoginFailure(loginerror: String?) {
System.out.println(loginerror)
}
}
val canopyLogin = CanopyLogin(canopyAuthCallback, this)
canopyLogin.generate_token(student_id,hibiscus_password,"http://14.139.198.171:8080/token/generate-token")1.Create a new xml file in your app->res->xml->network_security_config.xml
Add this following code:
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">14.139.198.171</domain>
</domain-config>
</network-security-config> 2.Now in your manifest file add this line:
<application>
...
android:networkSecurityConfig="@xml/network_security_config"
</application>