0

We are configuring the MC-Cordova-Plugin on a cordova project.

Our config.xml have this lines on the correct position:

    <!-- outside any plataform -->
    <preference name="com.salesforce.marketingcloud.app_id" value="xxxxxxxxxxxxxxxx" />
    <preference name="com.salesforce.marketingcloud.access_token" value="xxxxxxxxxx" />
    <preference name="com.salesforce.marketingcloud.tenant_specific_endpoint" value="https://blablabla" />
    <preference name="com.salesforce.marketingcloud.delay_registration_until_contact_key_is_set" value="true" />
    
    <!-- inside platform android -->
    <resource-file src="res/notification/android/mipmap-mdpi/ic_notify.png" target="app/src/main/res/drawable-mdpi/ic_notification.png" />
    <resource-file src="res/notification/android/mipmap-hdpi/ic_notify.png" target="app/src/main/res/drawable-hdpi/ic_notification.png" />
    <resource-file src="res/notification/android/mipmap-xhdpi/ic_notify.png" target="app/src/main/res/drawable-xhdpi/ic_notification.png" />
    <resource-file src="res/notification/android/mipmap-xxhdpi/ic_notify.png" target="app/src/main/res/drawable-xxhdpi/ic_notification.png" />
    <resource-file src="res/notification/android/mipmap-xxxhdpi/ic_notify.png" target="app/src/main/res/drawable/ic_notification.png" />

    <preference name="com.salesforce.marketingcloud.notification_small_icon" value="ic_notification" />

We have this code before the user login:

      var PUSH_ENABLE = 1, CONTACT_KET_SET_WITH_SUCCESS = 1, PUSH_DISABLE = 0, PUSH_ENABLE_WITH_SUCCESS  = "OK";
      // Salesforce Push
      MCCordovaPlugin.isPushEnabled(
        function (result) {
          if (result === PUSH_ENABLE) { 
            MCCordovaPlugin.setContactKey(system_utils.getUniqueId()+'_'+usuarioObj.documento,
              function (result) {
                console.log("Chave de contato definida com sucesso: ", result);
                // TODO talvez é necessário pegar o token
                MCCordovaPlugin.getSystemToken(
                  function(token) {console.log("Token obtido: ", token);}, 
                  function(error) {console.log("Erro desconhecido ao tentar obter o token: ", error);}
                )
              }, 
              function (error) { 
                console.log("Erro ao tentar definir chave de contato: ", error);
              }
            )
          } else if (result === PUSH_DISABLE) {
            MCCordovaPlugin.enablePush(function (result) { // tenta habilitar o push
              if (result === PUSH_ENABLE_WITH_SUCCESS) {
                MCCordovaPlugin.setContactKey(system_utils.getUniqueId()+'_'+usuarioObj.documento,
                  function (result) {
                    if (result === CONTACT_KET_SET_WITH_SUCCESS) {
                      console.log("Chave de contato salesforce definida com sucesso: ", result);
                      // TODO talvez é necessário pegar o token
                    } else {
                      console.log("Problemas setando a chave de contato salesforce.")
                    }
                  }, 
                  function (error) { 
                    console.log("Erro desconhecido ao tentar definir chave de contato salesforce: ", error);
                  }
                )
              }
            },
            function (error) {
              console.log("erro desconhecido ao tentar habilitar o push salesforce: ", error);
            })
          }
        }, 
        function (erro) { // algum erro de outro tipo...
          console.log("Erro desconhecido ao tentar checar se o push salesforce esta habilitado: ", erro);
        }
      )

On Android everything is working well.

I made the step for cocoa pods from the plugin page and also the iOS steps: https://github.com/salesforce-marketingcloud/MC-Cordova-Plugin/blob/master/ios_push.md

All configuration keys .p8, .p12, and other confs on the panel is done.

And I can see the contact-key of the QA analyst device in the Contact Builder page.

We are doing something wrong... I know we are... Some ideas? Are welcome :)

thx

ps.: I don't have a iPhone, but tomorrow I can get one. Actually we are trying send a message for the QA analyst iPhone. She gave to us the iPhone code to enable the devices in the developer.apple.com panel. We distribute the code using a web build by us.

ps2: I don't know how to see what device is opt-in or opt-out... some light?

number of opt-in devices on mobile cloud is 6

  • Please open a support case through your account representative. – Bill Mote Sep 30 at 12:10

Your Answer

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

Browse other questions tagged or ask your own question.