Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

OneSignal with targetSdkVersion=26 getting error Background start not allowed: service Intent { cmp=***/com.onesignal.GcmIntentService(has extras) }
Started by p.kanarek Jun 12 2018 07:56 AM

70 replies to this topic
onesignal gcmintentservice targetsdkversion push
[TOPIC CONTROLS]
Page 3 of 3 1 2 3
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#51

Gent

[GLOBAL: userInfoPane.html]
Gent
  • Observer

  • 6 posts
  • Corona SDK

Now i can install apk but when i try to run i got error:

 

09-28 12:11:17.253 22376 22408 V Corona  : > Class.forName: OneSignal.LuaLoader
09-28 12:11:17.253 22376 22408 I Corona  : WARNING: Could not load class 'OneSignal.LuaLoader'
09-28 12:11:17.255 22376 22408 I Corona  : ERROR: Runtime error
09-28 12:11:17.255 22376 22408 I Corona  : /Users/jenkins/slaveroot/workspace/Templates/label/android/platform/resources/init.lua:913: module 'OneSignal' not found:resource (OneSignal.lu) does not exist in archive
09-28 12:11:17.255 22376 22408 I Corona  :     no field package.preload['OneSignal']
09-28 12:11:17.255 22376 22408 I Corona  :     no file '(null)/OneSignal.lua'
09-28 12:11:17.255 22376 22408 I Corona  :     no file '(null)/OneSignal.lua'
09-28 12:11:17.255 22376 22408 I Corona  :     no file '/data/app/ru.gmsoft.magazines.skanword_zaika_moya-2/lib/arm/libOneSignal.so'
09-28 12:11:17.255 22376 22408 I Corona  :     no file './OneSignal.so'
09-28 12:11:17.255 22376 22408 I Corona  :     no file '(null)/OneSignal.so'
09-28 12:11:17.255 22376 22408 I Corona  :     no file '/data/app/ru.gmsoft.magazines.skanword_zaika_moya-2/lib/arm/libOneSignal.so'
09-28 12:11:17.255 22376 22408 I Corona  :     no file './OneSignal.so'
09-28 12:11:17.255 22376 22408 I Corona  :     no file '(null)/OneSignal.so'
09-28 12:11:17.255 22376 22408 I Corona  : stack traceback:
09-28 12:11:17.255 22376 22408 I Corona  :     [C]: in function 'require'
09-28 12:11:17.255 22376 22408 I Corona  :     /Users/jenkins/slaveroot/workspace/Templates/label/android/platform/resources/init.lua:913: in function 'require'
09-28 12:11:17.255 22376 22408 I Corona  :     /Users/Kasten/Documents/OneSignal/GameThrive/SDK/Corona/SDK/android/../shared/plugin_OneSignal.lua:17: in main chunk
09-28 12:11:17.255 22376 22408 I Corona  :     [C]: ?
09-28 12:11:17.255 22376 22408 I Corona  :     [C]: in function 'require'
09-28 12:11:17.255 22376 22408 I Corona  :     /Users/jenkins/slaveroot/workspace/Templates/label/android/platform/resources/init.lua:913: in function 'require'
09-28 12:11:17.255 22376 22408 I Corona  :     ?: in main

 



[TOPIC: post.html]
#52

akao

[GLOBAL: userInfoPane.html]
akao
  • Contributor

  • 336 posts
  • Corona SDK

@Gent I am assuming you added it to your build settings? 



[TOPIC: post.html]
#53

akao

[GLOBAL: userInfoPane.html]
akao
  • Contributor

  • 336 posts
  • Corona SDK

I spoke too soon. It looks like my latest build from a few hours ago, and also the build that I just tried now have the same error. Something about the build is broken, but I don't see any error messages during the build process itself.

 

Earlier today it was working..

 

@josh_OneSignal - can you help? 



[TOPIC: post.html]
#54

Gent

[GLOBAL: userInfoPane.html]
Gent
  • Observer

  • 6 posts
  • Corona SDK

@akao yes, it worked before.



[TOPIC: post.html]
#55

fixr

[GLOBAL: userInfoPane.html]
fixr
  • Observer

  • 18 posts
  • Corona SDK

But, in the market, the plugin it's not updated? I have the problem when install apk.
"OneSignal.lua does not exist in archive" (View Attached file)

 

CORONA BUILD Corona 2018.3386

 

https://marketplace.coronalabs.com/corona-plugins/onesignal
Last updated

Apr 03 2018

 

I have tested another version of Corona build (Corona-2018.3325) and now the app crash when opened!!!!

Attached Files



[TOPIC: post.html]
#56

josh_OneSignal

[GLOBAL: userInfoPane.html]
josh_OneSignal
  • Enthusiast

  • 55 posts
  • Corona SDK

Sorry for the recent issues. We made a 2nd package rename to Java classes part of our plugin to fix the INSTALL_PARSE_FAILED_MANIFEST_MALFORMED error some of you were seeing on Android 4.x devices. However it caused the the entry point of our SDK to no longer be found by Corona as it was looking for the original name. Causing the "Could not load class 'OneSignal.LuaLoader'" error.

 

We put back our Java package names for our .java files which will fix both these issues. This is just a pathing of our files, all changes we made for Android Oreo are still part of the release.

 

We just pushed a release so it should be available in the next few hours. Thanks for your patience!



[TOPIC: post.html]
#57

akao

[GLOBAL: userInfoPane.html]
akao
  • Contributor

  • 336 posts
  • Corona SDK

@josh_OneSignal seems to be working for me now. thx!



[TOPIC: post.html]
#58

fixr

[GLOBAL: userInfoPane.html]
fixr
  • Observer

  • 18 posts
  • Corona SDK

Thank you @josh_OneSignal No error! All working now!



[TOPIC: post.html]
#59

zdmitrynsk

[GLOBAL: userInfoPane.html]
zdmitrynsk
  • Observer

  • 29 posts
  • Corona SDK

Hello again.

The fix from josh_OneSignal helped me. But i alse have another error in google play console. It is partially similar to the error from this topic.It also occurs only in the android 8. It appears along with an error from this topic. 

 

Is it possible that this error is related to OneSignal?

Or can someone faced with this problem and has a solution?

java.lang.IllegalStateException
android.app.ContextImpl.startServiceCommon

java.lang.RuntimeException: 
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:3399)
  at android.app.ActivityThread.-wrap18 (Unknown Source)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1780)
  at android.os.Handler.dispatchMessage (Handler.java:105)
  at android.os.Looper.loop (Looper.java:164)
  at android.app.ActivityThread.main (ActivityThread.java:6940)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
Caused by: java.lang.IllegalStateException: 
  at android.app.ContextImpl.startServiceCommon (ContextImpl.java:1538)
  at android.app.ContextImpl.startService (ContextImpl.java:1484)
  at android.content.ContextWrapper.startService (ContextWrapper.java:663)
  at android.content.ContextWrapper.startService (ContextWrapper.java:663)
  at com.ansca.corona.SystemStartupBroadcastReceiver.onReceive (SystemStartupBroadcastReceiver.java:29)
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:3392)


[TOPIC: post.html]
#60

naveen_pcs

[GLOBAL: userInfoPane.html]
naveen_pcs
  • Contributor

  • 260 posts
  • Corona SDK

I get the same error. Pretty sure it’s onesignal since I can see the spike on the play dashboard on the days I send out push notifications. Also seems to happen on Samsung devices more often.

[TOPIC: post.html]
#61

josh_OneSignal

[GLOBAL: userInfoPane.html]
josh_OneSignal
  • Enthusiast

  • 55 posts
  • Corona SDK

@zdmitrynsk The crash contains the Corona Notifications plugin not OneSignal so this is something they will need to look into.

at com.ansca.corona.SystemStartupBroadcastReceiver.onReceive (SystemStartupBroadcastReceiver.java:29)

@Rob Miracle Any ideas what is causing the crash here? Looks like Corona this is from boot up? Maybe from a android.intent.action.BOOT_COMPLETED event?



[TOPIC: post.html]
#62

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,853 posts
  • Corona Staff

I'll ask Engineering.



[TOPIC: post.html]
#63

p.kanarek

[GLOBAL: userInfoPane.html]
p.kanarek
  • Observer

  • 19 posts
  • Corona SDK

Hi, I've updated plugin and now i'm having crash on Android when application go into suspended state.That's my call stack: 
 

 I/Corona:  core 142:    suspended   
 E/AndroidRuntime: FATAL EXCEPTION: FocusHandlerThread
  Process: com.adb.android.app.myapp, PID: 23761
  java.lang.IllegalArgumentException: No such service ComponentInfo{com.adb.android.app.myapp/com.onesignal.SyncJobService}
      at android.os.Parcel.readException(Parcel.java:1947)
      at android.os.Parcel.readException(Parcel.java:1889)
      at android.app.job.IJobScheduler$Stub$Proxy.schedule(IJobScheduler.java:180)
      at android.app.JobSchedulerImpl.schedule(JobSchedulerImpl.java:44)
      at com.onesignal.OneSignalSyncServiceUtils.scheduleSyncServiceAsJob(OneSignalSyncServiceUtils.java:137)
      at com.onesignal.OneSignalSyncServiceUtils.scheduleSyncTask(OneSignalSyncServiceUtils.java:113)
      at com.onesignal.OneSignalSyncServiceUtils.scheduleSyncTask(OneSignalSyncServiceUtils.java:60)
      at com.onesignal.OneSignal.onAppLostFocus(OneSignal.java:1089)
      at com.onesignal.ActivityLifecycleHandler$AppFocusRunnable.run(ActivityLifecycleHandler.java:171)
      at android.os.Handler.handleCallback(Handler.java:789)
      at android.os.Handler.dispatchMessage(Handler.java:98)
      at android.os.Looper.loop(Looper.java:171)
      at android.os.HandlerThread.run(HandlerThread.java:65)

first recognizable call is from OneSignal.onAppLostFocus() method, do you have any ideas how to deal with it?

Bug happens when i stay 2 seconds or longer on native.showPopup from code below, but when i close alert fast enough then bug dosn't appear. Any ideas? 

local permissionOptions =
{
	appPermission = "android.permission.READ_PHONE_STATE",
	urgency = "Critical",
	listener = function(e) 
	end,
	rationaleTitle = "Lorem ipsum",
	rationaleDescription = "Lorem ipsum",
	settingsRedirectTitle = "Lorem ipsum",
	settingsRedirectDescription = "Lorem ipsum"
}
native.showPopup( "requestAppPermission", permissionOptions )

I've also updated Corona from 3.178 to 3.408.



[TOPIC: post.html]
#64

p.kanarek

[GLOBAL: userInfoPane.html]
p.kanarek
  • Observer

  • 19 posts
  • Corona SDK

Fixed! I've realized that bug was only on android 8+, so i changed my target sdkVersion to 28 and changed dependencies in gradle file to look for version 28.0.0. And bug is gone.

dependencies {

   ....
   implementation 'com.android.support:support-annotations:28.0.0'

}



[TOPIC: post.html]
#65

karpovpw

[GLOBAL: userInfoPane.html]
karpovpw
  • Contributor

  • 251 posts
  • Corona Staff

@josh_OneSignal @naveen_pcs @zdmitrynsk 

Just in case, "com.ansca.corona.SystemStartupBroadcastReceiver" is explained in the AndroidManifest.xml file in all of the sample projects for Corona Native users.

<!-- Receiver which automatically starts this application after the Android device starts up. This is needed to show this application's active status bar notifications and reschedule pending notifications after the device boots up, because they will only be shown if the app is running. This receiver only works if the "android.permission.RECEIVE_BOOT_COMPLETED" permission has been set. -->

What that broadcast receiver does is start up a Corona app in the background when the Android device finishes booting up. This should be used by apps that support local/push notifications because the app's notifications will only be shown on the Android status bar if the app is running in the background. That is, if you force quit the app, then all of its notifications in the status bar will disappear. This is standard Android behavior. Starting up an app in the background on boot-up is normal for apps that display notifications, such as the standard Gmail app.
 

Now, a Corona app will not be started in the background on boot-up by default. You have to opt into it by adding Android permission "android.permission.RECEIVE_BOOT_COMPLETED" to your AndroidManifest.xml file... or to your "build.settings" if you are a Corona Simulator user. Otherwise, this broadcast receiver will be ignored by the Android OS.

Can't say anything about an error right now though, looks like some manufacturers (Samsung specifically) changed notification logic in Android 8 or something, we'll look into it asap. Can't reproduce an issue straight away, but stay tuned!



[TOPIC: post.html]
#66

naveen_pcs

[GLOBAL: userInfoPane.html]
naveen_pcs
  • Contributor

  • 260 posts
  • Corona SDK

Any updates on this?



[TOPIC: post.html]
#67

karpovpw

[GLOBAL: userInfoPane.html]
karpovpw
  • Contributor

  • 251 posts
  • Corona Staff

Actually, yes!

We've found inconsistencies in the new Android notification system. Our engineers are working on the solution, but I can't give you an ETA for now, stay tuned!



[TOPIC: post.html]
#68

naveen_pcs

[GLOBAL: userInfoPane.html]
naveen_pcs
  • Contributor

  • 260 posts
  • Corona SDK

Actually, yes!

We've found inconsistencies in the new Android notification system. Our engineers are working on the solution, but I can't give you an ETA for now, stay tuned!

 

Awesome, great to hear!!



[TOPIC: post.html]
#69

naveen_pcs

[GLOBAL: userInfoPane.html]
naveen_pcs
  • Contributor

  • 260 posts
  • Corona SDK

Any updates in the last couple weeks?



[TOPIC: post.html]
#70

karpovpw

[GLOBAL: userInfoPane.html]
karpovpw
  • Contributor

  • 251 posts
  • Corona Staff

No news dor now, we are still looking into it.

[TOPIC: post.html]
#71

p.kanarek

[GLOBAL: userInfoPane.html]
p.kanarek
  • Observer

  • 19 posts
  • Corona SDK

I've got some more errors with applications built by Corona Native that contains OneSignal plugin on Android 8. 

Bug occurred when i minimalized the application to background (by pressing home button on device)

To solve this i compared Manifest from Corona Native build and Manifest generated by Corona Simulator build (from the same code) and i noticed that some tags were only present in manifest generated from CoronaSimulator build: 
 

<service android:name="com.onesignal.NotificationRestoreService"/>
<service android:name="com.onesignal.GcmIntentJobService" android:permission="android.permission.BIND_JOB_SERVICE"/>
<service android:name="com.onesignal.RestoreJobService" android:permission="android.permission.BIND_JOB_SERVICE"/>
<service android:name="com.onesignal.RestoreKickoffJobService" android:permission="android.permission.BIND_JOB_SERVICE"/>
<service android:name="com.onesignal.SyncJobService" android:permission="android.permission.BIND_JOB_SERVICE"/>

When i added them to my manifest i could finally minimalize my app without errors. 

BTW documentation about setup OneSignal plugin on https://documentation.onesignal.com/docs/corona-sdk-setup  is slightly deprecated. I suggest you to update them.

For example: there is still note about adding plugins from DailyBuilds server or about adding deprecated google-play-services_lib. 




[topic_controls]
Page 3 of 3 1 2 3
 
[/topic_controls]

Also tagged with one or more of these keywords: onesignal, gcmintentservice, targetsdkversion, push