OneSignal with targetSdkVersion=26 getting error Background start not allowed: service Intent { cmp=***/com.onesignal.GcmIntentService(has extras) }

@troylyndon Thank you! I’ve also written a private message to https://forums.coronalabs.com/user/496106-josh-onesignal/

that it’s a member of onesignal

You might also want to look at PlayFab and/or GameSparks. I believe they both support sending push notifications. 

What might also be helpful is to understand how you’re using push notifications.

One common use, for instance, is a news organization would use a service like PushWoosh or Urban Airship to log in, write the text for a push, provide a URL to a story and blast that out to all app users. The push would arrive at the app and if interacted with, bring the app to the foreground and if reasonable, deep link to the article.

Turn-based games on the other hand, will send a message to the game server indicating that the player has completed the turn and the game server will send a targeted push to the other player. If the player is active, usually the game server will transmit the message. If the app is in the background a push notification would let the user interact with it and bring the game to the foreground and process the turn.

I’m sure there are other uses which is why I think it would be helpful to know how you plan to use push in your apps?

Gamespark does and here is my cloud code for OneSignal:

function SendNewNotification() { var jsonBody = { app\_id: "\<OneSignalAppId\>", filters: [{"field": "tag", "key": "gsUserId", "relation": "=", "value": \<PlayerId\>}], contents: {en:\<textForEngish\>, es:\<Optional: other language text in this case Spanish\>}, }; var response = Spark.getHttp("https://onesignal.com/api/v1/notifications").setHeaders({ "Content-Type": "application/json;charset=utf-8", "Authorization": "Basic \<service api key from OneSignal\>" }).postJson(jsonBody); return response; } var response = SendNewNotification().getResponseJson();

Also, I believe the easiest approach would be to keep using OneSignal but use their REST api instead of the SDK until they fix the issue. At least that is what I plan to do with my latest version. I’ll post the code shortly. Just seems like an easier path for me rather than working on a new plugin.

Sorry for the delay on this, we are looking into updating the OneSignal plugin in the coming weeks for Android Oreo 8 compatibility. This will fix the IllegalStateException crash that are showing up.

In the mean time there are 2 work arounds that can be done;

  1. Use Corona SDK version 3325 or older. This sets targetSdkVersion to 25 to work around this issue.  This only works if you are updating existing apps already released on the Google Play Store. The Google Play Console won’t let you create new apps with targetSdkVersion lower than 26.

  2. Use the latest OneSignal Android Native SDK with Corona Native; This doesn’t come with any Lua bindings so you will need to initialize the SDK and use it’s methods through Java or Kotlin. However this native SDK has already been updated to support Android Oreo and works with Android Pie as well. See the OneSignal Android SDK Setup to add this to your native project.

  3. Switch to using plugin.notifications.v2 and OneSignal’s REST API based methods. Corona developer @agramonte has a nice functional library you can use now. https://forums.coronalabs.com/topic/73652-onesignal-android/

As promised here it is. By the way Agramonte == adrianjgomez. I can’t build with Agramonte anymore because of some issue with my Id.

https://forums.coronalabs.com/topic/73652-onesignal-android/

Thank you Josh!!!

@Josh, we only use minSdkVersion = 21. According to your first work around, we should set targetSdkVersion. However, if we do that, will it shut-down our Android 8 specific code and plugins? If so, then this work around will not work.

Since topic is on fire i marked it unresolved. Let’s wait for new OneSignal Plugin for Corona. 

New apps have to use Android 26 or later. This went into effect August 1st. This requires using Corona version 3326 or later.

Updated apps can use older versions of Android until November 1st. If you’re updating an app, you can use a version prior to 3326 for a couple more months. Due to fixes in various Google Vitals checks, you would want to use a build as close to 3326 as you can.

Rob

+1 We are in the process of incorporating oneSignal into our new game… 

To confirm - all the issues people are having is only with Android, but the plugin is working fine for iOS? 

I know some Android features can be used even if targetSdkVersion is lower then when they are introduced. Depends if on both the API and how the plugin is handing this if this will be an issue or not.

Hi,

any news about plugin update?

Hi,

any news about plugin update?

Pleaseeeeeeeeee

I’m another one who relies on OneSignal for Push notifications.  I’m about to release a new game, but unfortunately can’t until this is resolved.  

Any news on the plugin update would be very welcome.

This situation is very frustrating!
Because I need a pligin update to release a new version!!
 

If this is holding you up, you could consider switching to their REST API based methods. Corona developer @agramonte has a nice functional library you can use now. 

https://forums.coronalabs.com/topic/73652-onesignal-android/

I’m not sure how much work is involved in switching as I don’t use OneSignal.

Rob 

We have been making progress on updating the OneSignal Corona SDK to support Android Oreo this week. Depending how it progresses it should be released in about a week or 2 from now.

If you can’t wait I have condensed all 3 possible work arounds into one response here;

https://forums.coronalabs.com/topic/72988-onesignal-with-targetsdkversion26-getting-error-background-start-not-allowed-service-intent-cmpcomonesignalgcmintentservicehas-extras/?p=387712

Thanks.

@Josh, is the new OneSignal plugin to fix the crash associated with Android 8+ resolved yet?

Any updates on the plugin update?  I’m ready to release my new app.  Just waiting for this update

Josh, I tried the third option using the rest API.  Worked great for iOS and Android but can’t get it to work for Amazon.  I can register the device ok but as soon as I send a test push notification, it unsubscribes me on the portal and no notification is shown on device.