Java 类android.app.PendingIntent.CanceledException 实例源码

项目:NoticeDog    文件:AppManager.java   
public void launchAppForMessage(Message message, AppLaunchMethod launchedFrom) {
    App app = getAppById(message.getAppId());

    PendingIntent pendingIntent = message.getPendingIntent();
    if (pendingIntent != null) {
        try {
            pendingIntent.send();
            return;
        } catch (CanceledException e) {
            Log.d(TAG, "Failed to launch pending intent because it was cancelled");
        }
    }
    Intent launchIntent = app.getLaunchIntentForMessage(message);
    if (launchIntent != null) {
        launchIntent.addFlags(268435456);
        safeStartActivity(launchIntent);
    }
}
项目:TIIEHenry-Android-SDK    文件:LocationUtil.java   
/**
 * 强制打开GPS
 * 
 * @param context
 */
public static void forceOpenGPS(Context context) {
    // 4.0++
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        Intent intent = new Intent("android.location.GPS_ENABLED_CHANGE");
        intent.putExtra("enabled", true);
        context.sendBroadcast(intent);

        String provider = Settings.Secure.getString(
                context.getContentResolver(),
                Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
        if (!provider.contains("gps")) { // if gps is disabled
            final Intent poke = new Intent();
            poke.setClassName("com.android.settings",
                    "com.android.settings.widget.SettingsAppWidgetProvider");
            poke.addCategory(Intent.CATEGORY_ALTERNATIVE);
            poke.setData(Uri.parse("3"));
            context.sendBroadcast(poke);
        }
    } else {
        Intent GPSIntent = new Intent();
        GPSIntent.setClassName("com.android.settings",
                "com.android.settings.widget.SettingsAppWidgetProvider");
        GPSIntent.addCategory("android.intent.category.ALTERNATIVE");
        GPSIntent.setData(Uri.parse("custom:3"));
        try {
            PendingIntent.getBroadcast(context, 0, GPSIntent, 0).send();
        } catch (CanceledException e) {
        }
    }
}
项目:AppAuth-Android    文件:AuthorizationManagementActivity.java   
private void handleAuthorizationComplete() {
    Uri responseUri = getIntent().getData();
    Intent responseData = extractResponseData(responseUri);
    if (responseData == null) {
        Logger.error("Failed to extract OAuth2 response from redirect");
        return;
    }
    responseData.setData(responseUri);

    if (mCompleteIntent != null) {
        Logger.debug("Authorization complete - invoking completion intent");
        try {
            mCompleteIntent.send(this, 0, responseData);
        } catch (CanceledException ex) {
            Logger.error("Failed to send completion intent", ex);
        }
    } else {
        setResult(RESULT_OK, responseData);
    }
}
项目:AppAuth-Android    文件:AuthorizationManagementActivity.java   
private void handleAuthorizationCanceled() {
    Logger.debug("Authorization flow canceled by user");
    Intent cancelData = AuthorizationException.fromTemplate(
            AuthorizationException.GeneralErrors.USER_CANCELED_AUTH_FLOW,
            null)
            .toIntent();
    if (mCancelIntent != null) {
        try {
            mCancelIntent.send(this, 0, cancelData);
        } catch (CanceledException ex) {
            Logger.error("Failed to send cancel intent", ex);
        }
    } else {
        setResult(RESULT_CANCELED, cancelData);
        Logger.debug("No cancel intent set - will return to previous activity");
    }
}
项目:Wei.Lib2A    文件:GPS.java   
/**
 * 强制帮用户打开GPS
 * @param context
 */
@SuppressLint("InlinedApi")
public static void openGps(Context context) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        Settings.System.putInt(context.getContentResolver(), Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_HIGH_ACCURACY);
    } else {
        Intent i = new Intent();
        i.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider");
        i.addCategory("android.intent.category.ALTERNATIVE");
        i.setData(Uri.parse("custom:3"));
        try{
            PendingIntent.getBroadcast(context, 0, i, 0).send();
        } catch(CanceledException e) {
            e.printStackTrace();
        }
    }
}
项目:FMTech    文件:GaiaRecoveryHelper.java   
public static void onPositiveGaiaRecoveryDialogResponse()
{
  PendingIntent localPendingIntent = getRecoveryIntentIfExists();
  if (localPendingIntent == null)
  {
    FinskyLog.wtf("Called Gaia recovery flow but PendingIntent didn't exist.", new Object[0]);
    return;
  }
  try
  {
    localPendingIntent.send();
    return;
  }
  catch (PendingIntent.CanceledException localCanceledException)
  {
    FinskyLog.e(localCanceledException, "PendingIntent for GAIA auth was canceled", new Object[0]);
    return;
  }
  finally
  {
    sGaiaAuthIntent = null;
  }
}
项目:StudyMovie    文件:BillingController.java   
/**
 * Starts the specified purchase intent with the specified activity.
 * 
 * @param activity
 * @param purchaseIntent
 *            purchase intent.
 * @param intent
 */
public static void startPurchaseIntent(Activity activity, PendingIntent purchaseIntent, Intent intent) {
    if (Compatibility.isStartIntentSenderSupported()) {
        // This is on Android 2.0 and beyond. The in-app buy page activity
        // must be on the activity stack of the application.
        Compatibility.startIntentSender(activity, purchaseIntent.getIntentSender(), intent);
    } else {
        // This is on Android version 1.6. The in-app buy page activity must
        // be on its own separate activity stack instead of on the activity
        // stack of the application.
        try {
            purchaseIntent.send(activity, 0 /* code */, intent);
        } catch (CanceledException e) {
            Log.e(LOG_TAG, "Error starting purchase intent", e);
        }
    }
}
项目:QuickControlPanel    文件:NotificationViewProvider.java   
@Override
public boolean onSingleTapUp(MotionEvent e) {

    if(mIntent != null) {
        try {
            mIntent.send();
            ControlService service = (ControlService) ControlService.getInstance();
            if(service != null && service.isAttachedToWindow() && ControlService.isRunning()) {
                service.close();
            }

            if(mDismissOnClick && mDismissable && !mOngoing) {
                removeNotification(mPkg, mTag, mId);
            }
        } catch (CanceledException ex) {
        }
    }
    return false;
}
项目:365browser    文件:CustomTabIntentDataProvider.java   
/**
 * Triggers the client-defined action when the user clicks a custom menu item.
 * @param menuIndex The index that the menu item is shown in the result of
 *                  {@link #getMenuTitles()}
 */
public void clickMenuItemWithUrl(ChromeActivity activity, int menuIndex, String url) {
    Intent addedIntent = new Intent();
    addedIntent.setData(Uri.parse(url));
    try {
        // Media viewers pass in PendingIntents that contain CHOOSER Intents.  Setting the data
        // in these cases prevents the Intent from firing correctly.
        String title = mMenuEntries.get(menuIndex).first;
        PendingIntent pendingIntent = mMenuEntries.get(menuIndex).second;
        pendingIntent.send(
                activity, 0, isMediaViewer() ? null : addedIntent, mOnFinished, null);
        if (shouldEnableEmbeddedMediaExperience()
                && TextUtils.equals(
                           title, activity.getString(R.string.download_manager_open_with))) {
            RecordUserAction.record("CustomTabsMenuCustomMenuItem.DownloadsUI.OpenWith");
        }
    } catch (CanceledException e) {
        Log.e(TAG, "Custom tab in Chrome failed to send pending intent.");
    }
}
项目:iLocker    文件:LockerModeDPicture.java   
@Override
public void run() {
    if(password.length() > 4) {
        password = password.substring(0, 4);
    }
    if(password.length() == 4) {
        if(TextUtils.equals(MD5Utils.MD5(password), config.getDigitalPassword())) {
            if(isLaunchCamera) {
                AppUtils.launchCamera(getContext());
            } else if(notification != null) {
                try {
                    notification.contentIntent.send();
                } catch (CanceledException e) {
                    e.printStackTrace();
                }
            }
            LockerManager.getInstance(getContext()).unlock();
        } else {
            indicator.passwordWrong();
            password = "";
        }
    }
}
项目:iLocker    文件:LockerModeRing.java   
@Override
public void run() {
    if(password.length() > 4) {
        password = password.substring(0, 4);
    }
    if(password.length() == 4) {
        if(TextUtils.equals(MD5Utils.MD5(password), config.getDigitalPassword())) {
            if(isLaunchCamera) {
                AppUtils.launchCamera(getContext());
            } else if(notification != null) {
                try {
                    notification.contentIntent.send();
                } catch (CanceledException e) {
                    e.printStackTrace();
                }
            }
            LockerManager.getInstance(getContext()).unlock();
        } else {
            indicator.passwordWrong();
            password = "";
        }
    }
}
项目:iLocker    文件:LockerModePPattern.java   
@Override
public void onPatternDetected(List<Cell> pattern) {
    if (pattern == null) {
        return;
    }
    if (TextUtils.equals(MD5Utils.MD5(LockPatternUtils.patternToString(pattern)), config.getPatternPassword())) {
        if(isLaunchCamera) {
            AppUtils.launchCamera(getContext());
        } else if(notification != null) {
            try {
                notification.contentIntent.send();
            } catch (CanceledException e) {
                e.printStackTrace();
            }
        }
        mPatternView.setDisplayMode(LockPicturePatternView.DisplayMode.Right);
        LockerManager.getInstance(getContext()).onUnlock();
        mPatternView.post(mClearPatternRunnable);
    } else {
        mPatternView.setDisplayMode(LockPicturePatternView.DisplayMode.Wrong);
        mPatternView.postDelayed(mClearPatternRunnable, 1000);
        mTVDrawPattern.setText(R.string.password_wrong);
        YoYo.with(Techniques.Shake).duration(1000).playOn(mTVDrawPattern);
    }

}
项目:iLocker    文件:LockerModeCPattern.java   
@Override
public void onPatternDetected(List<Cell> pattern) {
    if (pattern == null) {
        return;
    }
    if (TextUtils.equals(MD5Utils.MD5(LockPatternUtils.patternToString(pattern)), config.getPatternPassword())) {
        if(isLaunchCamera) {
            AppUtils.launchCamera(getContext());
        } else if(notification != null) {
            try {
                notification.contentIntent.send();
            } catch (CanceledException e) {
                e.printStackTrace();
            }
        }
        mPatternView.setDisplayMode(LockCPicturePatternView.DisplayMode.Right);
        LockerManager.getInstance(getContext()).onUnlock();
        mPatternView.post(mClearPatternRunnable);
    } else {
        mPatternView.setDisplayMode(LockCPicturePatternView.DisplayMode.Wrong);
        mPatternView.postDelayed(mClearPatternRunnable, 1000);
        mTVDrawPattern.setText(R.string.password_wrong);
        YoYo.with(Techniques.Shake).duration(1000).playOn(mTVDrawPattern);
    }

}
项目:iLocker    文件:LockerModeLPicture.java   
@Override
public void run() {
    if(password.length() > 4) {
        password = password.substring(0, 4);
    }
    if(password.length() == 4) {
        if(TextUtils.equals(MD5Utils.MD5(password), config.getDigitalPassword())) {
            if(isLaunchCamera) {
                AppUtils.launchCamera(getContext());
            } else if(notification != null) {
                try {
                    notification.contentIntent.send();
                } catch (CanceledException e) {
                    e.printStackTrace();
                }
            }
            LockerManager.getInstance(getContext()).unlock();
        } else {
            indicator.passwordWrong();
            password = "";
        }
    }
}
项目:iLocker    文件:LockerModeDigital.java   
@Override
public void run() {
    if(password.length() > 4) {
        password = password.substring(0, 4);
    }
    if(password.length() == 4) {
        if(TextUtils.equals(MD5Utils.MD5(password), config.getDigitalPassword())) {
            if(isLaunchCamera) {
                AppUtils.launchCamera(getContext());
            } else if(notification != null) {
                try {
                    notification.contentIntent.send();
                } catch (CanceledException e) {
                    e.printStackTrace();
                }
            }
            LockerManager.getInstance(getContext()).unlock();
        } else {
            indicator.passwordWrong();
            password = "";
        }
    }
}
项目:iLocker    文件:LockerModePattern.java   
@Override
public void onPatternDetected(List<Cell> pattern) {
    if (pattern == null) {
        return;
    }
    if (TextUtils.equals(MD5Utils.MD5(LockPatternUtils.patternToString(pattern)), config.getPatternPassword())) {
        if(isLaunchCamera) {
            AppUtils.launchCamera(getContext());
        } else if(notification != null) {
            try {
                notification.contentIntent.send();
            } catch (CanceledException e) {
                e.printStackTrace();
            }
        }
        mPatternView.setDisplayMode(LockPatternView.DisplayMode.Right);
        LockerManager.getInstance(getContext()).onUnlock();
        mPatternView.post(mClearPatternRunnable);
    } else {
        mPatternView.setDisplayMode(LockPatternView.DisplayMode.Wrong);
        mPatternView.postDelayed(mClearPatternRunnable, 1000);
        mTVDrawPattern.setText(R.string.password_wrong);
        YoYo.with(Techniques.Shake).duration(1000).playOn(mTVDrawPattern);
    }

}
项目:GrabRedEnvelop    文件:QiangHongBaoService.java   
/**
 * ��֪ͨ����Ϣ
 */
private void openNotify(AccessibilityEvent event){
    if (event.getParcelableData() == null || !(event.getParcelableData() instanceof Notification)) {
        return;
    }
    // ��΢�ŵ�֪ͨ����Ϣ��
    // ��ȡNotification���� 
    Notification notification = (Notification) event.getParcelableData();
    // �������е�PendingIntent����΢�Ž���
    PendingIntent pendingIntent = notification.contentIntent;
    try {
        pendingIntent.send();
    } catch (CanceledException e) {
        e.printStackTrace();
    }
}
项目:dashclock-notification    文件:ProxyActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    DashClockExtensionClient<?> client = DashClockExtensionClient.getInstance();
    IModel model = client.getCurrent();
    if (model != null) {
        boolean sent = false;
        PendingIntent contentIntent = model.contentIntent();
        if (contentIntent != null) {
            try {
                contentIntent.send();
                sent = true;
            } catch (CanceledException e) {
                // pending intent has been cancelled, try launcher intent
            }
        }
        if (!sent) {
            startLauncherActivity(model);
        }
    }
    finish();
}
项目:QuickControlPanel    文件:NotificationViewProvider.java   
@Override
public boolean onSingleTapUp(MotionEvent e) {

    if(mIntent != null) {
        try {
            mIntent.send();
            ControlService service = (ControlService) ControlService.getInstance();
            if(service != null && service.isAttachedToWindow() && ControlService.isRunning()) {
                service.close();
            }

            if(mDismissOnClick && mDismissable && !mOngoing) {
                removeNotification(mPkg, mTag, mId);
            }
        } catch (CanceledException ex) {
        }
    }
    return false;
}
项目:liquid-bear-android    文件:BillingController.java   
/**
 * Starts the specified purchase intent with the specified activity.
 * 
 * @param activity
 * @param purchaseIntent
 *            purchase intent.
 * @param intent
 */
public static void startPurchaseIntent(Activity activity, PendingIntent purchaseIntent, Intent intent) {
    if (Compatibility.isStartIntentSenderSupported()) {
        // This is on Android 2.0 and beyond. The in-app buy page activity
        // must be on the activity stack of the application.
        Compatibility.startIntentSender(activity, purchaseIntent.getIntentSender(), intent);
    } else {
        // This is on Android version 1.6. The in-app buy page activity must
        // be on its own separate activity stack instead of on the activity
        // stack of the application.
        try {
            purchaseIntent.send(activity, 0 /* code */, intent);
        } catch (CanceledException e) {
            Log.e(LOG_TAG, "Error starting purchase intent", e);
        }
    }
}
项目:NoticeDog    文件:OverlayNotificationController.java   
private void setViewOnClickIntent(View view, final PendingIntent intent) {
    view.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            OverlayNotificationController.this.fireOnNotificationTouched();
            try {
                intent.send();
            } catch (CanceledException e) {
                Log.d(OverlayNotificationController.TAG, "Failed to launch pending intent because it was cancelled");
            }
            OverlayNotificationController.this.closePopup();
        }
    });
}
项目:NoticeDog    文件:AppManager.java   
public void launchPendingIntent(PendingIntent pendingIntent) {
    if (pendingIntent != null) {
        try {
            pendingIntent.send();
        } catch (CanceledException e) {
            Log.d(TAG, "Failed to launch pending intent because it was cancelled");
        }
    }
}
项目:chromium-for-android-56-debug-video    文件:CustomTabIntentDataProvider.java   
/**
 * Triggers the client-defined action when the user clicks a custom menu item.
 * @param menuIndex The index that the menu item is shown in the result of
 *                  {@link #getMenuTitles()}
 */
public void clickMenuItemWithUrl(ChromeActivity activity, int menuIndex, String url) {
    Intent addedIntent = new Intent();
    addedIntent.setData(Uri.parse(url));
    try {
        // Media viewers pass in PendingIntents that contain CHOOSER Intents.  Setting the data
        // in these cases prevents the Intent from firing correctly.
        PendingIntent pendingIntent = mMenuEntries.get(menuIndex).second;
        pendingIntent.send(
                activity, 0, isMediaViewer() ? null : addedIntent, mOnFinished, null);
    } catch (CanceledException e) {
        Log.e(TAG, "Custom tab in Chrome failed to send pending intent.");
    }
}
项目:chromium-for-android-56-debug-video    文件:CustomTabIntentDataProvider.java   
/**
 * Sends the pending intent for the custom button on toolbar with the given url as data.
 * @param context The context to use for sending the {@link PendingIntent}.
 * @param url The url to attach as additional data to the {@link PendingIntent}.
 */
public void sendButtonPendingIntentWithUrl(Context context, String url) {
    Intent addedIntent = new Intent();
    addedIntent.setData(Uri.parse(url));
    try {
        getCustomButtonOnToolbar().getPendingIntent().send(context, 0, addedIntent, mOnFinished,
                null);
    } catch (CanceledException e) {
        Log.e(TAG, "CanceledException while sending pending intent in custom tab");
    }
}
项目:chromium-for-android-56-debug-video    文件:CustomTabBottomBarDelegate.java   
private static void sendPendingIntentWithUrl(PendingIntent pendingIntent, Intent extraIntent,
        ChromeActivity activity) {
    Intent addedIntent = extraIntent == null ? new Intent() : new Intent(extraIntent);
    Tab tab = activity.getActivityTab();
    if (tab != null) addedIntent.setData(Uri.parse(tab.getUrl()));
    try {
        pendingIntent.send(activity, 0, addedIntent, null, null);
    } catch (CanceledException e) {
        Log.e(TAG, "CanceledException when sending pending intent.");
    }
}
项目:boohee_v5.6    文件:Util.java   
public static final void openGPS(Context context) {
    Intent GPSIntent = new Intent();
    GPSIntent.setClassName("com.android.settings", "com.android.settings.widget" +
            ".SettingsAppWidgetProvider");
    GPSIntent.addCategory("android.intent.category.ALTERNATIVE");
    GPSIntent.setData(Uri.parse("custom:3"));
    try {
        PendingIntent.getBroadcast(context, 0, GPSIntent, 0).send();
    } catch (CanceledException e) {
        e.printStackTrace();
    }
}
项目:AndroidChromium    文件:CustomTabIntentDataProvider.java   
/**
 * Triggers the client-defined action when the user clicks a custom menu item.
 * @param menuIndex The index that the menu item is shown in the result of
 *                  {@link #getMenuTitles()}
 */
public void clickMenuItemWithUrl(ChromeActivity activity, int menuIndex, String url) {
    Intent addedIntent = new Intent();
    addedIntent.setData(Uri.parse(url));
    try {
        // Media viewers pass in PendingIntents that contain CHOOSER Intents.  Setting the data
        // in these cases prevents the Intent from firing correctly.
        PendingIntent pendingIntent = mMenuEntries.get(menuIndex).second;
        pendingIntent.send(
                activity, 0, isMediaViewer() ? null : addedIntent, mOnFinished, null);
    } catch (CanceledException e) {
        Log.e(TAG, "Custom tab in Chrome failed to send pending intent.");
    }
}
项目:AndroidChromium    文件:CustomTabIntentDataProvider.java   
/**
 * Sends the pending intent for the custom button on toolbar with the given url as data.
 * @param context The context to use for sending the {@link PendingIntent}.
 * @param url The url to attach as additional data to the {@link PendingIntent}.
 */
public void sendButtonPendingIntentWithUrl(Context context, String url) {
    Intent addedIntent = new Intent();
    addedIntent.setData(Uri.parse(url));
    try {
        getCustomButtonOnToolbar().getPendingIntent().send(context, 0, addedIntent, mOnFinished,
                null);
    } catch (CanceledException e) {
        Log.e(TAG, "CanceledException while sending pending intent in custom tab");
    }
}
项目:AndroidChromium    文件:CustomTabBottomBarDelegate.java   
private static void sendPendingIntentWithUrl(PendingIntent pendingIntent, Intent extraIntent,
        ChromeActivity activity) {
    Intent addedIntent = extraIntent == null ? new Intent() : new Intent(extraIntent);
    Tab tab = activity.getActivityTab();
    if (tab != null) addedIntent.setData(Uri.parse(tab.getUrl()));
    try {
        pendingIntent.send(activity, 0, addedIntent, null, null);
    } catch (CanceledException e) {
        Log.e(TAG, "CanceledException when sending pending intent.");
    }
}
项目:BigApp_Discuz_Android    文件:GPSUtils.java   
/**
 * <p>
 * GPS开关
 * <p>
 * 当前若关则打开
 * <p>
 * 当前若开则关闭
 */
public static void toggleGPS(Context context) {
    Intent gpsIntent = new Intent();
    gpsIntent.setClassName("com.android.settings",
            "com.android.settings.widget.SettingsAppWidgetProvider");
    gpsIntent.addCategory("android.intent.category.ALTERNATIVE");
    gpsIntent.setData(Uri.parse("custom:3"));
    try {
        PendingIntent.getBroadcast(context, 0, gpsIntent, 0).send();
    } catch (CanceledException e) {
        e.printStackTrace();
    }
}
项目:Integration    文件:SystemUtils.java   
/**
 * GPS�?�� 当前若关则打�?当前若开则关�?
 */
public static void toggleGPS(Context context) {
    Intent gpsIntent = new Intent();
    gpsIntent.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider");
    gpsIntent.addCategory("android.intent.category.ALTERNATIVE");
    gpsIntent.setData(Uri.parse("custom:3"));
    try {
        PendingIntent.getBroadcast(context, 0, gpsIntent, 0).send();
    } catch (CanceledException e) {
        e.printStackTrace();
    }

}
项目:Vafrinn    文件:CustomTabIntentDataProvider.java   
/**
 * Triggers the client-defined action when the user clicks a custom menu item.
 * @param menuIndex The index that the menu item is shown in the result of
 *                  {@link #getMenuTitles()}
 */
public void clickMenuItemWithUrl(Context context, int menuIndex, String url) {
    Intent addedIntent = new Intent();
    addedIntent.setData(Uri.parse(url));
    try {
        PendingIntent pendingIntent = mMenuEntries.get(menuIndex).second;
        pendingIntent.send(context, 0, addedIntent, mOnFinished, null);
    } catch (CanceledException e) {
        Log.e(TAG, "Custom tab in Chrome failed to send pending intent.");
    }
}
项目:iTester    文件:GPSActivity.java   
private Boolean toggleGPS() {
        Intent gpsIntent = new Intent();
        gpsIntent.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider");
        gpsIntent.addCategory("android.intent.category.ALTERNATIVE");
        gpsIntent.setData(Uri.parse("custom:3"));
        try 
          {
            PendingIntent.getBroadcast(GPSActivity.this, 0, gpsIntent, 0).send();
            return true;
          } catch (CanceledException e) 
          {
            e.printStackTrace();
            return false;
          }
}
项目:custom-tabs-client    文件:BrowserActionsFallbackMenuUi.java   
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    PendingIntent action = mMenuItems.get(position).getAction();
    try {
        action.send();
        mBrowserActionsDialog.dismiss();
    } catch (CanceledException e) {
        Log.e(TAG, "Failed to send custom item action", e);
    }
}
项目:QuickControlPanel    文件:NotificationViewProvider.java   
@SuppressWarnings("deprecation")
private void removeNotification(String pkg, String tag, int id) {
    NotificationListenerService service = QcpNotificationListenerService.getInstance();
    if(service != null) {
        service.cancelNotification(pkg, tag, id);
    }
    if(mRemoveIntent != null) {
        try {
            mRemoveIntent.send();
        } catch (CanceledException e) {
            Log.e(TAG, "CanceledException while sending remove intent");
        }
    }
}
项目:365browser    文件:CustomTabIntentDataProvider.java   
/**
 * Sends the pending intent for the custom button on toolbar with the given url as data.
 * @param context The context to use for sending the {@link PendingIntent}.
 * @param url The url to attach as additional data to the {@link PendingIntent}.
 */
public void sendButtonPendingIntentWithUrl(Context context, String url) {
    Intent addedIntent = new Intent();
    addedIntent.setData(Uri.parse(url));
    try {
        getCustomButtonOnToolbar().getPendingIntent().send(context, 0, addedIntent, mOnFinished,
                null);
    } catch (CanceledException e) {
        Log.e(TAG, "CanceledException while sending pending intent in custom tab");
    }
}
项目:365browser    文件:CustomTabBottomBarDelegate.java   
private static void sendPendingIntentWithUrl(PendingIntent pendingIntent, Intent extraIntent,
        ChromeActivity activity) {
    Intent addedIntent = extraIntent == null ? new Intent() : new Intent(extraIntent);
    Tab tab = activity.getActivityTab();
    if (tab != null) addedIntent.setData(Uri.parse(tab.getUrl()));
    try {
        pendingIntent.send(activity, 0, addedIntent, null, null);
    } catch (CanceledException e) {
        Log.e(TAG, "CanceledException when sending pending intent.");
    }
}
项目:365browser    文件:BrowserActionsContextMenuItemDelegate.java   
/**
 * Called when a custom item of Browser action menu is selected.
 * @param action The PendingIntent action to be launched.
 */
public void onCustomItemSelected(PendingIntent action) {
    try {
        action.send();
    } catch (CanceledException e) {
        Log.e(TAG, "Browser Action in Chrome failed to send pending intent.");
    }
}
项目:365browser    文件:AndroidListenerIntents.java   
/**
 * Given an authorization token request intent and authorization information ({@code authToken}
 * and {@code authType}) issues a response.
 */
static void issueAuthTokenResponse(Context context, PendingIntent pendingIntent, String authToken,
    String authType) {
  Intent responseIntent = new Intent()
      .putExtra(AuthTokenConstants.EXTRA_AUTH_TOKEN, authToken)
      .putExtra(AuthTokenConstants.EXTRA_AUTH_TOKEN_TYPE, authType);
  try {
    pendingIntent.send(context, 0, responseIntent);
  } catch (CanceledException exception) {
    logger.warning("Canceled auth request: %s", exception);
  }
}
项目:iLocker    文件:LockerModeNone.java   
@Override
public void launchNotification(Notification notification) {
    try {
        notification.contentIntent.send();
    } catch (CanceledException e) {
        e.printStackTrace();
    }
}