truecaller / flutter-sdk

Flutter plugin that uses Truecaller's Android SDK to provide mobile number verification service to verify users.
https://pub.dev/packages/truecaller_sdk
MIT License
24 stars 43 forks source link

Not able to verify in release mode #16

Closed Amitpatil215 closed 3 years ago

Amitpatil215 commented 3 years ago

True caller SDK only working on my device in debugging mode with partner key generated using debug SHA1 key.

While I release application its not working.

error: Invalid_Partner_KEY

parth0907 commented 3 years ago

Hi Amit,

The app key which you generate from your Truecaller developer account, is tied to a particular combination of "package name" and "SHA1 key". You need to maintain different app keys for different build flavours for your app ( debug, release, playstore ).

The problem regarding the build you are facing is because you might be using the app key generated with debug SHA1 and not the release one. Once you generate another app key with the SHA1 corresponding to your release build. It should work as expected.

For further queries please feel free to reach us via our support channel https://developer.truecaller.com/support for a faster and dedicated response.

Regards, Parth

Amitpatil215 commented 3 years ago

Hey, Parth Thanks for the timely response. Will keep in mind above things while generating app key.

Amitpatil215 commented 3 years ago

Closing this issue as by changing app key which is registered using play store sha1 worked for me, Thanks!

bajajsahil commented 3 years ago

@Amitpatil215 You created another application in truecaller dashboard for release or updated the existing application? Because my doubt is for release and debug we have the same package name e.g. com.example.android.

Correct me if I am wrong.

Thanks in advance.

Amitpatil215 commented 3 years ago

Hi @bajajsahil you need to follow these steps in order to make true caller working for release

  1. Grab your package name e.g. com.example.android
  2. Grab SHA1 key from play console. (play store adds its own SHA1 key to application)
  3. Go to true caller developer dashboard, register your app using above details
  4. now get partner key from true caller developer dashboard
  5. replace it in your android\app\src\main\AndroidManifest.xml file
  6. now release your app to the play console, it only works with app released via play store

coming to your question package name remains same for debug, release, only you need to take care of SHA1 key for which mode you are building your application. just replace the partner key accordingly

bajajsahil commented 3 years ago

Thanks, @Amitpatil215 for the detailed explanation. I understand that. I just want to put some more light on what I am thinking. Actually, I am using flavors for different environments e.g. prod, qa, dev. And, for them I am using below configuration

flavorDimensions "myapp"

productFlavors {
    dev {
        dimension "myapp"
        applicationIdSuffix ".dev"
        versionNameSuffix "-dev"
        resValue "string", "app_name", "myappDev"
        resValue "string", "truecaller_key", "APP_KEY_HERE_FROM_TRUECALLER_DEV"
    }
    prod {
        dimension "myapp"
        resValue "string", "app_name", "myapp"
        resValue "string", "truecaller_key", "APP_KEY_HERE_FROM_TRUECALLER_PROD"
    }
}

If you see, I have 2 flavors and for both of them I have created 2 apps in truecaller developer console so got 2 different keys. Now, when I am building dev env it is picking the dev app key, and when I will build the prod env it will pick the prod app key.

My question is, can we do a similar type of confgurations for different build type like debug or release? So, in that case we don't have to change keys again and again.

cc @parth0907