I've integrated the JB SDK v4.3.1 in my android app, and followed the integration tutorial from here, and to use the Open Direct feature from here.
My custom application code is as follows:
package br.com.package;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import com.exacttarget.etpushsdk.ETException;
import com.exacttarget.etpushsdk.ETNotificationBuilder;
import com.exacttarget.etpushsdk.ETNotifications;
import com.exacttarget.etpushsdk.ETPush;
import com.exacttarget.etpushsdk.ETPushConfig;
import com.exacttarget.etpushsdk.event.ReadyAimFireInitCompletedEvent;
import com.exacttarget.etpushsdk.util.EventBus;
import br.com.package.JB_SDK.CustomLandingPageActivity;
public class CustomApplication extends Application {
public void onCreate() {
super.onCreate();
AppContext.init(this);
//TODO remove
CacheStorageSpace.init(getApplicationContext());
//TODO remove
InternalStorageSpace.init(getApplicationContext());
ResourcesUtils.setContext(this);
EventBus.getInstance().register(this);
try {
// ETPush configuration
ETPush.readyAimFire(new ETPushConfig.Builder(this)
.setEtAppId(BuildConfig.ET_APP_ID)
.setAccessToken(BuildConfig.ET_ACCESS_TOKEN)
.setGcmSenderId(BuildConfig.GCM_SENDER_ID)
.setAnalyticsEnabled(true)
.setWamaEnabled(true)
.setCloudPagesEnabled(true)
.build());
}catch (ETException e) {
e.printStackTrace();
}
}
public void onEvent(final ReadyAimFireInitCompletedEvent event) {
try {
if (ETPush.getLogLevel() <= Log.DEBUG) {
Log.i("ReadyAimFire", "ReadyAimFireInitCompletedEvent started.");
}
if (event.isReadyAimFireReady()) {
ETPush.getInstance().setOpenDirectRecipient(CustomLandingPageActivity.class);
}
} catch (ETException e) {
e.printStackTrace();
}
}
}
The subscription is working fine and pushes are arriving with a good payload. The problem is, when clicking the notification the next behaviour is weird, and depends on the state of the app:
if the app is not running (killed in the applications menu "square"), and the notification is opened it opens the landing page but the Activity is the default one, the name of the activity is "Landing Page";
sometimes even when the app is dead the landing page is loaded correctly, and the name of the activity is "My app name" as it should be. But, in this case, every other notification have their Open Direct url ignored and no landing page is showed, just the first one;
if the app is opened by clicking the icon, as normal, the behaviour is the expected, and every notification opens the app in the good landing page;
I'd want to know if I did something wrong in my integration and if this have happened with someone else.