微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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,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,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,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,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,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,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,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,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();
}
项目: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,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,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,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,addedIntent,"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,null,"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).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,"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,"CanceledException while sending pending intent in custom tab");
    }
}
项目:AndroidChromium    文件CustomTabBottomBarDelegate.java   
private static void sendPendingIntentWithUrl(PendingIntent pendingIntent,"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,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",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,String url) {
    Intent addedIntent = new Intent();
    addedIntent.setData(Uri.parse(url));
    try {
        PendingIntent pendingIntent = mMenuEntries.get(menuIndex).second;
        pendingIntent.send(context,"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).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,"CanceledException while sending pending intent in custom tab");
    }
}
项目:365browser    文件CustomTabBottomBarDelegate.java   
private static void sendPendingIntentWithUrl(PendingIntent pendingIntent,"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 @R_103_4045@ion ({@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,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();
    }
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。