1

I have a super simple push notification receiver. I really just have the receiver setup in the AndroidManifest:

    <!-- Listener to receive Push Notifications -->
    <service
        android:name="com.example.pushnotifications.receiver.PushMessageReceiver"
        android:exported="false"
        tools:ignore="InnerclassSeparator">
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
        </intent-filter>
    </service>

And then the receiver class is just this:

class PushMessageReceiver : GcmListenerService() {
    override fun onMessageReceived(from: String?, data: Bundle?) {
        super.onMessageReceived(from, data)

        // empty. only receives and displays standard push notification
    }
}

In non-Oreo versions, this sends a push notification badge in the OS's notification bar, plays the default notification sound, and if you tap on the notification badge, the app opens.

That's really all I need at the moment. This works on non-Oreo versions, but nothing shows up on Oreo.

Any idea why this doesn't work anymore?

TooManyEduardos
  • 4,206
  • 7
  • 35
  • 66
  • 1
    Btw, may i ask why you are not using FCM and still use gcm? – Kushan Jan 23 '18 at 19:52
  • no particular reason. we originally created it with gcm and never cared enough to switch to FCM. we only use PN for marketing content sent about once a year...so we havent really paid much attention to this until our QA told us it broke on Oreo – TooManyEduardos Jan 23 '18 at 19:59
  • Hi. Could you try using FCM instead? FCM contains bug fixes from its previous version (GCM). Using GCM right now, doesn't really guarantee the supposed to be behaviors. – AL. Jan 24 '18 at 09:37
  • not really. changing from GCM to FCM requires server changes (right?) and those are outside of our control. we've put a request for it, but who knows when that'll happen :( – TooManyEduardos Jan 24 '18 at 22:11
  • 1
    read this answer. this may help you...https://stackoverflow.com/questions/46770865/gcmbroadcastreceiver-illegalstateexception-not-allowed-to-start-service-intent – jessica Feb 14 '18 at 04:30

1 Answers1

-3

the solution is to build your app to a lower version of gradle like 2.3 change all wrf all the dependencies and geadle of project too. just install last year android studio and build the code on the old gradle make sure to change gradle package on gradle properties from 4.1 to 3.0.1 or earlier. it worked for me until a solution in a new update

anas
  • 133
  • 2
  • 4
  • that's not really a solution though. In order for "us" (the mobile app team) to use firebase cloud messaging, we need to get backend teams to move to that....that's outside of our scope, so we need to make GCM work for the time being – TooManyEduardos Feb 13 '18 at 02:48