react-native-gcm-android icon indicating copy to clipboard operation
react-native-gcm-android copied to clipboard

App crash with ToastAndroid

Open CodeoLTD opened this issue 9 years ago • 3 comments

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.

CodeoLTD avatar Feb 03 '16 12:02 CodeoLTD

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

dustinosity avatar Feb 03 '16 19:02 dustinosity

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 avatar Feb 03 '16 19:02 dustinosity

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...)

dustinosity avatar Feb 03 '16 20:02 dustinosity