fanhero / ti.goosh

Google Cloud Messaging module.
MIT License
1 stars 0 forks source link

Android Oreo support #5

Open ianko opened 6 years ago

ianko commented 6 years ago

The Android 8 introduced the notification channels https://developer.android.com/training/notify-user/channels

The PR https://github.com/caffeinalab/ti.goosh/pull/102 gives the initial implementation towards that support, but still not enough. I merged the PR into the https://github.com/fanhero/ti.goosh/tree/hotfix/oreo for initial tests, and while using the https://github.com/fanhero/ti.goosh/blob/master/test-fcm script, I receive the following fatal error:

10-04 18:05:41.585: E/AndroidRuntime(24722): 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=com.fanhero.next cmp=com.fanhero.next/ti.goosh.IntentService (has extras) }: app is in background uid UidRecord{9fca10a u0a131 RCVR bg:+3m46s591ms idle procs:1 seq(0,0,0)}

This error is related to another change in this API version: https://developer.android.com/about/versions/oreo/background

Which includes a Migration Guide, but I was not able to implement all the recommended changes.

Can you please work on this support?

Requirements

  1. Test on an Android Oreo device (8.0+);
  2. Send pushes when the app is background and foreground;
  3. Make sure it's still compatible on previous android versions.
ianko commented 6 years ago

I happens when you set <uses-sdk android:minSdkVersion="20" android:targetSdkVersion="26"/>