-1

I am getting a recurring crash in the developer console for all the users with an Android >= 8.0 (Oreo). It began to happen after upgrading Parse from 1.15.8 to 1.16.3.

enter image description here

Not having much information, I tried to check in the code where the IllegalArgumentException fires. And it actually makes sense, here is the code of GcmBroadcastReceiver's onReceive() for Parse 1.16.x release :

@Override
@CallSuper
public void onReceive(Context context, Intent intent) {
    PushServiceUtils.runService(context, intent);
}
// In Parse 1.15.8, onReceive was instead calling 
// ServiceUtils.runWakefulIntentInService(context, intent, PushService.class);

In PushServiceUtils :

public static boolean runService(Context context, @NonNull Intent intent) {
    if (USE_JOBS) { // USE_JOBS : Android SDK >= 8.0 (Oreo)
        return PushServiceApi26.run(context, intent);
    } else {
        return PushService.run(context, intent);
    }
}

Although I managed to find where the bug happens, I have not enough knowledge with Android (and especially push notifications) to understand what's going on. In the Manifest, the relevant lines :

<meta-data
        android:name="com.parse.push.gcm_sender_id"
        android:value="id:xxxxxxx" />


<service android:name="com.parse.PushService" />

<receiver
    android:name="com.parse.GcmBroadcastReceiver"
    android:permission="com.google.android.c2dm.permission.SEND" >

    <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE" />
        <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

        <category android:name="bruce.worker.android" />
    </intent-filter>

</receiver>

But still, I can't find what's causing this. Any help would be greatly appreciated !

Rob
  • 15,732
  • 22
  • 69
  • 107

1 Answers1

0

I managed to find the solution by reproducing the issue on a device with Oreo. The error in the stacktrace was more precise:

Android java.lang.IllegalArgumentException: No such service

Then I got the solution thanks to this post.

I just had to add this in the manifest:

<service android:name="com.parse.PushServiceApi26"
        android:permission="android.permission.BIND_JOB_SERVICE"
        android:exported="true"/>
Rob
  • 15,732
  • 22
  • 69
  • 107