2

I have implemented JB4A-SDK-Android following the links below:

salesforce-marketingcloud.github.io/JB4A-SDK-Android/sdk-implementation/implement-sdk-google.html salesforce-marketingcloud.github.io/JB4A-SDK-Android/trouble-shooting/trouble-shooting-push-setup.html

For moving from CGM to FCM, I followed Firebase instructions below:

developers.google.com/cloud-messaging/android/android-migrate-fcm firebase.google.com/docs/cloud-messaging/android/client

The logcat seems to show that everything is fine, but devices are not being registered on Marketing Cloud.

log: http://pastebin.com/Fs65Sz7u

I've seen this related question: Journey Builder and custom push handler

However, FCM doesn't need the action com.google.android.c2dm.intent.RECEIVE on the manifest anymore, as it does it automatically.

My apps are successfully registered on FCM and I am able to send push notifications successfully through FCM.

My apps are also successfully registered on Marketing Cloud and on SalesForce Mobile Studio, however I am not able to get any Android devices IDS, neither to send push notifications through Marketing Cloud.

What am I missing here? Is there someone who has done it with FCM?

  • What version of the SDK are you using? – Bill Mote Jan 13 '17 at 14:43
  • 4.7.1, latest version available from nov 2016. – Cassiano Monteiro Jan 14 '17 at 15:45
  • 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 '17 at 15:04
  • Sure, no problem! I will pay attention to updates, but please drop me a remind here if I take too long to give you some feedback. – Cassiano Monteiro Jan 23 '17 at 15:41
  • 1
    @BillMote We tested it ant it worked fine after removed the manual service declaration! Yay! But the problem described on salesforce.stackexchange.com/questions/89222/… still persists. Can you please take a look at it? Thanks! – Cassiano Monteiro Feb 11 '17 at 13:34
0

UPDATE 20170211: Verified per the comment in the original question -- this problem has been resolved in version 4.8.4 of the SDK.

If you are using a version < 4.8.4 please see:

What version of the SDK are you using?

There is an issue with Google GcmReceiver.class in which they look for the service at index(0).

Can you please try manually providing the ETPushService definition in your AndroidManifest.xml and ensure that it is declared before any other service?

<service
    android:name="com.exacttarget.etpushsdk.ETPushService"
    android:exported="false">
    <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE" />
    </intent-filter>
</service>

You can see by the logs that the Receiver is being called, but it never hands off to our Service.

Here is the code in question:

private void zzk(Context var1, Intent var2) {
    ResolveInfo var3 = var1.getPackageManager().resolveService(var2, 0);
    if(var3 != null && var3.serviceInfo != null) {
        ServiceInfo var4 = var3.serviceInfo;
        if(var1.getPackageName().equals(var4.packageName) && var4.name != null) {
            String var5 = var4.name;
            var5 = var5.startsWith(".")?var1.getPackageName() + var5:var5;
            if(Log.isLoggable("GcmReceiver", 3)) {
                Log.d("GcmReceiver", "Restricting intent to a specific service: " + var5);
            }

            var2.setClassName(var1.getPackageName(), var5);
        } else {
            Log.e("GcmReceiver", "Error resolving target intent service, skipping classname enforcement. Resolved service was: " + var4.packageName + "/" + var4.name);
        }
    } else {
        Log.e("GcmReceiver", "Failed to resolve target intent service, skipping classname enforcement");
    }
}

If you wish to debug further you can do one of the following to determine what service is being called:

System.setProperty("log.tag.GcmReceiver", "VERBOSE");

-or-

16:24:50 [bmote@in7277 EtPushHelloWorld]$ adb shell setprop log.tag.GcmReceiver VERBOSE

As a result I can see this for my test app (note, however, that my app does not experience this problem and directs to the correct service):

03-28 16:43:35.538 32627-32627/com.example.helloworld D/GcmReceiver: Restricting intent to a specific service: com.exacttarget.etpushsdk.ETPushService
  • Got it working, but adding that service to the manifest was giving me "Unresolved class 'ETPushService'". So I added android:name="com.exacttarget.etpushsdk.ETPushService" instead. Also, setting the property log.tag.GcmReveicer didn't add anything to the logs... But I could see logs from ETPushService regarding its POSTs to Marketing Cloud. – Cassiano Monteiro Jan 16 '17 at 13:24
  • Corrected the package for the Service. – Bill Mote Jan 16 '17 at 15:02
0

Got it working by adding this to the manifest (first service):

    <service
        android:name="com.exacttarget.etpushsdk.ETPushService"
        android:exported="false">
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
        </intent-filter>
    </service>

Setting System.setProperty("log.tag.GcmReceiver", "VERBOSE") did not show anything on the console, by I could see this log:

01-16 10:25:08.552 21037-22817/com.guichevirtual.android D/~!ETPushService: ETPushService.onHandleIntent()
01-16 10:25:08.552 21037-22817/com.guichevirtual.android D/~!ETPushService: ETPushService started with action of et_push_action_send.
01-16 10:25:08.552 21037-22817/com.guichevirtual.android D/~!ETPushService: Send data to Marketing Cloud.
01-16 10:25:08.552 21037-22817/com.guichevirtual.android D/~!ETPushService: Sending data for: et_send_type_registration
01-16 10:25:08.572 21037-22817/com.guichevirtual.android D/~!ETPushService: previousRegistrationHash = null
01-16 10:25:08.582 21037-22817/com.guichevirtual.android D/~!ETPushService: createHash(final String string) // string = '...'
01-16 10:25:08.582 21037-22817/com.guichevirtual.android D/~!ETPushService: return 2862206e34189bc0be1c9dbf0f8e2ecd
01-16 10:25:08.592 21037-22817/com.guichevirtual.android D/~!ETPushService: Registration (JSON): {...}
01-16 10:25:08.592 21037-22817/com.guichevirtual.android D/~!ETPushService: REGISTRATION ID: 6
01-16 10:25:08.592 21037-22817/com.guichevirtual.android V/~!ETPushService: Initiating Registration REST Call ...
01-16 10:25:08.592 21037-22817/com.guichevirtual.android V/~!ETPushService: POST ...
01-16 10:25:08.602 21037-22817/com.guichevirtual.android I/~!ETPushService: Request Url: https://consumer.exacttargetapis.com/device/v1/registration
01-16 10:25:08.602 21037-22817/com.guichevirtual.android I/~!ETPushService: Request data: {...}
01-16 10:25:11.542 21037-22817/com.guichevirtual.android V/~!ETPushService: HTTP POST request took: 2948ms
01-16 10:25:11.902 21037-22817/com.guichevirtual.android V/~!ETPushService: HTTP POST StatusCode: 201
01-16 10:25:11.912 21037-22817/com.guichevirtual.android I/~!ETPushService: POST Response: {...}
01-16 10:25:11.912 21037-22817/com.guichevirtual.android D/~!ETPushService: Creating Event: com.exacttarget.etpushsdk.event.RegistrationEvent
01-16 10:25:11.912 21037-22817/com.guichevirtual.android D/~!ETPushService: Build Factory From Response Type: com.exacttarget.etpushsdk.event.RegistrationEvent
01-16 10:25:11.912 21037-22817/com.guichevirtual.android D/~!ETPushService: Build Event From Factory: com.exacttarget.etpushsdk.event.RegistrationEvent
01-16 10:25:11.972 21037-22817/com.guichevirtual.android V/~!ETPushService: Update Event with received databaseId: 6 
01-16 10:25:11.972 21037-22817/com.guichevirtual.android D/~!ETPushService: Adding ID 6
01-16 10:25:11.972 21037-22817/com.guichevirtual.android D/~!ETPushService: Saving a hash of our registration.
01-16 10:25:11.982 21037-22817/com.guichevirtual.android D/~!ETPushService: createHash(final String string) // string = '...'
01-16 10:25:11.982 21037-22817/com.guichevirtual.android D/~!ETPushService: return 2862206e34189bc0be1c9dbf0f8e2ecd
01-16 10:25:11.982 21037-22817/com.guichevirtual.android D/~!ETAlarmManager: Resetting REGISTRATION Alarm Interval to 1.00 minute(s).
01-16 10:25:11.982 21037-22817/com.guichevirtual.android D/~!ETPushService: Posting com.exacttarget.etpushsdk.event.RegistrationEvent to EventBus
01-16 10:25:11.992 21037-22817/com.guichevirtual.android D/~!ETPush: onEvent(final RegistrationEvent event){ event.getId(); } // ID = 6
01-16 10:25:11.992 21037-22817/com.guichevirtual.android D/~!ETPushService: POST complete.

After this, tokens started to show up on marketing cloud, and push notifications were received on Android devices.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.