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

targetSdkVersion="26" Notifications not received on some android device #114

Closed
eemi2010 opened this issue Sep 27, 2018 · 24 comments
Closed

Comments

@eemi2010
Copy link

eemi2010 commented Sep 27, 2018

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 ?

@yuranevmer
Copy link

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

@frodfigu
Copy link

Same problem here...
Any solution?

@DFoxinator
Copy link
Contributor

Has anyone figured out a solution for this?

@furthurr
Copy link

furthurr commented Oct 26, 2018

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.

captura de pantalla 2018-10-26 a la s 12 02 50

@DFoxinator
Copy link
Contributor

I highly recommend using this plugin: https://github.com/hansemannn/titanium-firebase-cloud-messaging

It works perfectly and no crashes.

@andersdp
Copy link

andersdp commented Nov 6, 2018

Still no news on a fix for this?

Play Store now demands that updates has targetSdkVersion=26 so this is important.

@furthurr
Copy link

furthurr commented Nov 7, 2018

Good news .... there is a new push whit the fix 👍
Merge branch 'feature/oreo'
I am whating for the dist version

@andersdp
Copy link

andersdp commented Nov 7, 2018

Let's hope that someone who can build a new release sees this (today) 🤞

@Jei
Copy link
Contributor

Jei commented Nov 7, 2018

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.

@furthurr
Copy link

furthurr commented Nov 7, 2018

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

@andersdp
Copy link

andersdp commented Nov 7, 2018

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.

@furthurr
Copy link

furthurr commented Nov 7, 2018

do you have ?

// subscribe

TiGoosh.subscribe({
	topic: "/topics/myTopic",
	success: function(e) {
		console.log("unsub done " + e);
	},
	error: function(e){
		console.error("error")
	}
})```

@eemi2010
Copy link
Author

eemi2010 commented Nov 7, 2018

@furthurr So we need to subscribe to a topic now ? Can be anything ?

@furthurr
Copy link

furthurr commented Nov 7, 2018

I think so, I had the same problem that @andersdp says, so this way was solved xD.

@Jei
Copy link
Contributor

Jei commented Nov 7, 2018

@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?

@Jei
Copy link
Contributor

Jei commented Nov 7, 2018

I'm working on a fix (using JobScheduler) here: https://github.com/caffeinalab/ti.goosh/tree/hotfix/android-26-jobservice

@eemi2010
Copy link
Author

eemi2010 commented Nov 7, 2018

@Jei thx for looking into this :) Is there a build available ?

@furthurr
Copy link

furthurr commented Nov 7, 2018

this build have te last modification
ti.goosh-android-4.1.1.zip

@furthurr
Copy link

furthurr commented Nov 8, 2018

this project is compiled with the ti.goosh version that goes up
https://www.youtube.com/watch?v=4b8IyU3YbNU

@eemi2010
Copy link
Author

eemi2010 commented Nov 8, 2018

@furthurr will integrate the build and keep you guyz updated. Thx :)

@yuranevmer
Copy link

yuranevmer commented Nov 20, 2018

Seems that build above doesn't have the latest changes.
Works for me only after I built module manually from ab89be5.
Tested when app is in background mode or closed (Android 8.0).

@Jei
Copy link
Contributor

Jei commented Nov 26, 2018

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.

@Abdelalim-dev
Copy link

Abdelalim-dev commented Nov 27, 2018

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?

@Jei
Copy link
Contributor

Jei commented Nov 27, 2018

I was just waiting for some feedbacks. I think we can consider this issue solved.

@Jei Jei closed this as completed Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants