oney / react-native-gcm-android

GCM for React Native Android
MIT License
172 stars 76 forks source link

App crash with ToastAndroid #40

Open CodeoLTD opened 8 years ago

CodeoLTD commented 8 years ago

when I Import the ToastAndroid component of react-native, anywhere in my app, and send a notification when the app is closed, the app crash. In ToastAndroid.android.js the line: var RCTToastAndroid = require('NativeModules').ToastAndroid; returns a null value. I'm not sure if this is an issue to you or react-native main git but thought you should know.

dustinosity commented 8 years ago

I get the same behavior when I do an import codePush from 'react-native-code-push';

dustinosity commented 8 years ago

When the app is killed/closed and a notification is received BackgroundService.java (from react-native-gcm-android) is loaded in place of your normal MainActivity.java, but still loads your normal index.android.bundle. I think this is where the compatibility problem is. Maybe if BackgroundService.java could load an alternate bundle file that doesn't contain the conflicting imports? Or the BackgroundService.java could be made more compatible with other native packages?

dustinosity commented 8 years ago

I would prefer the latter solution since I'm sending data payloads in my gcm's and would like to load enough of my app to at least get access to my redux data stores to save the data. (though I suppose that could also be accomplished with a parred down version of my index.android. js...)