npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-credify-plugin-sms

v1.3.6

Published

Plugin for Cordova applications that utilizes Credify Collection SDK to collect SMS and Device Info from device, supports only android platform.

Downloads

6

Readme

Cordova Credify SDK Wrapper

plugin for Cordova applications that utilizes Credify Collection SDK to collect data from device, supports only android platform.

This plugin acts as a wrapper for Credify Native SDK.

To gain access application will need user permission on these permissions:

  • SMS: READ_SMS

SDK collection method will only collect data if the permission is granted, for example if user only accepted SMS, collection method will collect and send SMS disregarding other collection types

Minimum SDK Required 21

Target SDK Required 31+

General usage guide

1. Install the SDK

Install the wrapper by obtaining the wrapper repo and adding it to your project packages.json

npm i cordova-credify-plugin

2. Reviewing Permissions

Make sure that your application inclues the following permissions in android manifest file:

    <uses-permission android:name="android.permission.READ_SMS" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

3. Using the library

You can start using the SDK once it is installed by using the window object window.Credify

4. Initializing the SDK

To start using SDK functionalities SDK must be initialized with some identifiers that will be used to tag information collected with the user that is using the application. Usually initialization should take place right after user login.

Sample Initialization

window.Credify.initialize(
    'your token goes here',
    (response) => {
        // ideally after login, user identifier must be set to tag all collected data with the user
        // user id, name and ohone number can be set
        window.Credify.setUserInfo(
            '<user ID>',
            '<Full Name>',
            '<Phone Number>',
            (result) => {},
            (error) => {},
        )
    },
    (error) => {
        console.log('error:', error)
        // when an exception is thrown it probably means there was a critical error while initializing, check error code and error message inside the exception for more information.
    },
)

5. Requesting Permissions

User consent / approval on permissions is needed to run the collection method, to do so you can choose one of the following options:

  1. Ask user for permission from inside the client application code (can be useful if client application wants to show custom UI before asking for permissions)
  2. Or you can simply call the SDK method RequestPermissions which requests permissions for collection items that your application can collect.

Sample Permissions Request

window.Credify.requestPermissions(
    (result) => {
        console.log('permission request result', result)
    },
    (error) => {
        alert('error while requesting permissions:' + error)
    },
)

6. Collecting and Sending Data

After gaining proper approval, you can can call CollectData to collect and send collected data securely.

// collect data
window.Credify.collectData(
    (data) => {
        // data returned contains a JSON Object that contains each type of data collected and status of collecting and sending the data
        // result 200 means success
        // other results might indicate error, please check the error codes below for more information.
        // use data
        // data contains session_id property which contains and ID related to collection process and can be used in debugging
    },
    (error) => {
        console.log('error:', error)
        // when an exception is thrown it probably means there was a critical error while initializing, check error code and error message inside the exception for more information.
    },
)

The result of collection is a JSON string that can be decoded and can have one of the 2 formats:

  1. in case of remote data collection:
{
    "sms_log": "200",
    "session_id": "<UDID Here>"
}

each collection type will have a property that contains HTTP code for the remote request response code session_id contains a unique UDID that gets sent on each request in the collection process and can be used in debugging

  1. local data collection
{
  "sms_log": { ... },
}

each collection type will have a property that contains the result of the data collected

7. Error Codes and Debugging

Initialization error codes:

| Error Code | Description | Recommendation | | -------------------------------- | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | | 100 | Activity or Context null | Make sure the activity is not null and avoid placing initialization in splash activity | | 104 | Credify API configuration responded but configuration is null or mismatching | Update your Credify SDK | | Invalid token, response code ... | Credify API configuration responded with non-success status code | Review your token and make sure it is valid | | 103 | Unhandled Exception | Check logcat logs for more info |

Collection error codes (returned on each data type collected):

| Error Code | Description | Recommendation | | -------------- | ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- | | 200 | Data was collected and sent properly | | | 100 | Activity or Context null | Make sure the activity is not null and avoid placing initialization in splash activity | | 104 | Credify API configuration responded but configuration is null or mismatching | Update your Credify SDK | | 103 | Unhandled Exception | Check logcat logs for more info | | | Means that data was collected properly, but a network/service error occurred while sending | Get in touch with Credify Team to investigate further |

Debugging

Simply run your application in debug mode and filter logcat logs with the tag name "CredifySDK", logs messages under this tag contains log of all steps taken by the SDK and contains informational logs, logical errors, handled native exceptions and unhandled native exceptions.