zetavg / react-native-system-notification

Android system notifications for React Native. Supports push notifications with GCM integrated.
https://www.npmjs.com/package/react-native-system-notification
244 stars 102 forks source link

[RN-0.31.0] Issue in FCM Listener #69

Open rimzici opened 7 years ago

rimzici commented 7 years ago

Hi team, pasting portion of my output after running my app , after configuring system notification. following are my module versions : "react": "15.2.1", "react-native": "0.31.0", "react-native-fcm": "^1.0.16", "react-native-system-notification": "^0.2.1"

ERROR : -DATE :react-native-system-notification:prepareReleaseDependencies :react-native-system-notification:compileReleaseAidl UP-TO-DATE :react-native-system-notification:compileReleaseRenderscript UP-TO-DATE :react-native-system-notification:generateReleaseBuildConfig UP-TO-DATE :react-native-system-notification:generateReleaseAssets UP-TO-DATE :react-native-system-notification:mergeReleaseAssets UP-TO-DATE :react-native-system-notification:generateReleaseResValues UP-TO-DATE :react-native-system-notification:generateReleaseResources UP-TO-DATE :react-native-system-notification:mergeReleaseResources UP-TO-DATE :react-native-system-notification:processReleaseManifest UP-TO-DATE :react-native-system-notification:processReleaseResources UP-TO-DATE :react-native-system-notification:generateReleaseSources UP-TO-DATE :react-native-system-notification:processReleaseJavaRes UP-TO-DATE :react-native-system-notification:compileReleaseJava /Users/rimneshfernandez/work/projects/curation/node_modules/react-native-system-notification/android/src/main/java/io/neson/react/notification/FCMNotificationListenerService.java:9: error: package com.google.firebase.messaging does not exist import com.google.firebase.messaging.FirebaseMessagingService; ^ /Users/rimneshfernandez/work/projects/curation/node_modules/react-native-system-notification/android/src/main/java/io/neson/react/notification/FCMNotificationListenerService.java:10: error: package com.google.firebase.messaging does not exist import com.google.firebase.messaging.RemoteMessage; ^ /Users/rimneshfernandez/work/projects/curation/node_modules/react-native-system-notification/android/src/main/java/io/neson/react/notification/FCMNotificationListenerService.java:13: error: cannot find symbol public class FCMNotificationListenerService extends FirebaseMessagingService { ^ symbol: class FirebaseMessagingService /Users/rimneshfernandez/work/projects/curation/node_modules/react-native-system-notification/android/src/main/java/io/neson/react/notification/FCMNotificationListenerService.java:22: error: cannot find symbol public void onMessageReceived(RemoteMessage remoteMessage) { ^ symbol: class RemoteMessage location: class FCMNotificationListenerService /Users/rimneshfernandez/work/projects/curation/node_modules/react-native-system-notification/android/src/main/java/io/neson/react/notification/FCMNotificationListenerService.java:34: error: cannot find symbol private void sendNotification(RemoteMessage remoteMessage) { ^ symbol: class RemoteMessage location: class FCMNotificationListenerService /Users/rimneshfernandez/work/projects/curation/node_modules/react-native-system-notification/android/src/main/java/io/neson/react/notification/FCMNotificationListenerService.java:21: error: method does not override or implement a method from a supertype @Override ^ /Users/rimneshfernandez/work/projects/curation/node_modules/react-native-system-notification/android/src/main/java/io/neson/react/notification/FCMNotificationListenerService.java:39: error: cannot find symbol sendOrderedBroadcast(i, null); ^ symbol: method sendOrderedBroadcast(Intent,) location: class FCMNotificationListenerService /Users/rimneshfernandez/work/projects/curation/node_modules/react-native-system-notification/android/src/main/java/io/neson/react/notification/FCMNotificationListenerService.java:64: error: incompatible types: FCMNotificationListenerService cannot be converted to Context NotificationManager nm = new NotificationManager(this); ^ Note: /Users/rimneshfernandez/work/projects/curation/node_modules/react-native-system-notification/android/src/main/java/io/neson/react/notification/NotificationEventReceiver.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /Users/rimneshfernandez/work/projects/curation/node_modules/react-native-system-notification/android/src/main/java/io/neson/react/notification/WritableNativeMap.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 8 errors :react-native-system-notification:compileReleaseJava FAILED

FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 1 mins 3.983 secs Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/android-setup.html

Need Assistance. Thanks in advance

cackharot commented 7 years ago

Any update on this issue?

I'm also facing the same :(

sichacvah commented 7 years ago

Seems not have fcm libraries, try to add follow lines to build.gradle

dependencies {
  ...
  compile 'com.google.firebase:firebase-core:9.+'
  compile 'com.google.firebase:firebase-messaging:9.+'
}
nomanalikhan commented 7 years ago

@sichacvah Tried this no luck :(

mehcode commented 7 years ago

@Neson https://github.com/Neson/react-native-system-notification/pull/60#issuecomment-241163291


Mine works great after adding those two lines. What is your error?

cackharot commented 7 years ago

No luck! :(

Here is the issue:

/opt/project/node_modules/react-native-system-notification/android/src/main/java/io/neson/react/notification/FCMNotificationListenerService.java:9: error: package com.google.firebase.messaging does not exist
import com.google.firebase.messaging.FirebaseMessagingService;
                                    ^
/opt/project/node_modules/react-native-system-notification/android/src/main/java/io/neson/react/notification/FCMNotificationListenerService.java:10: error: package com.google.firebase.messaging does not exist
import com.google.firebase.messaging.RemoteMessage;

And my build.grade:

dependencies {
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile 'com.google.firebase:firebase-core:9.4.0'
    compile 'com.google.firebase:firebase-messaging:9.4.0'
    compile 'com.google.android.gms:play-services-auth:9.4.0' // should be at least 9.0.0
    compile(project(":react-native-google-signin")) {
        exclude group: "com.google.android.gms"
    }
    compile project(':react-native-system-notification')
    compile project(':react-native-fcm')
    compile project(':react-native-config')
}

settings.gradle:

include ':app'
include ':react-native-fcm'
include ':react-native-google-signin'
include ':react-native-config'
include ':react-native-system-notification'

project(':react-native-google-signin').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-google-signin/android')
project(':react-native-system-notification').projectDir = new File(settingsDir, '../node_modules/react-native-system-notification/android')
project(':react-native-fcm').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fcm/android')
project(':react-native-config').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-config/android')
JonesN3 commented 7 years ago

I think you should include firebase libraries in '/opt/project/node_modules/react-native-system-notification/android/build.gradle'?

cackharot commented 7 years ago

Yes it is in android/build.gradle

rimzici commented 7 years ago

solved by adding:

compile 'com.google.firebase:firebase-core:+' compile 'com.google.firebase:firebase-messaging:+' into "project/node_modules/react-native-system-notification/android/build.gradle" after adding as i was getting another Multi-dex related issue, I had to enable multi-dex and app runs without error. But Background Issue Persists. thought in the latest release background issue would have been fixed, But its still there. Launching app from background through clicking custom notification, is not triggering the Notification.addListener('press', function(e) { console.log(e); }); listener.

on using android:launchMode="singleTask" in the manifest file , the app resumes instead of reloading. but the listener not working Someone has solved this issue ?

sichacvah commented 7 years ago

App swiped out or just minimized? If swiped out, react-native-fcm documentation: When app is not running and user clicks notification, notification data will be passed into FCM.initialData

qpowell commented 7 years ago

I just upgraded RN to 0.31 and I'm seeing this issue as well (due to the firebase dependencies). Is there a cleaner way to get this working than to manually update to the build.gradle in the node_modules folder?

jaimecorrea commented 7 years ago

Same issue here... any updates?