android.app.Activity.startIntentSenderForResult()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(939)

本文整理了Java中android.app.Activity.startIntentSenderForResult()方法的一些代码示例,展示了Activity.startIntentSenderForResult()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.startIntentSenderForResult()方法的具体详情如下:
包路径:android.app.Activity
类名称:Activity
方法名:startIntentSenderForResult

Activity.startIntentSenderForResult介绍

暂无

代码示例

代码示例来源:origin: anjlab/android-inapp-billing-v3

if (activity != null && pendingIntent != null)
  activity.startIntentSenderForResult(pendingIntent.getIntentSender(),
                    PURCHASE_FLOW_REQUEST_CODE,
                    new Intent(), 0, 0, 0);

代码示例来源:origin: serso/android-checkout

@Override
  public void startForResult(@Nonnull IntentSender intentSender, int requestCode, @Nonnull Intent intent) throws IntentSender.SendIntentException {
    mActivity.startIntentSenderForResult(intentSender, requestCode, intent, 0, 0, 0);
  }
};

代码示例来源:origin: libgdx/gdx-pay

@Override
public void startIntentSenderForResult(IntentSender intentSender,
                    int activityRequestCode,
                    Intent intent,
                    int flagsMask,
                    int flagsValues,
                    int extraFlags) throws IntentSender.SendIntentException {
  activity.startIntentSenderForResult(intentSender, activityRequestCode, intent,
    flagsMask, flagsValues, extraFlags);
}

代码示例来源:origin: iqiyi/Neptune

@Override
public void startIntentSenderForResult(android.content.IntentSender intentsender0, int int1, android.content.Intent intent2, int int3, int int4, int int5) throws IntentSender.SendIntentException {
  mOriginActivity.startIntentSenderForResult(intentsender0, int1, intent2, int3, int4, int5);
}

代码示例来源:origin: com.uphyca/android-junit4-robolectric

/**
 * @param intent
 * @param requestCode
 * @param fillInIntent
 * @param flagsMask
 * @param flagsValues
 * @param extraFlags
 * @throws SendIntentException
 * @see android.app.Activity#startIntentSenderForResult(android.content.IntentSender,
 *      int, android.content.Intent, int, int, int)
 */
public void startIntentSenderForResult(IntentSender intent,
                    int requestCode,
                    Intent fillInIntent,
                    int flagsMask,
                    int flagsValues,
                    int extraFlags) throws SendIntentException {
  mActivity.startIntentSenderForResult(intent, requestCode, fillInIntent, flagsMask, flagsValues, extraFlags);
}

代码示例来源:origin: com.uphyca/android-junit4-robolectric

/**
 * @param intent
 * @param requestCode
 * @param fillInIntent
 * @param flagsMask
 * @param flagsValues
 * @param extraFlags
 * @param options
 * @throws SendIntentException
 * @see android.app.Activity#startIntentSenderForResult(android.content.IntentSender,
 *      int, android.content.Intent, int, int, int, android.os.Bundle)
 */
public void startIntentSenderForResult(IntentSender intent,
                    int requestCode,
                    Intent fillInIntent,
                    int flagsMask,
                    int flagsValues,
                    int extraFlags,
                    Bundle options) throws SendIntentException {
  mActivity.startIntentSenderForResult(intent, requestCode, fillInIntent, flagsMask, flagsValues, extraFlags, options);
}

代码示例来源:origin: googlesamples/android-play-billing

mPurchaseListener = listener;
mPurchasingItemType = itemType;
act.startIntentSenderForResult(pendingIntent.getIntentSender(),
    requestCode, new Intent(),
    Integer.valueOf(0), Integer.valueOf(0),

代码示例来源:origin: iqiyi/Neptune

@SuppressLint("RestrictedApi")
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public void startIntentSenderForResult(android.content.IntentSender intentsender0, int int1, android.content.Intent intent2, int int3, int int4, int int5, android.os.Bundle bundle6) throws IntentSender.SendIntentException {
  mOriginActivity.startIntentSenderForResult(intentsender0, int1, intent2, int3, int4, int5, bundle6);
}

代码示例来源:origin: klinker24/Android-Blur-Launcher

@Override
public void startIntentSenderForResult (IntentSender intent, int requestCode,
    Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) {
  try {
    super.startIntentSenderForResult(intent, requestCode,
      fillInIntent, flagsMask, flagsValues, extraFlags, options);
  } catch (IntentSender.SendIntentException e) {
    throw new ActivityNotFoundException();
  }
}

代码示例来源:origin: klinker24/launcher3

@Override
public void startIntentSenderForResult (IntentSender intent, int requestCode,
    Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) {
  try {
    super.startIntentSenderForResult(intent, requestCode,
      fillInIntent, flagsMask, flagsValues, extraFlags, options);
  } catch (IntentSender.SendIntentException e) {
    throw new ActivityNotFoundException();
  }
}

代码示例来源:origin: jareddlc/OpenFit

protected Void doInBackground(Void... params) {
    Log.d(LOG_TAG, "purchasePremiumTask: " + PREMIUM_SKU);
    Bundle buyIntentBundle;
    try {
      buyIntentBundle = billingService.getBuyIntent(3, context.getPackageName(), PREMIUM_SKU, ITEM_TYPE_INAPP, null);
      Log.d(LOG_TAG, "buyIntentBundle: " + buyIntentBundle);
      buyIntent = buyIntentBundle.getParcelable(RESPONSE_BUY_INTENT);
      activity.startIntentSenderForResult(buyIntent.getIntentSender(), BILLING_REQ, new Intent(), 0, 0, 0);
    }
    catch(Exception e) {
      Log.e(LOG_TAG, "purchasePremiumTask failed: " + e.getMessage());
    }
    return null;
  }
}

代码示例来源:origin: corcoran/Hangar

protected void launchBilling(Context context, PendingIntent pendingIntent) {
  try {
    Tools.HangarLog("launchBilling!");
    ((Activity) context).startIntentSenderForResult(pendingIntent.getIntentSender(),
        1001, new Intent(), Integer.valueOf(0), Integer.valueOf(0),
        Integer.valueOf(0));
    mAlert.cancel();
  } catch (IntentSender.SendIntentException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
}

代码示例来源:origin: fookwood/Launcher3

@Override
public void startIntentSenderForResult (IntentSender intent, int requestCode,
    Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) {
  onStartForResult(requestCode);
  try {
    super.startIntentSenderForResult(intent, requestCode,
      fillInIntent, flagsMask, flagsValues, extraFlags, options);
  } catch (IntentSender.SendIntentException e) {
    throw new ActivityNotFoundException();
  }
}

代码示例来源:origin: tslamic/premiumer

@Override
public boolean purchase(@NonNull Activity activity, @NonNull String sku, int requestCode,
  @Nullable String payload) {
 try {
  final Bundle bundle = service.getBuyIntent(3, packageName, sku, BILLING_TYPE, payload);
  if (responseOk(bundle)) {
   final PendingIntent pendingIntent = bundle.getParcelable(RESPONSE_BUY_INTENT);
   if (pendingIntent != null) {
    final IntentSender sender = pendingIntent.getIntentSender();
    activity.startIntentSenderForResult(sender, requestCode, null, 0, 0, 0);
    return true;
   }
  }
 } catch (RemoteException | IntentSender.SendIntentException ignore) {
 }
 return false;
}

代码示例来源:origin: alessandrojp/android-easy-checkout

private void startBuyIntent(final Activity activity,
              final PendingIntent pendingIntent,
              int requestCode) throws BillingException {
  IntentSender sender = pendingIntent.getIntentSender();
  try {
    activity.startIntentSenderForResult(sender, requestCode, new Intent(), 0, 0, 0);
  } catch (IntentSender.SendIntentException e) {
    throw new BillingException(Constants.ERROR_SEND_INTENT_FAILED, e.getMessage());
  }
}

代码示例来源:origin: enricocid/LaunchEnr

@Override
  public boolean startConfigActivity(Activity activity, int requestCode) {
    if (getUser().equals(Process.myUserHandle())) {
      return super.startConfigActivity(activity, requestCode);
    }
    try {
      Method m = LauncherApps.class.getDeclaredMethod(
          "getShortcutConfigActivityIntent", LauncherActivityInfo.class);
      IntentSender is = (IntentSender) m.invoke(
          activity.getSystemService(LauncherApps.class), mInfo);
      activity.startIntentSenderForResult(is, requestCode, null, 0, 0, 0);
      return true;
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
  }
}

代码示例来源:origin: microg/android_external_GmsApi

/**
 * Resolves an error by starting any intents requiring user interaction. See
 * {@link CommonStatusCodes#SIGN_IN_REQUIRED}, and {@link CommonStatusCodes#RESOLUTION_REQUIRED}.
 *
 * @param activity    An Activity context to use to resolve the issue. The activity's
 *                    onActivityResult method will be invoked after the user is done. If the
 *                    resultCode is {@link Activity#RESULT_OK}, the application should try to
 *                    connect again.
 * @param requestCode The request code to pass to onActivityResult.
 * @throws SendIntentException If the resolution intent has been canceled or is no longer able
 *                             to execute the request.
 */
public void startResolutionForResult(Activity activity, int requestCode) throws SendIntentException {
  if (hasResolution()) {
    activity.startIntentSenderForResult(resolution.getIntentSender(), requestCode, null, 0, 0, 0);
  }
}

代码示例来源:origin: microg/android_external_GmsApi

/**
   * Resolves an error by starting any intents requiring user interaction. See
   * {@link #SIGN_IN_REQUIRED}, and {@link #RESOLUTION_REQUIRED}.
   *
   * @param activity    An Activity context to use to resolve the issue. The activity's
   *                    {@link Activity#onActivityResult} method will be invoked after the user
   *                    is done. If the resultCode is {@link Activity#RESULT_OK}, the application
   *                    should try to connect again.
   * @param requestCode The request code to pass to {@link Activity#onActivityResult}.
   * @throws IntentSender.SendIntentException If the resolution intent has been canceled or is no
   *                                          longer able to execute the request.
   */
  public void startResolutionForResult(Activity activity, int requestCode) throws
      IntentSender.SendIntentException {
    if (hasResolution()) {
      activity.startIntentSenderForResult(pendingIntent.getIntentSender(), requestCode, null, 0, 0, 0);
    }
  }
}

代码示例来源:origin: tslamic/premiumer

@Test public void purchaseOk() throws Exception {
 final IInAppBillingService service = new SuccessfulBillingService();
 final Activity activity = mock(Activity.class);
 final Billing billing = billing(service);
 final boolean response = billing.purchase(activity, SKU, 0, null);
 assertInvokedOnce(activity).startIntentSenderForResult(null, 0, null, 0, 0, 0);
 assertThat(response).isTrue();
}

代码示例来源:origin: alessandrojp/android-easy-checkout

bundle.putParcelable(Constants.RESPONSE_BUY_INTENT, pendingIntent);
doThrow(new IntentSender.SendIntentException()).when(mActivity).startIntentSenderForResult(
    any(IntentSender.class), anyInt(), any(Intent.class), anyInt(), anyInt(), anyInt());

相关文章

Activity类方法