Skip to content

Commit 2ff3eab

Browse files
author
Lilach Adir
committed
add README
1 parent e78a534 commit 2ff3eab

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
## react-native-push-with-gcm
2+
3+
Register device for GCM push notifications services (supported only for
4+
iOS)
5+
6+
## Installation
7+
8+
Make sure that you are in your React Native project directory and run:
9+
10+
```bash
11+
npm install react-native-push-with-gcm --save
12+
```
13+
14+
### Installing manually
15+
16+
In XCode, in the project navigator:
17+
- Right click Libraries
18+
- Add Files to [your project's name]
19+
- Go to node_modules/react-native-push-with-gcm
20+
- Add the `RCTPushWithGCM` folder within `ios` directory
21+
22+
## Requirements
23+
24+
- Google Cloud Messaging. You can find the instructions
25+
[here](https://developers.google.com/cloud-messaging/ios/start).
26+
- react-native
27+
28+
## Usage
29+
30+
First you need to configure and connect to GCM:
31+
32+
```javascript
33+
var PushWithGCM = require('react-native-push-with-gcm')
34+
35+
componentDidMount() {
36+
PushWithGCM.configure()
37+
}
38+
```
39+
40+
Once your app registers for push notifications, grab that token
41+
(PushNotificationsIOS will give this token as a string) and register
42+
that token in GCM. You also need to supply a boolean value for your APNS
43+
server sandbox option (hint: sandbox is used for development):
44+
45+
```javascript
46+
PushWithGCM.registerUser(token, isSandbox)
47+
```
48+
49+
If there are topics you'd like this device to be registered to, you can
50+
easily do that too. after registration send an array of all the topics
51+
to register to:
52+
53+
```javascript
54+
PushWithGCM.subscribeToTopics(['push', 'with', 'gcm'])
55+
```
56+
57+
## Contributing
58+
59+
1. Fork it (
60+
https://github.com/lilach/react-native-push-with-gcm/fork )
61+
2. Create your feature branch (`git checkout -b my-new-feature`)
62+
3. Commit your changes (`git commit -am 'Add some feature'`)
63+
4. Push to the branch (`git push origin my-new-feature`)
64+
5. Create a new Pull Request

0 commit comments

Comments
 (0)