2

I am currently making a Xamarin Binding (only Android for now) for MarketingCloudSDK 7.3.0 which is basically a wrapper in C#. So in java, I use the MarketingCloudSDK with the functions I need and I generate a lib (aar) that I use in my binding (C#). My problem is that everything related to push notifications does not work in the binding, but it works in my native test app (kotlin). For instance, I can find the device id in the MobilePush contact list when I use my native test app, but not with the binding. In both cases, I initialized MarketingCloud in the app's onCreate method.

When I added some logs, using MarketingCloudSdk.getInstance().getSdkState(), I did notice an important difference between both cases.

Native

"PushMessageManager": {
        "pushEnabled": true,
        "debugInfo": {
            "senderId": "myid......",
            "deviceToken": null,
            "firebaseApps": [],
            "c2dmReceiver": [
                {
                    "name": "com.google.firebase.iid.FirebaseInstanceIdReceiver",
                    "priority": 0
                }
            ],
            "instanceIdService": [],
            "messagingService": [
                {
                    "name": "com.salesforce.marketingcloud.messages.push.MCFirebaseMessagingService",
                    "priority": -1
                },
                {
                    "name": "com.google.firebase.messaging.FirebaseMessagingService",
                    "priority": -500
                }
            ]
        }
    }

Binding

"PushMessageManager": {
        "pushEnabled": true,
        "debugInfo": {
            "senderId": "myid......(same one)",
            "deviceToken": null,
            "firebaseApps": [],
            "c2dmReceiver": [
                {
                    "name": "com.google.firebase.iid.FirebaseInstanceIdReceiver",
                    "priority": 0
                }
            ],
            "instanceIdService": [],
            "messagingService": [
                {
                    "name": "com.google.firebase.messaging.FirebaseMessagingService",
                    "priority": -500
                }
            ]
        }
    }

Everything else is pretty much the same. Does anyone know what may have caused com.salesforce.marketingcloud.messages.push.MCFirebaseMessagingService to be absent from messagingService and how it could be added? Thank you.

3
  • That service, and others, are declared in the manifest. Does your merged manifest contain them? – Bill Mote Nov 11 '20 at 13:23
  • @BillMote Yes, that's it! I was missing some important parts in my manifest. Thank you! I can now add them in my binding with Additions: namespace Com.Salesforce.Marketingcloud.Messages.Push { [Service(Exported = false)] [IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" }, Priority = -1)] public partial class MCFirebaseMessagingService { } } – omstring Nov 11 '20 at 17:40
  • 1
    Care to publish your whole binding file here for everyone or linking to your repo for the binding file? :) – Bill Mote Nov 11 '20 at 20:46
0

Make sure your merged manifest has all the receivers & services that would be declared by the SDK in a native implementation.

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.