Closed eemi2010 closed 5 years ago
Same issue with receiving notifications in background on Android 8.
0-02 11:48:44.700 1969 3885 W ActivityManager: Background start not allowed: service Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x1000010 pkg=ua.com.mhp.agro.dev cmp=ua.com.mhp.agro.dev/ti.goosh.IntentService (has extras) } to ua.com.mhp.agro.dev/ti.goosh.IntentService from pid=14856 uid=10165 pkg=ua.com.mhp.agro.dev
10-02 11:48:44.704 14856 14856 D AndroidRuntime: Shutting down VM
10-02 11:48:44.706 3263 3263 W GCM : broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=ua.com.mhp.agro.dev (has extras) }
10-02 11:48:44.717 14856 14856 E AndroidRuntime: FATAL EXCEPTION: main
10-02 11:48:44.717 14856 14856 E AndroidRuntime: Process: ua.com.mhp.agro.dev, PID: 14856
10-02 11:48:44.717 14856 14856 E AndroidRuntime: java.lang.RuntimeException: Unable to start receiver ti.goosh.BroadcastReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x1000010 pkg=ua.com.mhp.agro.dev cmp=ua.com.mhp.agro.dev/ti.goosh.IntentService (has extras) }: app is in background uid UidRecord{9df5545 u0a165 RCVR bg:+1m2s763ms idle change:uncached procs:1 seq(0,0,0)}
10-02 11:48:44.717 14856 14856 E AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:3228)
10-02 11:48:44.717 14856 14856 E AndroidRuntime: at android.app.ActivityThread.-wrap17(Unknown Source:0)
10-02 11:48:44.717 14856 14856 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
10-02 11:48:44.717 14856 14856 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
10-02 11:48:44.717 14856 14856 E AndroidRuntime: at android.os.Looper.loop(Looper.java:171)
10-02 11:48:44.717 14856 14856 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6633)
10-02 11:48:44.717 14856 14856 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
10-02 11:48:44.717 14856 14856 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
10-02 11:48:44.717 14856 14856 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
10-02 11:48:44.717 14856 14856 E AndroidRuntime: Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x1000010 pkg=ua.com.mhp.agro.dev cmp=ua.com.mhp.agro.dev/ti.goosh.IntentService (has extras) }: app is in background uid UidRecord{9df5545 u0a165 RCVR bg:+1m2s763ms idle change:uncached procs:1 seq(0,0,0)}
10-02 11:48:44.717 14856 14856 E AndroidRuntime: at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1531)
10-02 11:48:44.717 14856 14856 E AndroidRuntime: at android.app.ContextImpl.startService(ContextImpl.java:1487)
10-02 11:48:44.717 14856 14856 E AndroidRuntime: at android.content.ContextWrapper.startService(ContextWrapper.java:660)
10-02 11:48:44.717 14856 14856 E AndroidRuntime: at android.content.ContextWrapper.startService(ContextWrapper.java:660)
10-02 11:48:44.717 14856 14856 E AndroidRuntime: at android.support.v4.content.WakefulBroadcastReceiver.startWakefulService(WakefulBroadcastReceiver.java:99)
10-02 11:48:44.717 14856 14856 E AndroidRuntime: at ti.goosh.BroadcastReceiver.onReceive(BroadcastReceiver.java:32)
10-02 11:48:44.717 14856 14856 E AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:3221)
10-02 11:48:44.717 14856 14856 E AndroidRuntime: ... 8 more
Same problem here... Any solution?
Has anyone figured out a solution for this?
Google changed notifications settings ... the notifications in Sdk 26 (android 8) stopped working, the problem is in channel, I think we need to wait for an update of ti.goosh.
I highly recommend using this plugin: https://github.com/hansemannn/titanium-firebase-cloud-messaging
It works perfectly and no crashes.
Still no news on a fix for this?
Play Store now demands that updates has targetSdkVersion=26 so this is important.
Good news .... there is a new push whit the fix 👍 Merge branch 'feature/oreo' I am whating for the dist version
Let's hope that someone who can build a new release sees this (today) 🤞
We've merged that fix to try and make the module work with Android Oreo, but there are still things to do. As stated in this comment, there's been radical changes in the way Android handles services. You can find the details here: https://developer.android.com/about/versions/oreo/background. Basically, methods like "GcmReceiver.startWakefulService()" will throw exception when they are called while the app is closed or flagged as "in background". This means that the current master of Ti.Goosh doesn't show notifications in those cases. We're trying to migrate the module to the Firebase library to solve these issues.
I have compiled the module ... ti.goosh-android-4.1.1.zip I am testing android 8 and 7 (sdk 25,26) and i have problem with the custom sound on android 8 ... and i have only this issue
The good news: This fix solves getting push when app is backgrounded.
Bad news: The push does not show up when the app is dead. Furthermore our app stalls and eventually crashes when starting up from dead after having sent a push to the device.
do you have ?
// subscribe
TiGoosh.subscribe({
topic: "/topics/myTopic",
success: function(e) {
console.log("unsub done " + e);
},
error: function(e){
console.error("error")
}
})```
@furthurr So we need to subscribe to a topic now ? Can be anything ?
I think so, I had the same problem that @andersdp says, so this way was solved xD.
@furthurr It seems unlikely that subscribing to a topic solves the problem of creating a background service from a backgrounded app. Have you tried sending a notification to the app while it's closed? Is the notification displayed in the tray?
I'm working on a fix (using JobScheduler) here: https://github.com/caffeinalab/ti.goosh/tree/hotfix/android-26-jobservice
@Jei thx for looking into this :) Is there a build available ?
this build have te last modification ti.goosh-android-4.1.1.zip
this project is compiled with the ti.goosh version that goes up https://www.youtube.com/watch?v=4b8IyU3YbNU
@furthurr will integrate the build and keep you guyz updated. Thx :)
Seems that build above doesn't have the latest changes. Works for me only after I built module manually from ab89be5d2937caa1d2caf1fb5da1f8f9adb69239. Tested when app is in background mode or closed (Android 8.0).
We've just released a new version of Ti.Goosh that should solve this problem. You can find it here. Let us know if you're still experiencing the same problem with Ti.Goosh 4.2.0.
I tried the new version (4.2.0) and it worked just fine on Android 9. PS: @Jei , why is this issue still opened BTW?
I was just waiting for some feedbacks. I think we can consider this issue solved.
If the app target targetSdkVersion="26". Notifications wont be displayed on Android devices running android 8. I think this is due to how application in the background should handle notifications. Could you please check ?