1.0.3 • Published 3 years ago

cordova-plugin-truecaller v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

title: Truecaller Authentication

description: Authenticate users with Truecaller.

cordova-plugin-truecaller

Supported Platforms

  • Android

Generate Fingerprint/SHA1 On Linux

keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android

On Windows

keytool -list -v -keystore "c:\users\your_user_name\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android 

You can get the fingerprint/SHA1 from the command output

Generate partnerkey

  • Visit https://developer.truecaller.com/, create an account and login.
  • Navigate to your dashboard and add application.
  • Add your app name, package name and your fingerprint to add the application.
  • Copy the generated App Key, which is the partner key.

Installation

cordova plugin add cordova-plugin-truecaller --variable PARTNER_KEY='<Your truecaller partnerkey>'

Alternatively, you can also install from git url

cordova plugin add https://github.com/Deepaksai1919/cordova-truecaller.git --variable PARTNER_KEY='<Your truecaller partnerkey>'

truecaller

truecaller.check(successCallback, errorCallback)

Can be used to find if the user has truecaller application installed on their device.

truecaller.verify(options, successCallback, errorCallback)

Displays the truecaller dialog to authenticate the user.

Example

var options = {
  consentMode: 'Bottomsheet',
  loginTextPrefix: 'To continue',
  loginTextSuffix: 'Please verify mobile no',
  ctaTextPrefix: 'Use',
  buttonShape: 'Rounded',
  footerType: 'Later',
  consentTitle: 'Verify',
  sdkOptions: 'With otp',
};
cordova.plugins.truecaller.check(
    function (success) {
      cordova.plugins.truecaller.verify(
        options,
        function (profile) {
          console.log('Got profile', profile);
        },
        function (error) {
          console.error(error);
        }
      );
    },
    function (error) {
      if (error === 'Not installed')
        console.error('Truecaller is not installed on user device.');
      else console.error(error);
    }
  );

options.consentMode : string

Kind: consentMode property of Options Default: Bottomsheet Alowed Values

ValueDescription
BottomsheetDisplays a bottomsheet
FullscreenDisplays a fullscreen modal
PopupDisplays a popup

options.buttonColor : hex color code

Kind: buttonColor property of Options Default: #2979FF

options.buttonTextColor : hex color code

Kind: buttonTextColor property of Options Default: #FFFFFF

options.loginTextPrefix : string

Kind: loginTextPrefix property of Options Default: To continue Description: Will display the same value. Alowed Values

Value
To get started
To continue
To complete your order
To checkout
To proceed with your booking
To continue with your booking
To get details
To view more
To continue reading
For new updates
To get updates
To subscribe
To subscribe and get updates

options.loginTextSuffix : string

Kind: loginTextSuffix property of Options Default: To continue Description: Will display the same value. Alowed Values

Value
Please verify mobile no
Please login
Please signup
Please login signup
Please register
Please sign in

options.ctaTextPrefix : string

Kind: ctaTextPrefix property of Options Default: Proceed with Description: Will display the same value. Alowed Values

Value
Use
Continue with
Proceed with

options.buttonShape : string

Kind: buttonShape property of Options Default: Rounded Description: The shape of button. Alowed Values

Value
Rectangle
Rounded

options.footerType : string

Kind: footerType property of Options Default: Later Description: Will display the same value in footer. Alowed Values

Value
Later
Manually
Another method

options.consentTitle : string

Kind: consentTitle property of Options Default: Verify Description: Will display the same value. Alowed Values

Value
Login
Sign up
Sign in
Verify
Register
Get started

options.sdkOptions : string

Kind: sdkOptions property of Options Default: With otp Alowed Values

Value
With otp
Without otp

truecaller.clearSdk()

Clears the trueScope.

Example

cordova.plugins.truecaller.clearSdk()