0

I'd like to implement Journey Builder next to custom implementation for other push handler (we would like to have Journey Builder, Mixpanel and our own implementation in one app).

The issue which we have is NullPointerException which looks like this one:

FATAL EXCEPTION: AsyncTask #1
Process: com.azimo.sendmoney.debug1, PID: 24805
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.hashCode()' on a null object reference
   at com.google.android.gms.gcm.GcmListenerService.zzo(Unknown Source)
   at com.google.android.gms.gcm.GcmListenerService.zza(Unknown Source)
   at com.google.android.gms.gcm.GcmListenerService$1.run(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
   at java.lang.Thread.run(Thread.java:818

And it occurs only when we have implemented both Mixpanel and Journey Builder (they both work separately).

Code which causes issue looks like this:

<service
    android:name=".a.backend.service.GcmMessagingService"
    android:exported="false">
    <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
    </intent-filter>
</service>

And the implementation:

public class GcmMessagingService extends GcmListenerService {
    @Inject
    GcmHandlerManager gcmHandlerManager;

    @Override
    public void onCreate() {
        super.onCreate();
        AzimoApplication.get(this).getComponent().inject(this);
    }

    public void onMessageReceived(String from, Bundle data) {
        gcmHandlerManager.handle(from, data);
    }
}

When I remove declaration from Manifest app will start working.

Whole implementation of Journey Builder is done like it's described in documentation.

4
  • Please include the next section of the log if available.
    – Bill Mote
    Jun 23, 2016 at 14:04
  • There is nothing more than this... But maybe here you can find something useful: gist.github.com/frogermcs/cd122a7ff35d07f9820271f27df60345
    – froger_mcs
    Jun 24, 2016 at 6:35
  • You're allowing the auto-merge of the manifest? Also, if the version you're using supports getSdkState() you can add that as "logs" to your Crashlytics reporting. It will give you much more detail about the state of the SDK at the time of the crash.
    – Bill Mote
    Jun 24, 2016 at 19:22
  • Version 4.8.x should be available by month's end. I have never been able to reproduce this problem. I would love to hear if the changes in v4.8.x address this issue. Could you download the latest version, when available, remove the Service declaration from the manifest and report back success/failure?
    – Bill Mote
    Jan 21, 2017 at 15:04

1 Answer 1

1

We do not have a GCMListenerService defined in the SDK, but there is an odd issue in GcmReceiver.java which our ETPushReceiver.java extends.

The GcmReceiver is pulling the service at index 0. You can see this by enabling a logging message at the command prompt for your running application and then sending yourself a push message. Enable the logging with:

adb shell setprop log.tag.GcmReceiver VERBOSE

That will force Google's GcmReceiver to run this section of the code and should illustrate the problem:

if(Log.isLoggable("GcmReceiver", 3)) {
    Log.d("GcmReceiver", "Restricting intent to a specific service: " + var5);
}

Please try manually adding the ETPushService in your manifest and ensure that it is declared before any other services. The block in your manifest will resemble:

<service
    android:name=".ETPushService"
    android:exported="false">
    <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE" />
    </intent-filter>
</service>
2
  • I've just realised that yeah - this code works and doesn't crassh the app. But I cannot receive push from other services anymore. ExactTarget generates message: W/~!ETPushService: We received a push message, but the message contained no SDK recognizable keys in its payload. Aborting notification process.
    – froger_mcs
    Jul 12, 2016 at 12:11
  • The SDK is not currently designed to handle multiple push providers.
    – Bill Mote
    Jul 12, 2016 at 15:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .