Giter VIP home page Giter VIP logo

pushwoosh-react-native-plugin's Introduction

React Native Pushwoosh Push Notifications module

GitHub release npm license

platforms

Guide Documentation Sample

Android Setup

Step 1 - Install plugin

npm install pushwoosh-react-native-plugin --save

Step 2 - Include pushwooshplugin library project

In android/settings.gradle file, make the following changes:

...
include ':pushwooshplugin'
project(':pushwooshplugin').projectDir = new File(rootProject.projectDir, '../node_modules/pushwoosh-react-native-plugin/src/android')

In android/app/build.gradle add pushwooshplugin dependency:

dependencies {
    ...
    compile project(':pushwooshplugin')
}

Optional: To use non-default play-service-gcm version (the plugin uses 8.4.0), modify your android/app/build.gradle dependencies. This might be required in case of conflicts with other react-native plugins.

...

dependencies {
    ...
    compile project(':pushwooshplugin')
    compile ('com.google.android.gms:play-services-gcm:9.+') {force = true;}
    compile ('com.google.android.gms:play-services-location:9.+') {force = true;}
}

For RN < v.0.29.0 In MainActivity.java add:

...
import com.pushwoosh.reactnativeplugin.PushwooshPackage;

public class MainActivity extends ReactActivity {

    ...

    @Override
    protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
            new MainReactPackage(),
            new PushwooshPackage() // register Pushwoosh plugin here
        );
    }
}

For RN >= v.0.29.0 In MainApplication.java add:

...
import com.pushwoosh.reactnativeplugin.PushwooshPackage;

public class MainApplication extends Application implements ReactApplication {
    ...

    @Override
    protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
            new MainReactPackage(),
            new PushwooshPackage() // register Pushwoosh plugin here
        );
    }
}

Step 3 - Use module

var Pushwoosh = require('pushwoosh-react-native-plugin');

Pushwoosh.init({ "pw_appid" : "YOUR_PUSHWOOSH_PROJECT_ID" , "project_number" : "YOUR_GCM_PROJECT_NUMBER" });
Pushwoosh.register();

iOS Setup

Step 1 - Install plugin

npm install pushwoosh-react-native-plugin --save

Step 2 - Include PushwooshPlugin project

Drag the PushwooshPlugin.xcodeproj (located in node_modules/pushwoosh-react-native-plugin/src/ios) as a dependency project into your React Native XCode project. Link your project with libPushwooshPlugin.a, libstdc++ and libz libraries.

Step 3 - Use module

var Pushwoosh = require('pushwoosh-react-native-plugin');

Pushwoosh.init({ "pw_appid" : "YOUR_PUSHWOOSH_PROJECT_ID" });
Pushwoosh.register();

pushwoosh-react-native-plugin's People

Contributors

dimanam avatar exilz avatar malaman avatar yyoshiki41 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.