Trying to make this work with no success...
When I set requestPermissions to false and rebuild the app the app stops crashing.
Putting PushNotification.requestPermissions() elsewhere also crashes.
````javascript
import * as PushNotification from 'react-native-push-notification'
class AppContainer extends Component {
componentDidMount() {
PushNotification.configure({
// (optional) Called when Token is generated (iOS and Android)
onRegister: function(token) {
console.log( 'TOKEN:', token );
},
// (required) Called when a remote or local notification is opened or received
onNotification: function(notification) {
console.log( 'NOTIFICATION:', notification );
},
// ANDROID ONLY: GCM Sender ID (optional - not required for local notifications, but is need to receive remote push notifications)
senderID: "********",
// IOS ONLY (optional): default: all - Permissions to register.
permissions: {
alert: true,
badge: true,
sound: true
},
// Should the initial notification be popped automatically
// default: true
popInitialNotification: true,
/**
* (optional) default: true
* - Specified if permissions (ios) and token (android and ios) will requested or not,
* - if not, you must call PushNotificationsHandler.requestPermissions() later
*/
requestPermissions: true,
});
}
render() {
return (
...
)
}
}
I don't know what exactly happened but the app stopped crashing. Then I removed
javascript
compile ('com.google.android.gms:play-services-gcm:9.0.4') {
force = true;
}
from android/app/build.gradle as suggested in https://github.com/zo0r/react-native-push-notification/issues/206 .. and I started getting my token.
Weird .. but what do you want, it's still the beginning of all this :). Thanks for package :) and good luck with this!
Im having this issue too!! .
Anyone could solve it?
Most helpful comment
I don't know what exactly happened but the app stopped crashing. Then I removed
javascript compile ('com.google.android.gms:play-services-gcm:9.0.4') { force = true; }from
android/app/build.gradleas suggested in https://github.com/zo0r/react-native-push-notification/issues/206 .. and I started getting my token.Weird .. but what do you want, it's still the beginning of all this :). Thanks for package :) and good luck with this!