0

In Android, we are observing that in-app messages, of type system full page or modal, are getting auto dismissed within a few seconds.

In our understanding by doc, in-app msg feature is auto included since integrating the salesforce sdk. But we are facing that auto dismissed issue.

Hence, We tried show the msg by capturing message id and show that message by using below method which is describe in this doc : https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/in-app-message/in-app-messaging.html

  MarketingCloudSdk.requestSdk(new MarketingCloudSdk.WhenReadyListener() {
        @Override
        public void ready(@NonNull MarketingCloudSdk marketingCloudSdk) {
            String inAppMessage = LocalDataManager.getSharedInstance().
                    getString(AppCoreConstants.SALESFORCE_CLOUD_INAPP_MESSAGE_ID,AppCoreConstants.EMPTY_STRING);
            if(!AppCoreUtils.isEmpty(inAppMessage)){
                marketingCloudSdk.getInAppMessageManager().showMessage(inAppMessage);
                Log.d("SF_INAPP_SHOW", ""+inAppMessage + "");
            }
        }
    });

But when sending the in app from server, app is not showing the msg.

In Android Studio Log, we found that in app msg is get downloaded. I have logged the msg after showMessage() method. I can confirm that log generate the msg.

However it cannot show in app.

I go back to background and come to foreground multiple time . But still do not see the in app pop up although Android logcat is generated the msg.

We used Salesforce SDK version 6.3.5

MarketingCloudSdk.requestSdk(new MarketingCloudSdk.WhenReadyListener() {
        @Override public void ready(@NonNull MarketingCloudSdk sdk) {
            Log.d("SDKSTATE", sdk.getSdkState().toString());
            //Generate token here to test the saleforce push notification
            Log.d("TOKEN", sdk.getPushMessageManager().getPushToken()+" ");
            sdk.getInAppMessageManager().setInAppMessageListener(
                    new InAppMessageManager.EventListener() {
                        @Override
                        public boolean shouldShowMessage(@NonNull InAppMessage inAppMessage) {
                            Log.d("SF_INAPP_RECEIVE" , ""+ inAppMessage + "");
                            LocalDataManager.getSharedInstance().set
                                    (AppCoreConstants.SALESFORCE_CLOUD_INAPP_MESSAGE_ID, inAppMessage.id());
                            return false;
                        }

                        @Override
                        public void didShowMessage(@NonNull InAppMessage inAppMessage) {

                        }

                        @Override
                        public void didCloseMessage(@NonNull InAppMessage inAppMessage) {
                            Log.d("SF_INAPP_CLOSE" , ""+ inAppMessage + "");

                        }
                    });
        }
    });

Can anyone help? Thanks in advance.

2
0

Your shouldShowMessage listener is always returning false. The listener is checked regardless of whether or not the SDK is calling showMessage or your application is calling showMessage.

7
  • hi @Bill, with default value (true) , auto dismiss issue occurs. That's why I am trying to control manually. – dapau May 15 '20 at 8:34
  • There is NO auto-dismiss in InApp Messaging. If messages are being dismissed then it is likely that your application is changing activities. You just need to manage the state of true/false in your listener appropriately for your solution to work. But returning false will never show a message. – Bill Mote May 15 '20 at 11:12
  • hi @Bill, yes, message are being dismissed. That is the issue for us. But we cannot change our existing project architecture. That's why we try to save the msg id and show it later. If we understand this documentation correctly salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/…, if we want to show the msg later, we need to keep the msg id and return the state of listener to false and then show the msg id later. In android log cat, it show msg is download and generated. But pop up does not show. Please help check. thank you. – dapau May 17 '20 at 15:16
  • MAKE YOUR INTERFACE SMARTER. Don't just return false. If-then-else here my friend. – Bill Mote May 18 '20 at 14:17
  • hi @Bill, there is no condition to check to return the different status. If we can use only with the value true, it would be better. Are you referring to implement like this . public boolean shouldShowMessage(InAppMessage inAppMessage) { if(shouldShowMessage(inAppMessage)){ return true; }else{ LocalDataManager.getSharedInstance().set (SALESFORCE_CLOUD_INAPP_MESSAGE_ID, inAppMessage.id()); return false; } } I think it will still loop back to the auto dismiss issue again. If it is not the case, could you pls more collaborate? – dapau May 19 '20 at 12:09

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.