0.1.8 • Published 11 months ago

react-native-unifiedpush-connector v0.1.8

Weekly downloads
-
License
Apache-2
Repository
github
Last release
11 months ago

react-native-unifiedpush-connector

UnifiedPush library connector for react-native

Installation

npm install react-native-unifiedpush-connector

Usage

// Javascript App

import { Platform, PermissionsAndroid } from 'react-native';
import { initUnifiedPush } from 'react-native-unifiedpush-connector';

...

  React.useEffect(() => {
    if (Platform.OS !== 'ios') {
      PermissionsAndroid.request(
        PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS
      );
      initUnifiedPush()
    }
  }, []);

...

  useEffect(() => {
    DeviceEventEmitter.addListener('unifiedPushURL', (e) => {
      // register push url
      // pushURL = e.endpoint;
    });


// AndroidManifest

...

    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

...

        <receiver
            android:enabled="true"
            android:name="com.unifiedpushconnector.CustomReceiver"
            android:exported="true">
            <intent-filter>
                <action android:name="org.unifiedpush.android.connector.MESSAGE"/>
                <action android:name="org.unifiedpush.android.connector.UNREGISTERED"/>
                <action android:name="org.unifiedpush.android.connector.NEW_ENDPOINT"/>
                <action android:name="org.unifiedpush.android.connector.REGISTRATION_FAILED"/>
                <action android:name="org.unifiedpush.android.connector.REGISTRATION_REFUSED"/>
            </intent-filter>
        </receiver>

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

Apache-2


Made with create-react-native-library

0.1.8

11 months ago

0.1.7

11 months ago

0.1.6

11 months ago

0.1.5

11 months ago

0.1.4

11 months ago

0.1.3

11 months ago

0.1.2

11 months ago

0.1.1

11 months ago

0.1.0

11 months ago