Indie Push Notifications
This guide covers how to send customized push notifications to individual users. We call these notifications "Indie" push notifications.
This video walks through the setup guide below:
Indie Push Notifications Preview:
Here's how our Indie Push Notification system works:
- Registration: Register a unique identifier for each app user you want to send Indie Push Notifications to.
- Use: Use the unique identifiers you registered to send Indie Push Notifications using our API.
Prerequisites
Create a free Native Notify account
Create a free NativeNotify.com account to get your Native Notify App ID and App Token.
Registration setup:
Imports
In your login component, include these imports:
import { registerIndieID, unregisterIndieDevice } from 'native-notify';
Check for Hook function
Make sure you are using a Hook function in the component you plan to register your users in. Here is an example:
export default function LoginScreen() {
...
}
This link explains Hooks in detail: https://react.dev/reference/react/hooks
Register Unique Identifier
Use this code to register your individual user with Native Notify (when your user logs in, for example):
registerIndieID('unique-user-id-string', app-id-number, 'app-token-string');
Character limit:
A sub_id can be at most 256 characters — that is the server-side limit, so keep your unique user ids short (a database id or UUID is plenty).
Unregister Unique Identifier
Use this code to unregister your individual user from Native Notify (when you user logs out, for example):
unregisterIndieDevice('unique-user-id-string', app-id-number, 'app-token-string');