Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeroen van Dijk committed Aug 9, 2017
1 parent 99e4808 commit b6cdf87
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Before setting up the Titanium SDK, you must generate the appropriate credential

```xml
<modules>
<module platform="iphone" version="1.6.1">com.williamrijksen.onesignal</module>
<module platform="android" version="1.6.1">com.williamrijksen.onesignal</module>
<module platform="iphone" version="1.7.0">com.williamrijksen.onesignal</module>
<module platform="android" version="1.7.0">com.williamrijksen.onesignal</module>
</modules>
```
1. Configure your app into the App Settings panel for the right Platform (Android and/or iOS).
Expand Down Expand Up @@ -46,9 +46,15 @@ Before setting up the Titanium SDK, you must generate the appropriate credential
1. Register device for Push Notifications

```js
// This registers your device automatically into OneSignal
// This registers your device automatically into OneSignal
var onesignal = require('com.williamrijksen.onesignal');
```
1. On iOS you'll need to request permission to use notifications:
```js
oneSignal.promptForPushNotificationsWithUserResponse(function(obj) {
alert(JSON.stringify(obj));
});
```
1. To add the possibility to target people for notifications, send a tag:

```js
Expand Down Expand Up @@ -96,8 +102,10 @@ Before setting up the Titanium SDK, you must generate the appropriate credential
visualLevel: onesignal.LOG_LEVEL_NONE
});
```
1. Receive notifications callback: (does not work on iOS when the app is closed (swiped away). But works fine when the app is running on background)
Opened:
1. Opened listener:
The returned content is matching the available payload on OneSignal:
- [https://documentation.onesignal.com/docs/ios-native-sdk#section--osnotificationpayload-](iOS)
- [https://documentation.onesignal.com/docs/android-native-sdk#section--osnotificationpayload-](Android)

```js
onesignal.addEventListener('notificationOpened', function (evt) {
Expand Down Expand Up @@ -128,7 +136,10 @@ Before setting up the Titanium SDK, you must generate the appropriate credential
});
```

1. Received:
1. Received listener:
The returned content is matching the available payload on OneSignal:
- [https://documentation.onesignal.com/docs/ios-native-sdk#section--osnotificationpayload-](iOS)
- [https://documentation.onesignal.com/docs/android-native-sdk#section--osnotificationpayload-](Android)

```js
onesignal.addEventListener('notificationReceived', function(evt) {
Expand Down

0 comments on commit b6cdf87

Please sign in to comment.