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

@pngme/react-native-sms-pngme-android

v6.0.1

Published

Module for Pngme partners to build credit score from phone information

Downloads

123

Readme

@pngme/react-native-sms-pngme-android

Module that supports interaction with the Messaging API on Android getting phone SMS in order to be sent to pngme platform.

The package allows you to:

  • Ask for sms permissions
  • Get messages
  • Send the data to pngme server

Installation

Yarn

$ yarn add @pngme/react-native-sms-pngme-android

Npm

$ npm install @pngme/react-native-sms-pngme-android --save

for React-Native < 0.61

$ react-native link @pngme/react-native-sms-pngme-android

For React-Native < 0.61 projects add maven as repository on/Android folder open build.gradle and the following line

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' } // <-- add this line
    }
}

Also make sure that your gradle.properties has the following properties

android.useAndroidX=true
android.enableJetifier=true

for React-Native > 0.61

You do not have to do anything else.

Installation Tips

For some react-native version there is a dependency collision with kotlinx-coroutines-core if you get this error you can fix it by replacing this module on that way on your App gradle

// add from here
configurations {
    implementation {
        exclude group: 'org.jetbrains.kotlinx', module: 'kotlinx-coroutines-core'
    }
}
// to here

dependencies {
    implementation ....
     // For RN 0.61.0
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
}

We highly recommend to use JDK 11 if you have any issues please try to update your JDK version first https://www.oracle.com/java/technologies/javase-downloads.html

Opening Permission Flow

SmsPngmeAndroid was designed to be as easy as possible to use into your project, you only have to import the library and invoke go or goWithCustomDialog function, passing only one param that is an object containing user info. Please check the table bellow code snippet for details on these params. Have in mind that SmsPngmeAndroid function is async, so using await you will be able to know when the flow is finished in order to continue with your application flow normally.

import * as React from 'react';
import { useEffect } from 'react';
import { View, Text, Alert } from 'react-native';
// Add this line
import { go } from '@pngme/react-native-sms-pngme-android';

export default function App() {
  useEffect(() => {
    openSDK();
  }, []);

  const openSDK = async () => {
    const goParams = {
      clientKey,
      companyName,
      externalId,
    };
    const response = await go(goParams);
    Alert.alert('on Complete', response);
  };

  return (
    <View>
      <Text>Your app content..</Text>
    </View>
  );
}

Or goWithCustomDialog

import * as React from 'react';
import { useEffect } from 'react';
import { View, Text, Alert } from 'react-native';
// Add this line
import { goWithCustomDialog } from '@pngme/react-native-sms-pngme-android';

export default function App() {
  useEffect(() => {
    openSDK();
  }, []);

  const openSDK = async () => {
    const goWithCustomDialogParams = {
      clientKey,
      companyName,
      externalId,
      hasAcceptedTerms: true, // or false if the user didn't accept the terms
    };
    const response = await goWithCustomDialog(goParams);
    Alert.alert('on Complete', response);
  };

  return (
    <View>
      <Text>Your app content..</Text>
    </View>
  );
}

Params

| Param | Required | Type | Description | | ---------------- | -------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | companyName | Yes | String | Used to show your company name on components | | clientKey | Yes | String | On this param you should pass your client key provided by Pngme team. For security reasons avoid to hardcode this key on your code, we highly recommend to use it from your .env file | | phoneNumber | Yes | String | country code + phone number string. Ej: for Ghana (country code +233) phone number 03X XXX XXXX you should pass '23303X XXX XXXX' Warning: Pngme assumes that this data is verified by your app. If email or phoneNumber are not verified please let support team know. | | externalId | Yes | String | You can pass your uuid in this field, this can be useful to identify your users last when obtaining processed data from our servers. | | hasAcceptedTerms | Yes | Boolean | Set the value to 'true' if the user has accepted the terms and conditions when invoking the 'goWithCustomDialog' method.method |

Auxiliar methods

In most of the cases there is no need to have auxiliar methods since with the previous code example you can show the flow to ask permissions but if you call it and permissions are already enable popup will not be shown. Here we add some auxiliar methods in order to know current state of permissions on @pngme/react-native-sms-pngme-android

Checking permissions

You can check permission status by invoking isPermissionGranted async function, it will return a boolean

import { isPermissionGranted } from '@pngme/react-native-sms-pngme-android';

const isPermissionGranted = async () => {
  const isPermissionGrantedBoolean = await isPermissionGranted();
  Alert.alert('Result', isPermissionGrantedBoolean.toString());
};

License

MIT