evollu / evollu/react-native-fcm

Crash with ExpoKit

Open
#511 15 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.7k
Forks
661
PR merge metrics
No merged PRs in 30d

Description

Hi !
I encountered so much problems integrating this library with expokit, but now, i'm really close of it !
I don't have any problems with iOS but Android drives me mad.

When I receive an notification on Android, it'll instantly crash with this error
`java.lang.NullPointerException: Attempt to invoke virtual method 'com.facebook.react.ReactInstanceManager com.facebook.react.ReactNativeHost.getReactInstanceManager()' on a null object reference`

because of this [line](https://github.com/evollu/react-native-fcm/blob/master/android/src/main/java/com/evollu/react/fcm/MessagingService.java#L40)
` ReactInstanceManager mReactInstanceManager = ((ReactApplication) getApplication()).getReactNativeHost().getReactInstanceManager();`

My MainApplication class is like this:
```java
package com.productinuse.preprod;

import android.support.multidex.MultiDexApplication;

import com.facebook.react.ReactPackage;

import java.util.Arrays;
import java.util.List;

import com.evollu.react.fcm.FIRMessagingPackage;

public class MainApplication extends MultiDexApplication {
public List getPackages() {
return Arrays.asList(
// Add your own packages here!
new FIRMessagingPackage()
);
}
}
```

It doesn't implement ReactApplication because of the ExpoKit implementation.

I already see [this](https://github.com/zo0r/react-native-push-notification/issues/432) and [this](https://github.com/expo/expo/issues/206) without any solutions

react-native-fcm: 7.5.1
expokit: sdk 19
@evollu I mention you because I'm really desperate aha 😉

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.