Closed jagwingchoy closed 3 years ago
Do these devices have GMS installed? If not that may be the problem. I do not have one of those devices so I can't test for you.
https://github.com/react-native-device-info/react-native-device-info#hasGms
Messaging requires Google Play Services (aka "GMS")
https://firebase.google.com/docs/android/android-play-services
Thanks @mikehardy, I will try to check if GMS existed there in the user devices first.
Got reports from users and confirmed that all firebase/cloud-messaging functions will not work if GMS not exist. Will need to find another way to send notifications to Huawei users. Thanks @mikehardy for helping.
I'm not sure what the plans are for supporting HMS devices from firestore but it is sorely needed It appears OneSignal can handle push notifications for both
We are currently observing crashes on Huawei devices. Does this library supports notifications on Huawei devices?
Issue
Recently I have transferred my app's notifications service from AppCenter to Firebase Cloud Messaging. iOS and mostly Android devices are working fine. However, I have just got some reports from users that their app will hang in a blank white screen when opening the app, they are mostly using Android devices - Huawei p40 Pro.
I think the issue is mostly happened in below codes, as this is the only feature I have added between versions. Inside my app's login screen:
I believe it is mostly because Huawei got banned from Google Play service, but I have no idea how to solve it. This is a non-fatal error which will not crash the app, so I cannot trace it from any crashlytics. Does anyone face the same issue? How can you solve it so the app can run normally in new Huawei device? Please kindly help, thanks.
Project Files
Javascript
Click To Expand
#### `package.json`: ```json { "name": "sample", "version": "0.0.1", "private": true, "scripts": { }, "dependencies": { "@react-native-firebase/app": "10.3.0", "@react-native-firebase/messaging": "10.3.0", "apisauce": "0.14.2", "appcenter": "1.13.0", "appcenter-analytics": "1.13.0", "appcenter-crashes": "1.13.0", "appcenter-link-scripts": "1.10.0", "appcenter-push": "1.13.0", "feather-icons": "4.6.0", "format-json": "1.0.3", "identity-obj-proxy": "3.0.0", "lodash": "4.17.5", "native-base": "git://github.com/GeekyAnts/NativeBase.git#9ceefc602964cbd035b3a99a40b8199800e1f596", "pretty-format": "23.6.0", "prop-types": "15.6.1", "qs": "6.5.1", "querystringify": "1.0.0", "ramda": "0.25.0", "react": "16.8.3", "react-native": "0.59.10", "react-native-android-installed-apps": "1.0.1", "react-native-animatable": "1.2.4", "react-native-code-push": "5.6.1", "react-native-collapsible": "1.2.1", "react-native-config": "0.11.5", "react-native-cookies": "3.3.0", "react-native-dash": "0.0.9", "react-native-device-info": "0.26.3", "react-native-fetch-blob": "0.10.8", "react-native-fs": "2.9.11", "react-native-i18n": "2.0.14", "react-native-image-crop-picker": "0.24.0", "react-native-installed-packages": "0.2.0", "react-native-keyboard-aware-scroll-view": "0.9.1", "react-native-lightbox": "0.8.0", "react-native-linear-gradient": "2.5.6", "react-native-loading-spinner-overlay": "1.0.1", "react-native-material-dropdown": "github:ckhk0621/react-native-material-dropdown", "react-native-material-textfield": "0.12.0", "react-native-modal": "11.3.1", "react-native-phonecall-listener": "1.0.1", "react-native-progress": "3.5.0", "react-native-progress-circle": "2.0.1", "react-native-restart": "0.0.7", "react-native-scalable-image": "0.4.0", "react-native-share": "1.2.1", "react-native-snap-carousel": "3.6.0", "react-navigation": "1.2.1", "react-navigation-current-route": "1.0.0", "react-navigation-redux-helpers": "1.0.1", "react-number-format": "3.2.0", "react-redux": "5.0.7", "redux": "3.7.2", "redux-form": "8.2.6", "redux-persist": "5.9.1", "redux-saga": "0.16.0", "reduxsauce": "0.7.0", "rn-sliding-up-panel": "2.3.1", "seamless-immutable": "7.1.3" }, "devDependencies": { "@babel/core": "7.4.5", "@babel/runtime": "7.4.5", "@storybook/addon-storyshots": "3.3.14", "@storybook/addons": "3.3.14", "@storybook/channels": "3.3.14", "@storybook/react-native": "3.3.14", "babel-core": "6.26.0", "babel-eslint": "8.2.2", "babel-jest": "24.8.0", "babel-plugin-ignite-ignore-reactotron": "0.3.0", "babel-preset-env": "1.6.1", "enzyme": "3.2.0", "enzyme-adapter-react-16": "1.1.0", "husky": "0.14.3", "ignite-animatable": "1.0.0", "ignite-dev-screens": "2.3.0", "ignite-i18n": "1.1.1", "ignite-ir-boilerplate": "2.3.1", "ignite-redux-persist": "1.1.0", "ignite-standard": "1.0.0", "ignite-vector-icons": "1.1.0", "jest": "24.8.0", "jetifier": "1.6.4", "metro-react-native-babel-preset": "0.54.1", "mockery": "2.1.0", "prettier-eslint": "8.8.1", "react-dom": "16.2.0", "react-test-renderer": "16.8.3", "reactotron-react-native": "1.13.2", "reactotron-redux": "2.0.0-alpha.1", "reactotron-redux-saga": "2.0.0-alpha.1", "redux-devtools-extension": "^2.13.8", "snazzy": "7.1.0", "standard": "11.0.0" }, "jest": { "testMatch": [ "/Tests/**/*.js",
"**/?(*.)(spec|test).js?(x)"
],
"testPathIgnorePatterns": [
"/node_modules/",
"/Tests/Setup.js"
],
"moduleNameMapper": {
"^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "identity-obj-proxy"
},
"setupFiles": [
"/Tests/Setup",
"/node_modules/appcenter/test/AppCenterMock.js",
"/node_modules/appcenter-analytics/test/AppCenterAnalyticsMock.js",
"/node_modules/appcenter-crashes/test/AppCenterCrashesMock.js",
"/node_modules/appcenter-push/test/AppCenterPushMock.js"
],
"preset": "react-native"
},
"config": {},
"standard": {
"parser": "babel-eslint",
"globals": [
"describe",
"test",
"jest",
"expect",
"fetch",
"navigator",
"__DEV__",
"XMLHttpRequest",
"FormData",
"React$Element"
]
}
}
```
#### `firebase.json` for react-native-firebase v6:
```json
# N/A
```
iOS
Issue not happened in iOS.
Click To Expand
#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby # N/A ``` #### `AppDelegate.m`: ```objc // N/A ```
Android
Click To Expand
#### Have you converted to AndroidX? - [x] my application is an AndroidX application? - [x] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? (using in dev dependencies) #### `android/build.gradle`: ```groovy buildscript { ext { buildToolsVersion = "29.0.2" minSdkVersion = 18 compileSdkVersion = 29 targetSdkVersion = 29 supportLibVersion = "29.0.0" } repositories { google() jcenter() } dependencies { classpath("com.android.tools.build:gradle:3.4.0") classpath 'com.google.gms:google-services:4.3.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { maven { url "https://maven.google.com" } mavenLocal() google() jcenter() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$rootDir/../node_modules/react-native/android" } maven { url "https://jitpack.io" } // for react-native-image-crop-picker use } } ``` #### `android/app/build.gradle`: ```groovy apply plugin: "com.android.application" apply plugin: 'com.google.gms.google-services' apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle" import com.android.build.OutputFile /** * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets * and bundleReleaseJsAndAssets). * These basically call `react-native bundle` with the correct arguments during the Android build * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the * bundle directly from the development server. Below you can see all the possible configurations * and their defaults. If you decide to add a configuration block, make sure to add it before the * `apply from: "../../node_modules/react-native/react.gradle"` line. * * project.ext.react = [ * // the name of the generated asset file containing your JS bundle * bundleAssetName: "index.android.bundle", * * // the entry file for bundle generation * entryFile: "index.android.js", * * // whether to bundle JS and assets in debug mode * bundleInDebug: false, * * // whether to bundle JS and assets in release mode * bundleInRelease: true, * * // whether to bundle JS and assets in another build variant (if configured). * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants * // The configuration property can be in the following formats * // 'bundleIn${productFlavor}${buildType}' * // 'bundleIn${buildType}' * // bundleInFreeDebug: true, * // bundleInPaidRelease: true, * // bundleInBeta: true, * * // whether to disable dev mode in custom build variants (by default only disabled in release) * // for example: to disable dev mode in the staging build type (if configured) * devDisabledInStaging: true, * // The configuration property can be in the following formats * // 'devDisabledIn${productFlavor}${buildType}' * // 'devDisabledIn${buildType}' * * // the root of your project, i.e. where "package.json" lives * root: "../../", * * // where to put the JS bundle asset in debug mode * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", * * // where to put the JS bundle asset in release mode * jsBundleDirRelease: "$buildDir/intermediates/assets/release", * * // where to put drawable resources / React Native assets, e.g. the ones you use via * // require('./image.png')), in debug mode * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", * * // where to put drawable resources / React Native assets, e.g. the ones you use via * // require('./image.png')), in release mode * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", * * // by default the gradle tasks are skipped if none of the JS files or assets change; this means * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to * // date; if you have any other folders that you want to ignore for performance reasons (gradle * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ * // for example, you might want to remove it from here. * inputExcludes: ["android/**", "ios/**"], * * // override which node gets called and with what additional arguments * nodeExecutableAndArgs: ["node"], * * // supply additional arguments to the packager * extraPackagerArgs: [] * ] */ project.ext.react = [ entryFile: "index.js" ] apply from: "../../node_modules/react-native/react.gradle" apply from: "../../node_modules/react-native-code-push/android/codepush.gradle" /** * Set this to true to create two separate APKs instead of one: * - An APK that only works on ARM devices * - An APK that only works on x86 devices * The advantage is the size of the APK is reduced by about 4MB. * Upload all the APKs to the Play Store and people will download * the correct one based on the CPU architecture of their device. */ def enableSeparateBuildPerCPUArchitecture = false /** * Run Proguard to shrink the Java bytecode in release builds. */ def enableProguardInReleaseBuilds = false android { compileSdkVersion 29 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } dexOptions { jumboMode true } defaultConfig { applicationId "com.sample.app" minSdkVersion 18 targetSdkVersion 29 versionCode 273 versionName "7.0.1" multiDexEnabled true vectorDrawables.useSupportLibrary = true // for react-native-image-crop-picker use } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" } } buildTypes { release { minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } // applicationVariants are e.g. debug, release applicationVariants.all { variant -> variant.outputs.each { output -> // For each separate APK per architecture, set a unique version code as described here: // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4] def abi = output.getFilter(OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = versionCodes.get(abi) * 1048576 + defaultConfig.versionCode } } } } dependencies { implementation project(':@react-native-firebase_messaging') implementation project(':@react-native-firebase_app') implementation 'com.google.firebase:firebase-analytics:17.5.0' implementation project(':react-native-phonecall-listener') implementation project(':react-native-config') compile project(':react-native-i18n') compile project(':react-native-restart') compile project(':react-native-installed-packages') compile project(':react-native-android-installed-apps') compile project(':react-native-code-push') compile project(':appcenter-push') compile project(':appcenter-crashes') compile project(':appcenter-analytics') compile project(':appcenter') compile project(':react-native-linear-gradient') implementation (project(":react-native-device-info"), { exclude group: "com.google.android.gms" }) implementation "com.google.android.gms:play-services-gcm:16.0.0" implementation 'androidx.appcompat:appcompat:1.1.0-rc01' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02' compile fileTree(dir: "libs", include: ["*.jar"]) compile "com.facebook.react:react-native:+" // From node_modules compile project(':react-native-share') compile project(':react-native-fs') compile project(':react-native-fetch-blob') compile project(':react-native-image-crop-picker') compile project(':react-native-cookies') compile 'com.android.support:multidex:1.0.3' compile 'com.google.android.gms:play-services-auth:16.0.1' implementation 'com.facebook.fresco:fresco:1.10.0' implementation 'com.facebook.fresco:animated-gif:1.10.0' } // Run this once to be able to run the application with BUCK // puts all compile dependencies into folder libs for BUCK to use task copyDownloadableDepsToLibs(type: Copy) { from configurations.compile into 'libs' } ``` #### `android/settings.gradle`: ```groovy rootProject.name = 'sample' include ':@react-native-firebase_messaging' project(':@react-native-firebase_messaging').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-firebase/messaging/android') include ':@react-native-firebase_app' project(':@react-native-firebase_app').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-firebase/app/android') include ':react-native-phonecall-listener' project(':react-native-phonecall-listener').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-phonecall-listener/android') include ':react-native-gesture-handler', ':Online113AssistantActionSDK' project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android') include ':react-native-config' project(':react-native-config').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-config/android') include ':react-native-screens' project(':react-native-screens').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-screens/android') include ':react-native-reanimated' project(':react-native-reanimated').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-reanimated/android') include ':react-native-restart' project(':react-native-restart').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-restart/android') include ':react-native-installed-packages' project(':react-native-installed-packages').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-installed-packages/android') include ':react-native-android-installed-apps' project(':react-native-android-installed-apps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-android-installed-apps/android') include ':react-native-cookies' project(':react-native-cookies').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-cookies/android') include ':react-native-code-push' project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app') include ':react-native-image-crop-picker' project(':react-native-image-crop-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-crop-picker/android') include ':react-native-fetch-blob' project(':react-native-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fetch-blob/android') include ':react-native-fs' project(':react-native-fs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fs/android') include ':appcenter-push' project(':appcenter-push').projectDir = new File(rootProject.projectDir, '../node_modules/appcenter-push/android') include ':appcenter-crashes' project(':appcenter-crashes').projectDir = new File(rootProject.projectDir, '../node_modules/appcenter-crashes/android') include ':appcenter-analytics' project(':appcenter-analytics').projectDir = new File(rootProject.projectDir, '../node_modules/appcenter-analytics/android') include ':appcenter' project(':appcenter').projectDir = new File(rootProject.projectDir, '../node_modules/appcenter/android') include ':react-native-linear-gradient' project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android') include ':react-native-device-info' project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android') include ':react-native-share' project(':react-native-share').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-share/android') include ':react-native-config' project(':react-native-config').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-config/android') include ':react-native-i18n' project(':react-native-i18n').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-i18n/android') include ':app' ``` #### `MainApplication.java`: ```java package com.sample.app; import android.app.Application; import com.facebook.react.ReactApplication; import io.invertase.firebase.messaging.ReactNativeFirebaseMessagingPackage; import io.invertase.firebase.app.ReactNativeFirebaseAppPackage; import com.reactnative.phonecalllistener.RNPhonecallListenerPackage; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import com.facebook.soloader.SoLoader; import androidx.multidex.MultiDex; import androidx.multidex.MultiDexApplication; import java.util.Arrays; import java.util.List; import android.content.Context; import com.facebook.react.ReactApplication; import com.lugg.ReactNativeConfig.ReactNativeConfigPackage; import com.facebook.react.ReactActivityDelegate; import com.facebook.react.ReactRootView; import com.avishayil.rnrestart.ReactNativeRestartPackage; import com.jstokes.RNInstalledAppsPackage; import com.psykar.cookiemanager.CookieManagerPackage; import com.microsoft.codepush.react.CodePush; import com.reactnative.ivpusic.imagepicker.PickerPackage; import com.RNFetchBlob.RNFetchBlobPackage; import com.androidinstalledapps.RNAndroidInstalledAppsPackage; import com.microsoft.appcenter.reactnative.appcenter.AppCenterReactNativePackage; import com.rnfs.RNFSPackage; import com.microsoft.appcenter.reactnative.push.AppCenterReactNativePushPackage; import com.microsoft.appcenter.reactnative.crashes.AppCenterReactNativeCrashesPackage; import com.microsoft.appcenter.reactnative.analytics.AppCenterReactNativeAnalyticsPackage; import com.BV.LinearGradient.LinearGradientPackage; //import com.i18n.reactnativei18n.ReactNativeI18n; import com.learnium.RNDeviceInfo.RNDeviceInfo; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import com.facebook.soloader.SoLoader; import cl.json.RNSharePackage; import com.AlexanderZaytsev.RNI18n.RNI18nPackage; import cl.json.ShareApplication; import com.google.android.gms.security.ProviderInstaller; import javax.net.ssl.SSLContext; public class MainApplication extends Application implements ReactApplication, ShareApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override protected String getJSBundleFile() { return CodePush.getJSBundleFile(); } @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List getPackages() {
return Arrays.asList(
new MainReactPackage(),
new ReactNativeFirebaseMessagingPackage(),
new ReactNativeFirebaseAppPackage(),
new RNPhonecallListenerPackage(),
new ReactNativeConfigPackage(),
new ReactNativeRestartPackage(),
new RNInstalledAppsPackage(),
new CookieManagerPackage(),
new CodePush("dSKOC-aijGJcj9mrSb7jbb5INqL_r1I_QUQXQ", MainApplication.this, BuildConfig.DEBUG),
new PickerPackage(),
new RNFetchBlobPackage(),
new RNI18nPackage(),
new RNFSPackage(),
new AppCenterReactNativePushPackage(MainApplication.this),
new AppCenterReactNativeCrashesPackage(MainApplication.this, getResources().getString(R.string.appcenterCrashes_whenToSendCrashes)),
new AppCenterReactNativeAnalyticsPackage(MainApplication.this, getResources().getString(R.string.appcenterAnalytics_whenToEnableAnalytics)),
new AppCenterReactNativePackage(MainApplication.this),
new LinearGradientPackage(),
// new ReactNativeI18n(),
new RNDeviceInfo(),
new RNSharePackage(),
new RNAndroidInstalledAppsPackage()
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
//issue #407
//reference: https://stackoverflow.com/questions/29916962/javax-net-ssl-sslhandshakeexception-javax-net-ssl-sslprotocolexception-ssl-han/36892715#36892715
try {
ProviderInstaller.installIfNeeded(getApplicationContext());
SSLContext sslContext;
sslContext = SSLContext.getInstance("TLSv1.2");
sslContext.init(null, null, null);
sslContext.createSSLEngine();
//} catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException
// | NoSuchAlgorithmException | KeyManagementException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public String getFileProviderAuthority() {
return "com.sample.provider";
}
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
```
#### `AndroidManifest.xml`:
```xml
```
Environment
Click To Expand
**`react-native info` output:** ``` React Native Environment Info: System: OS: macOS 10.15.6 CPU: (8) x64 Intel(R) Core(TM) i7-8569U CPU @ 2.80GHz Memory: 698.58 MB / 16.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 13.14.0 - /usr/local/bin/node Yarn: 1.19.1 - /usr/local/bin/yarn npm: 6.14.4 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0 Android SDK: API Levels: 23, 24, 25, 26, 27, 28, 29 Build Tools: 26.0.2, 26.0.3, 27.0.3, 28.0.3, 29.0.2, 29.0.3 System Images: android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom IDEs: Android Studio: 3.5 AI-191.8026.42.35.5791312 Xcode: 12.0/12A7209 - /usr/bin/xcodebuild npmPackages: react: 16.8.3 => 16.8.3 react-native: 0.59.10 => 0.59.10 npmGlobalPackages: create-react-native-module: 0.19.0 react-native-cli: 2.0.1 react-native-rename: 2.4.1 ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [x] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `8.2.0` - **`Firebase` module(s) you're using that has the issue:** - `"@react-native-firebase/messaging": "7.5.0",` - **Are you using `TypeScript`?** - `N`
React Native Firebase
andInvertase
on Twitter for updates on the library.