UNPKG

733 BMarkdownView Raw
1# Creating a Project From a Template
2
3If you want to get started with a sample project you can create a new project from the example template.
4
5```
6phonegap create my-app --template phonegap-template-push
7```
8
9## Quick Example
10
11```javascript
12var push = PushNotification.init({
13 android: {
14 },
15 browser: {
16 pushServiceURL: 'http://push.api.phonegap.com/v1/push'
17 },
18 ios: {
19 alert: "true",
20 badge: "true",
21 sound: "true"
22 },
23 windows: {}
24});
25
26push.on('registration', function(data) {
27 // data.registrationId
28});
29
30push.on('notification', function(data) {
31 // data.message,
32 // data.title,
33 // data.count,
34 // data.sound,
35 // data.image,
36 // data.additionalData
37});
38
39push.on('error', function(e) {
40 // e.message
41});
42```