Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot receive notification after app killed in android #37

Open
notlose opened this issue Jan 29, 2016 · 14 comments
Open

cannot receive notification after app killed in android #37

notlose opened this issue Jan 29, 2016 · 14 comments

Comments

@notlose
Copy link

notlose commented Jan 29, 2016

As title,
i am not sure is it normal behavior or i missed sth?
thanks!

@notlose
Copy link
Author

notlose commented Jan 29, 2016

PS. my app can receive notification while it is closed by pressing home button

@oney
Copy link
Owner

oney commented Jan 29, 2016

Please try TestGcm project first to see whether it works. Make sure to delete other apps that use this module.

@CodeoLTD
Copy link

CodeoLTD commented Feb 2, 2016

I am experiencing a similar problem, I have this app only that uses this module
and yet when I stop the app, it doesn't receive notification.

@shibomb
Copy link

shibomb commented Apr 1, 2016

I have a similar problem on React Native 0.22.

I found a error in my device log below:

Suppressed: java.lang.ClassNotFoundException: com.facebook.react.views.text.ReactTextInlineImageViewManager

In fact, I couldn't find that class in sources of react native 0.22.2.
(Instead, I found a class com.facebook.react.views.textfrescosupport.FrescoBasedReactTextInlineImageViewManager)

Best.

Here is my device log:
04-01 15:14:28.147: I/GCM(6059): GCM message xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 04-01 15:14:28.187: I/art(28464): Late-enabling -Xcheck:jni 04-01 15:14:28.187: I/ActivityManager(1485): Start proc 28464: xxxxxxxxxxxxxxxxxx for broadcast xxxxxxxxxxxxxxxxxxxxxxxx/com.google.android.gms.gcm.GcmReceiver 04-01 15:14:28.329: I/GMPM(28464): App measurement is starting up 04-01 15:14:28.352: D/RNGcmListenerService(28464): sendNotification 04-01 15:14:28.359: D/com.oney.gcm.GcmModule(28464): onReceive 04-01 15:14:28.365: D/BackgroundService(28464): onStartCommand 04-01 15:14:28.414: I/sensors(1485): batch 04-01 15:14:28.414: I/sensors(1485): activate 04-01 15:14:28.421: I/hubconnection(1485): sensorhub said: 'batch 1 flags:0, sampling_rate_Hz:15.00, max_report_latency_us:0' 04-01 15:14:28.421: I/hubconnection(1485): sensorhub said: 'activate 1 enable:1' 04-01 15:14:28.481: E/AndroidRuntime(28464): FATAL EXCEPTION: AsyncTask #2 04-01 15:14:28.481: E/AndroidRuntime(28464): Process: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, PID: 28464 04-01 15:14:28.481: E/AndroidRuntime(28464): java.lang.RuntimeException: An error occurred while executing doInBackground() 04-01 15:14:28.481: E/AndroidRuntime(28464): at android.os.AsyncTask$3.done(AsyncTask.java:309) 04-01 15:14:28.481: E/AndroidRuntime(28464): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354) 04-01 15:14:28.481: E/AndroidRuntime(28464): at java.util.concurrent.FutureTask.setException(FutureTask.java:223) 04-01 15:14:28.481: E/AndroidRuntime(28464): at java.util.concurrent.FutureTask.run(FutureTask.java:242) 04-01 15:14:28.481: E/AndroidRuntime(28464): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 04-01 15:14:28.481: E/AndroidRuntime(28464): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 04-01 15:14:28.481: E/AndroidRuntime(28464): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 04-01 15:14:28.481: E/AndroidRuntime(28464): at java.lang.Thread.run(Thread.java:818) 04-01 15:14:28.481: E/AndroidRuntime(28464): Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/react/views/text/ReactTextInlineImageViewManager; 04-01 15:14:28.481: E/AndroidRuntime(28464): at com.oney.gcm.MainReactPackage.createViewManagers(MainReactPackage.java:64) 04-01 15:14:28.481: E/AndroidRuntime(28464): at com.facebook.react.ReactInstanceManagerImpl.createAllViewManagers(ReactInstanceManagerImpl.java:660) 04-01 15:14:28.481: E/AndroidRuntime(28464): at com.facebook.react.CoreModulesPackage.createNativeModules(CoreModulesPackage.java:63) 04-01 15:14:28.481: E/AndroidRuntime(28464): at com.facebook.react.ReactInstanceManagerImpl.processPackage(ReactInstanceManagerImpl.java:894) 04-01 15:14:28.481: E/AndroidRuntime(28464): at com.facebook.react.ReactInstanceManagerImpl.createReactContext(ReactInstanceManagerImpl.java:811) 04-01 15:14:28.481: E/AndroidRuntime(28464): at com.facebook.react.ReactInstanceManagerImpl.access$700(ReactInstanceManagerImpl.java:104) 04-01 15:14:28.481: E/AndroidRuntime(28464): at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:200) 04-01 15:14:28.481: E/AndroidRuntime(28464): at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:183) 04-01 15:14:28.481: E/AndroidRuntime(28464): at android.os.AsyncTask$2.call(AsyncTask.java:295) 04-01 15:14:28.481: E/AndroidRuntime(28464): at java.util.concurrent.FutureTask.run(FutureTask.java:237) 04-01 15:14:28.481: E/AndroidRuntime(28464): ... 4 more 04-01 15:14:28.481: E/AndroidRuntime(28464): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.react.views.text.ReactTextInlineImageViewManager" on path: DexPathList[[zip file "/data/app/xxxxxxxxxxxxxxxxxxxxxx-2/base.apk"],nativeLibraryDirectories=[/data/app/xxxxxxxxxxxxxxxxxxxxxxxx-2/lib/arm, /data/app/xxxxxxxxxxxxxxxxxxxxxx-2/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]] 04-01 15:14:28.481: E/AndroidRuntime(28464): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) 04-01 15:14:28.481: E/AndroidRuntime(28464): at java.lang.ClassLoader.loadClass(ClassLoader.java:511) 04-01 15:14:28.481: E/AndroidRuntime(28464): at java.lang.ClassLoader.loadClass(ClassLoader.java:469) 04-01 15:14:28.481: E/AndroidRuntime(28464): ... 14 more 04-01 15:14:28.481: E/AndroidRuntime(28464): Suppressed: java.lang.ClassNotFoundException: com.facebook.react.views.text.ReactTextInlineImageViewManager 04-01 15:14:28.481: E/AndroidRuntime(28464): at java.lang.Class.classForName(Native Method) 04-01 15:14:28.481: E/AndroidRuntime(28464): at java.lang.BootClassLoader.findClass(ClassLoader.java:781) 04-01 15:14:28.481: E/AndroidRuntime(28464): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) 04-01 15:14:28.481: E/AndroidRuntime(28464): at java.lang.ClassLoader.loadClass(ClassLoader.java:504) 04-01 15:14:28.481: E/AndroidRuntime(28464): ... 15 more 04-01 15:14:28.481: E/AndroidRuntime(28464): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

@shibomb
Copy link

shibomb commented Apr 1, 2016

More info:
I commented out com.facebook.react.views.text.ReactTextInlineImageViewManager in com.oney.gcm.MainReactPackage.java
It works.

Best.

@john1jan
Copy link

john1jan commented Apr 1, 2016

I am also getting the same error, when i kill the app and send Push notification..
* Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/react/views/text/ReactTextInlineImageViewManager;*

java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:304) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818) Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/react/views/text/ReactTextInlineImageViewManager; at com.oney.gcm.MainReactPackage.createViewManagers(MainReactPackage.java:64) at com.facebook.react.ReactInstanceManagerImpl.createAllViewManagers(ReactInstanceManagerImpl.java:660) at com.facebook.react.CoreModulesPackage.createNativeModules(CoreModulesPackage.java:63) at com.facebook.react.ReactInstanceManagerImpl.processPackage(ReactInstanceManagerImpl.java:894) at com.facebook.react.ReactInstanceManagerImpl.createReactContext(ReactInstanceManagerImpl.java:811) at com.facebook.react.ReactInstanceManagerImpl.access$700(ReactInstanceManagerImpl.java:104) at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:200) at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:183) at android.os.AsyncTask$2.call(AsyncTask.java:292) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)  at java.lang.Thread.run(Thread.java:818)  Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.react.views.text.ReactTextInlineImageViewManager" on path: DexPathList[[zip file "/data/app/com.hero_app_rn-1/base.apk"],nativeLibraryDirectories=[/data/app/com.hero_app_rn-1/lib/arm, /vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) at com.oney.gcm.MainReactPackage.createViewManagers(MainReactPackage.java:64)  at com.facebook.react.ReactInstanceManagerImpl.createAllViewManagers(ReactInstanceManagerImpl.java:660)  at com.facebook.react.CoreModulesPackage.createNativeModules(CoreModulesPackage.java:63)  at com.facebook.react.ReactInstanceManagerImpl.processPackage(ReactInstanceManagerImpl.java:894)  at com.facebook.react.ReactInstanceManagerImpl.createReactContext(ReactInstanceManagerImpl.java:811)  at com.facebook.react.ReactInstanceManagerImpl.access$700(ReactInstanceManagerImpl.java:104)  at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:200)  at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:183)  at android.os.AsyncTask$2.call(AsyncTask.java:292)  at java.util.concurrent.FutureTask.run(FutureTask.java:237)  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)  at java.lang.Thread.run(Thread.java:818)  Suppressed: java.lang.ClassNotFoundException: com.facebook.react.views.text.ReactTextInlineImageViewManager at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 15 more

@ianwang
Copy link

ianwang commented Apr 10, 2016

got the same error on Nexus 5, 6.0.1, RN 0.22.2

AndroidRuntime: Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/react/views/text/ReactTextInlineImageViewManager;
AndroidRuntime:     at com.oney.gcm.MainReactPackage.createViewManagers(MainReactPackage.java:64)

@cmcewen
Copy link

cmcewen commented Apr 12, 2016

This is expected behavior for Android apparently: http://stackoverflow.com/questions/20838415/gcm-push-notification-works-after-app-force-stop

@rkostrab
Copy link

rkostrab commented May 15, 2016

I have the same problem. When app is put in background, notifications are working fine but when app is closed, background service crashes.
I did the same as @shibomb and notifications are working, but immediately crashing after system notification shows. I also commented out lines:

mReactInstanceManager.onPause();
mReactInstanceManager.onDestroy();

in BackgroundService.java.

OR

comment out:

GcmAndroid.stopService();

@jlugner
Copy link

jlugner commented May 22, 2016

Getting the exact same error. Running on RN 0.25.1. Any fixes or updates for this?

edit: Following @shibomb and commenting out the import and use of ReactTextInlineImageViewManager seems to work. Feels a bit risky though. @oney, is this a viable short-term fix?

@john1jan
Copy link

I found one solution. You have to add all the react packages you have added in MainActivity in com.oney.gcm.BackgroundService.java.

@pmadruga
Copy link

@shibomb your solution works. +1.

Note: You also need to comment new ReactTextInlineImageViewManager() down below in the same file.
Info: RN 0.25

@dattran92
Copy link

Any update for this problem? I'm getting this in my project.

@sampurcell93
Copy link

@dattran92 did you try @shibomb's solution above?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests