Copyright (c) 2014 Appboy, Inc.
All rights reserved.
* Use of source code or binaries contained within Appboy's Android SDK is permitted only to enable use of the Appboy platform by customers of Appb...
If you think the Android project appboy-android-sdk listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.appboy.ui;
//www.java2s.comimport android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import com.appboy.Constants;
import com.appboy.IAppboyNavigator;
import com.appboy.ui.actions.ActivityAction;
import com.appboy.ui.actions.WebAction;
import com.appboy.ui.activities.AppboyFeedActivity;
publicclass AppboyNavigator implements IAppboyNavigator {
privatestaticfinal String TAG = String.format("%s.%s", Constants.APPBOY_LOG_TAG_PREFIX, AppboyNavigator.class.getName());
@Override
publicvoid gotoNewsFeed(Context context, Bundle extras) {
// Checks to see if the AppboyFeedActivity is registered in the manifest. If it is, we can
// open up the Appboy news feed in a new Activity. Otherwise, we just ignore the request.
ComponentName componentName = new ComponentName(context, AppboyFeedActivity.class);
try {
context.getPackageManager().getActivityInfo(componentName, PackageManager.GET_ACTIVITIES);
Intent intent = new Intent(context, AppboyFeedActivity.class);
ActivityAction activityAction = new ActivityAction(intent);
activityAction.execute(context);
} catch (PackageManager.NameNotFoundException e) {
Log.d(TAG, "The AppboyFeedActivity is not registered in the manifest. Ignoring request " +
"to display the news feed.");
}
}
@Override
publicvoid gotoURI(Context context, Uri uri, Bundle extras) {
if (uri == null) {
Log.e(TAG, "IAppboyNavigator cannot open URI because the URI is null.");
return;
}
WebAction webAction = new WebAction(uri.toString());
webAction.execute(context);
}
}