Skip to content

Commit 8175b14

Browse files
committed
Add received and opened handlers for Android notifications && Bug fixes
1 parent 183d588 commit 8175b14

24 files changed

+284
-84
lines changed

._index.js

4 KB
Binary file not shown.

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,17 @@ Pushbots.registerForRemoteNotifications()
100100
//events work with iOS only in this version.
101101
export default class App extends Component<{}> {
102102
componentWillMount() {
103-
console.log("Adding listener");
104103
Pushbots.addEventListener('received', this.onReceived);
104+
Pushbots.addEventListener('opened', this.onOpened);
105105
}
106106
componentWillUnmount() {
107107
Pushbots.removeEventListener('received', this.onReceived);
108-
}
108+
Pushbots.removeEventListener('opened', this.onOpened); }
109109
onReceived(notification) {
110-
Alert.alert( 'Alert Title', JSON.stringify(notification), [ {text: 'Ask me later', onPress: () => console.log('Ask me later pressed')}, {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'}, {text: 'OK', onPress: () => console.log('OK Pressed')}, ], { cancelable: false } )
110+
Alert.alert( 'Received Notification', JSON.stringify(notification), [ {text: 'Ask me later', onPress: () => console.log('Ask me later pressed')}, {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'}, {text: 'OK', onPress: () => console.log('OK Pressed')}, ], { cancelable: false } )
111+
}
112+
onOpened(notification) {
113+
Alert.alert( 'Opened Notification', JSON.stringify(notification), [ {text: 'Ask me later', onPress: () => console.log('Ask me later pressed')}, {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'}, {text: 'OK', onPress: () => console.log('OK Pressed')}, ], { cancelable: false } )
111114
}
112115
}
113116

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ repositories {
3232
dependencies {
3333
compile 'com.facebook.react:react-native:+'
3434
compile 'com.google.android.gms:play-services-gcm:12.0.1'
35-
compile 'com.pushbots:pushbots-lib:3.1.4-r@aar'
35+
compile 'com.pushbots:pushbots-lib:3.1.6-r@aar'
3636
}

android/src/.DS_Store

6 KB
Binary file not shown.

android/src/._.DS_Store

4 KB
Binary file not shown.

android/src/main/.DS_Store

6 KB
Binary file not shown.

android/src/main/._.DS_Store

4 KB
Binary file not shown.
4 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.pushbots.reactNative">
3+
34
</manifest>

android/src/main/java/.DS_Store

6 KB
Binary file not shown.

0 commit comments

Comments
 (0)