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

Illegal State Exception in Production for Android 8.0 using latest master commit #803

Closed
iamarkdev opened this issue Jul 24, 2018 · 13 comments
Labels
bug Stale To test This issue or PR has to be tested

Comments

@iamarkdev
Copy link

Hello!

We're testing out 3.1.1 which doesn't seem to be on NPM just yet. We seem to be getting crashes on version 8.0+ of android in production related to the requestPermission call of the react-native-push-notification's library.

I've attached a screenshot of the crash.

screen shot 2018-07-23 at 6 31 45 pm

@diegolmello
Copy link

I've a similar issue with Oreo.
Running version 3.1.1 on RN 0.56.

07-24 17:52:01.010 4130-4160/? E/unknown:ReactNative: Exception in native call
	java.lang.IllegalStateException: Not allowed to start service Intent { cmp=chat.rocket.reactnative.debug/com.dieam.reactnativepushnotification.modules.RNPushNotificationRegistrationService (has extras) }: app is in background uid UidRecord{b647c53 u0a86 TRNB idle procs:1 seq(0,0,0)}
		at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1505)
		at android.app.ContextImpl.startService(ContextImpl.java:1461)
		at android.content.ContextWrapper.startService(ContextWrapper.java:644)
		at android.content.ContextWrapper.startService(ContextWrapper.java:644)
		at com.dieam.reactnativepushnotification.modules.RNPushNotification.requestPermissions(RNPushNotification.java:115)
		at java.lang.reflect.Method.invoke(Native Method)
		at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
		at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:160)
		at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
		at android.os.Handler.handleCallback(Handler.java:789)
		at android.os.Handler.dispatchMessage(Handler.java:98)
		at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
		at android.os.Looper.loop(Looper.java:164)
		at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
		at java.lang.Thread.run(Thread.java:764)```

@Carl0395
Copy link

put a try catch works for me!
try {
GCMService.putExtra("senderID", senderID);
reactContext.startService(GCMService);
} catch (Exception e) {
Log.d("EXCEPTION SERVICE::::::", "requestPermissions: " + e);
}

in -->
node_modules/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotification.java:115

@diegolmello
Copy link

I opened a PR at wix/react-native-notifications about this.
wix/react-native-notifications#244

Something similar should fix this lib as well.

@Gp2mv3
Copy link
Contributor

Gp2mv3 commented Aug 1, 2018

Can someone test the patch from @diegolmello ? We can merge after that.

@Gp2mv3 Gp2mv3 added bug To test This issue or PR has to be tested labels Aug 1, 2018
Gp2mv3 added a commit that referenced this issue Aug 10, 2018
Fix requestPermissions crash (Issue #803)
@JakeRawr
Copy link

JakeRawr commented Sep 12, 2018

(Issue #803) #809 doesn't seems to solve the problem. It prevented the crash. But I don't think notification are received for 8.0+

we need to have implementation like @diegolmello

@AleXzpm
Copy link

AleXzpm commented Sep 14, 2018

How can we make this work, having the same problem.

@martinzangl-santexgroup

Hi all, any news when this fix would be released? thanks!

@AleXzpm
Copy link

AleXzpm commented Oct 2, 2018

Same here this is a problem on android 8.

@zabkwak
Copy link

zabkwak commented Oct 24, 2018

Hi guys,

it seems the issue disappeared after I put

<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_name" android:value="YOUR NOTIFICATION CHANNEL NAME"/> <meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_description" android:value="YOUR NOTIFICATION CHANNEL DESCRIPTION"/>

into manifest.xml.

Tested just on Android 8.

@martingalovic
Copy link

@zabkwak no it doesn't, mine error log is:

11-02 03:48:27.211  2614  2662 E com.marianhello.logging.UncaughtExceptionLogger: FATAL EXCEPTION: IntentService[RNPushNotification]java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/util/zzx;
11-02 03:48:27.211  2614  2662 E com.marianhello.logging.UncaughtExceptionLogger: 	at com.dieam.reactnativepushnotification.modules.RNPushNotificationRegistrationService.onHandleIntent(RNPushNotificationRegistrationService.java:24)
11-02 03:48:27.217  2614  2662 E AndroidRuntime: FATAL EXCEPTION: IntentService[RNPushNotification]
11-02 03:48:27.217  2614  2662 E AndroidRuntime: 	at com.dieam.reactnativepushnotification.modules.RNPushNotificationRegistrationService.onHandleIntent(RNPushNotificationRegistrationService.java:24)

@zabkwak
Copy link

zabkwak commented Nov 7, 2018

@martingalovic is it related to this issue?
I can't be sure but it seems you're missing some dependencies according to java.lang.NoClassDefFoundError.

@martingalovic
Copy link

@zabkwak already solved it in #910

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Stale To test This issue or PR has to be tested
Projects
None yet
Development

No branches or pull requests

9 participants