summaryrefslogtreecommitdiff
path: root/StoneIsland/plugins/phonegap-plugin-push/docs/EXAMPLES.md
blob: 32bc2e5fd5a8549ad20b0ccd89d7aa55ca728b2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Creating a Project From a Template

If you want to get started with a sample project you can create a new project from the example template.

```
phonegap create my-app --template phonegap-template-push
```

## Quick Example

```javascript
var push = PushNotification.init({
	android: {
	},
    browser: {
        pushServiceURL: 'http://push.api.phonegap.com/v1/push'
    },
	ios: {
		alert: "true",
		badge: "true",
		sound: "true"
	},
	windows: {}
});

push.on('registration', function(data) {
	// data.registrationId
});

push.on('notification', function(data) {
	// data.message,
	// data.title,
	// data.count,
	// data.sound,
	// data.image,
	// data.additionalData
});

push.on('error', function(e) {
	// e.message
});
```