@Override
  public void doOnCreate(Activity activity, Bundle savedInstanceState) {
    // TODO: See if we can determine which app store the app was downloaded and go directly there.
    String errorMessage = activity.getString(R.string.apptentive_rating_error);
    boolean showingDialog = false;
    try {
      IRatingProvider ratingProvider = ApptentiveInternal.getRatingProvider();
      errorMessage = ratingProvider.activityNotFoundMessage(activity);

      String appDisplayName = Configuration.load(activity).getAppDisplayName();
      Map<String, String> ratingProviderArgs = ApptentiveInternal.getRatingProviderArgs();
      Map<String, String> finalRatingProviderArgs;
      if (ratingProviderArgs != null) {
        finalRatingProviderArgs = new HashMap<String, String>(ratingProviderArgs);
      } else {
        finalRatingProviderArgs = new HashMap<String, String>();
      }

      if (!finalRatingProviderArgs.containsKey("package")) {
        finalRatingProviderArgs.put("package", activity.getPackageName());
      }
      if (!finalRatingProviderArgs.containsKey("name")) {
        finalRatingProviderArgs.put("name", appDisplayName);
      }

      ratingProvider.startRating(activity, finalRatingProviderArgs);
    } catch (ActivityNotFoundException e) {
      showingDialog = true;
      displayError(activity, errorMessage);
    } catch (InsufficientRatingArgumentsException e) {
      // TODO: Log a message to apptentive to let the developer know that their custom rating
      // provider puked?
      showingDialog = true;
      Log.e(e.getMessage());
      displayError(activity, activity.getString(R.string.apptentive_rating_error));
    } finally {
      if (!showingDialog) {
        Log.d("Finishing Activity.");
        activity.finish();
      }
    }
  }
 public static Configuration load(Context context) {
   SharedPreferences prefs =
       context.getSharedPreferences(Constants.PREF_NAME, Context.MODE_PRIVATE);
   return Configuration.load(prefs);
 }