Conversation Activity on messaging Android SDK

6 コメント

  • Christopher Kennedy
    Zendesk Developer Advocacy

    Hey Vishakha,

    Can you provide some more context around what custom action you intend to perform before closing the activity? Sample code to the demonstrate the desired custom action would be helpful as well.

    Thanks,

    0
  • Vishakha Damle

    We need to invoke a React Native function - that function determines where the URL should redirect to (within our app). That function is being called correctly, and the redirection occurs in the background. On redirection, we want to close the chat activity.

    The following is the function we need to call before closing the activity.

    onUrlPressed.invoke(url);

    The entire code block :

    Messaging.instance().showMessaging(getCurrentActivity());
    Messaging.setDelegate(newMessagingDelegate() {
    @Override
    public boolean shouldHandleUrl(@NotNullStringurl, @NotNullUrlSourceurlSource) {

    // Your custom action...
    // Return false to prevent the SDK from handling the URL automatically
    // Return true to allow the SDK to handle the URL automatically, even
    // if you have done something custom

    onUrlPressed.invoke(url);
    // Need to close the activity now
    return false;

    }

    });

     

    0
  • Christopher Kennedy
    Zendesk Developer Advocacy

    Hi Vishakha,

    Would it be possible for you to share a simplified sample app (with navigation steps to reproduce) demonstrating what undesired behavior happens when simply finishing the current activity?

    Thanks,

    0
  • Joseph Chadwickson

    Conversations is the newest section dedicated to notifications that come in from chat apps like Android Messages, Facebook Messenger, and others. It sits at the top of your notification shade, right underneath quick settings. Conversation notifications can play by slightly different rules than other notifications

    0
  • James Buttler

    To close the ConversationActivity when a link is clicked in the Android messaging SDK, utilize an Intent to explicitly finish the current activity. In the Clickable Links delegate, call startActivity(new Intent(context, ConversationActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)) to navigate back to the ConversationActivity and close the current one. This ensures a seamless user experience and maintains consistent behavior across iOS and Android platforms.

     

     

    0
  • James Buttler

    To seamlessly close the Conversation Activity upon clicking a link in the Android messaging SDK, explicitly employ an Intent to finish the ongoing activity. Within the Clickable Links delegate, initiate start Activity(new Intent(context, Conversation Activity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)) to return to the ConversationActivity, effectively closing the current one. This approach ensures a smooth user experience and consistency across both iOS and Android platforms. 

    0

サインインしてコメントを残してください。

Powered by Zendesk