CleverTap / clevertap-android-sdk

CleverTap Android SDK
MIT License
80 stars 74 forks source link

App Inbox Back Button #73

Closed dduvedi closed 4 years ago

dduvedi commented 4 years ago

I have implemented app inbox for clever tap in an activity, but on back press it shows me a white screen and again on back press takes me to the previous screen.

darshanclevertap commented 4 years ago

@dduvedi Could you share the code on how are you calling our InboxActivity? Is it on top of a fragment or an existing Activity? And if possible you could share a screen recording of what you've described?

dduvedi commented 4 years ago

import android.os.Bundle;

import com.clevertap.android.sdk.CTInboxListener; import com.clevertap.android.sdk.CTInboxStyleConfig; import com.clevertap.android.sdk.CleverTapAPI; import com.payu.payumoney.activities.PayUnowBaseActivity;

import java.util.ArrayList;

public class CTAppInbox extends PayUnowBaseActivity implements CTInboxListener { private CleverTapAPI cleverTapDefaultInstance;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    cleverTapDefaultInstance = CleverTapAPI.getDefaultInstance(this);
    if (cleverTapDefaultInstance != null) {
        //Set the Notification Inbox Listener
        cleverTapDefaultInstance.setCTNotificationInboxListener(this);
        //Initialize the inbox and wait for callbacks on overridden methods
        cleverTapDefaultInstance.initializeInbox();
    }
}

@Override
public void inboxDidInitialize() {
    ArrayList<String> tabs = new ArrayList<>();
    tabs.add("Promotions");
    tabs.add("Offers");
    tabs.add("Others");//We support upto 2 tabs only. Additional tabs will be ignored

    CTInboxStyleConfig styleConfig = new CTInboxStyleConfig();
    styleConfig.setTabs(tabs);//Do not use this if you don't want to use tabs
    styleConfig.setTabBackgroundColor("#FF0000");//provide Hex code in string ONLY
    styleConfig.setSelectedTabIndicatorColor("#0000FF");
    styleConfig.setSelectedTabColor("#000000");
    styleConfig.setUnselectedTabColor("#FFFFFF");
    styleConfig.setBackButtonColor("#FF0000");
    styleConfig.setNavBarTitleColor("#FF0000");
    styleConfig.setNavBarTitle("MY INBOX");
    styleConfig.setNavBarColor("#FFFFFF");
    styleConfig.setInboxBackgroundColor("#00FF00");

    cleverTapDefaultInstance.showAppInbox(styleConfig); //Opens activity tith Tabs

}

@Override
public void inboxMessagesDidUpdate() {

}

}

This is the activity and i am opening it using standard intent and start activity.

piyush-kukadiya commented 4 years ago

@dduvedi I have tested this from my end, this is working fine. Is this issue specific to OS or device?

device-2020-05-21-144515

dduvedi commented 4 years ago

working fine for me too, that was not clarified in documentation the process of integration after checking out the starter app i got it.