AnchorFreePartner / hydrasdk-demo-android

Hydra VPN SDK demo app for Android
https://developer.anchorfree.com/
60 stars 31 forks source link

Couldn't connect after initializing SDK with premium carrierID #134

Open abrusdev opened 3 years ago

abrusdev commented 3 years ago

Good day.

val id = if (isSub)
            BuildConfig.PREM_CARRIER_ID
        else
            BuildConfig.BASE_CARRIER_ID

log("rem id $id")

initSdk(id)
initHydraSdk()
if (isLogin())
    logOut()

loginToVpn()

Everything working fine until user buy the subscription and after payment, I am initializing SDK again, but it is giving an exception - Canceled VPN stop

Another interesting point is when I initializing with premium carrierID in debug mode, everything working fine, but after releasing app it is not possible to connect VPN with premium carrierID, only limited carrierID works.

timoshenkoav commented 3 years ago

1) what is the reason to have different carrier for premium user? 2) You can initialize 2 instances of sdk with UnifiedSDK.getInstance(name), with different carriers 3) You have canceled VPN stop in what call? 4) are you stopping vpn before reinitialization? 5) please share logs (adb logcat without any filter)

abrusdev commented 3 years ago
  1. because origin carrier ID gives 50 daily limit, premiumCarrierID gives unlimited connection
  2. Even I have tried to clear instances with UnifiedSdk.clearInstances() before initializing second carrier ID
  3. While connecting to VPN.
  4. No
timoshenkoav commented 3 years ago

1) what carrier gives you unlimited connection? 2) You should do this when in idle state - so stop VPN before reinitialising the sdk

abrusdev commented 3 years ago
  1. yes with another carrier ID, there wouldn't have daily limit ( 50mb )
  2. After user bought subscribtion, I have disconnecting,stoping and logOut from SDK, then reInitialize SDK with new carrier ID, but second time it is not connecting...
abrusdev commented 3 years ago

image I have determined that, your SDK initializing our carrierID, but this carrier ID must work without any limit, namely RemainingTraffic.isUnlimited must response us true, but it is not responsing.

instead it is calculating remaining traffic (onTrafficUpdate) image

abrusdev commented 3 years ago

Another interesting aspect is that, in debug mode, everything works fine, only in release it is causing such problems

timoshenkoav commented 3 years ago

Traffic is calculating and updating locally - its not related to traffic limits or carrier - its just local information. Some time ago we've updated carriers to have daily limit - to have unlimited users you have to integrate subscription reporting with API and dashboard. Maybe in release builds your code is "optimized" in any wrong case

abrusdev commented 3 years ago

Is that possible? What if working at DEBUG doesn’t work at RELEASE?

timoshenkoav commented 3 years ago

can you create simple app that reproduces your issue and share with me? or change this demo app to reproduce the issue?