Checking Session Status

Introduction

There are a couple of exceptions where permissions have been accepted, but SMS messages are not being sent to the Pngme backend.

Possible reasons:

  • The user granted permission via Android app settings
  • The SMS SDK was opened, the user accepted permissions but for whatever reason (network issue, no connection, timeout), Pngme's API did not start a new session.

To start sending the SMS messages, open the permission flow by calling SmsPngmeAndroid again to start a new session. Once a new session starts, the SDK will start sending SMS data on the background.

To know if a session was started, expose the boolean operation: isPermissionEnabledAndWasSessionStarted and can be use on that way:

import SmsPngmeAndroid, { isPermissionEnabledAndWasSessionStarted } from '@pngme/react-native-sms-pngme-android';

const testFunction = async() => {
    const wasASessionStarted = await isPermissionEnabledAndWasSessionStarted();
    Alert.alert("Result", wasASessionStarted.toString());
}