-
Notifications
You must be signed in to change notification settings - Fork 765
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
Use JobIntentService over IntentService #491
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
The issue has been closed for inactivity. |
yogevbd
pushed a commit
that referenced
this pull request
Sep 23, 2020
…background (#678) ### Highlights - Changes the mechanism by which the library fetches the FCM token in the background. ### Context In newer Android versions (8+), background applications cannot start `IntentService`'s. Using the notifications library in these newer Android versions will result in a lot of exceptions of the type `java.lang.IllegalStateException`. Sample stack trace: ``` java.lang.IllegalStateException: at android.app.ContextImpl.startServiceCommon (ContextImpl.java:1522) at android.app.ContextImpl.startService (ContextImpl.java:1478) at android.content.ContextWrapper.startService (ContextWrapper.java:650) at com.wix.reactnativenotifications.RNNotificationsModule.startFcmIntentService (RNNotificationsModule.java:135) at com.wix.reactnativenotifications.RNNotificationsModule.initialize (RNNotificationsModule.java:50) at com.facebook.react.bridge.ModuleHolder.doInitialize (ModuleHolder.java:222) at com.facebook.react.bridge.ModuleHolder.markInitializable (ModuleHolder.java:97) at com.facebook.react.bridge.NativeModuleRegistry.notifyJSInstanceInitialized (NativeModuleRegistry.java:102) at com.facebook.react.bridge.CatalystInstanceImpl$2.run (CatalystInstanceImpl.java:441) at android.os.Handler.handleCallback (Handler.java:790) at android.os.Handler.dispatchMessage (Handler.java:99) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:26) at android.os.Looper.loop (Looper.java:164) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:225) at java.lang.Thread.run (Thread.java:764) ``` Now, in order to start intents in the background, the `JobIntentService` class must be extended. This PR consists in basically the same changes proposed by @migbot in #491 (this PR was closed for inactivity a few months ago). Should close #671;
mburmistrov
pushed a commit
to mburmistrov/react-native-notifications
that referenced
this pull request
Jan 10, 2021
…background (wix#678) ### Highlights - Changes the mechanism by which the library fetches the FCM token in the background. ### Context In newer Android versions (8+), background applications cannot start `IntentService`'s. Using the notifications library in these newer Android versions will result in a lot of exceptions of the type `java.lang.IllegalStateException`. Sample stack trace: ``` java.lang.IllegalStateException: at android.app.ContextImpl.startServiceCommon (ContextImpl.java:1522) at android.app.ContextImpl.startService (ContextImpl.java:1478) at android.content.ContextWrapper.startService (ContextWrapper.java:650) at com.wix.reactnativenotifications.RNNotificationsModule.startFcmIntentService (RNNotificationsModule.java:135) at com.wix.reactnativenotifications.RNNotificationsModule.initialize (RNNotificationsModule.java:50) at com.facebook.react.bridge.ModuleHolder.doInitialize (ModuleHolder.java:222) at com.facebook.react.bridge.ModuleHolder.markInitializable (ModuleHolder.java:97) at com.facebook.react.bridge.NativeModuleRegistry.notifyJSInstanceInitialized (NativeModuleRegistry.java:102) at com.facebook.react.bridge.CatalystInstanceImpl$2.run (CatalystInstanceImpl.java:441) at android.os.Handler.handleCallback (Handler.java:790) at android.os.Handler.dispatchMessage (Handler.java:99) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:26) at android.os.Looper.loop (Looper.java:164) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:225) at java.lang.Thread.run (Thread.java:764) ``` Now, in order to start intents in the background, the `JobIntentService` class must be extended. This PR consists in basically the same changes proposed by @migbot in wix#491 (this PR was closed for inactivity a few months ago). Should close wix#671;
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Maybe fixes #217 ?
Because of background service limitations introduced in Android 8.0, functionality that relies on IntentService may not work properly. At Mattermost we starting seeing a high amount of the following exception:
While I wasn't able to reproduce, it seems that the IntentService is not playing nice with the background limitations mentioned above. We're applying these changes in a patch but I thought I'd open a PR here as well.