当前位置: 首页>>代码示例>>Java>>正文


Java CanceledException类代码示例

本文整理汇总了Java中android.app.PendingIntent.CanceledException的典型用法代码示例。如果您正苦于以下问题:Java CanceledException类的具体用法?Java CanceledException怎么用?Java CanceledException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CanceledException类属于android.app.PendingIntent包,在下文中一共展示了CanceledException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: launchAppForMessage

import android.app.PendingIntent.CanceledException; //导入依赖的package包/类
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);
    }
}
 
开发者ID:bunnyblue,项目名称:NoticeDog,代码行数:19,代码来源:AppManager.java

示例2: forceOpenGPS

import android.app.PendingIntent.CanceledException; //导入依赖的package包/类
/**
 * 强制打开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) {
		}
	}
}
 
开发者ID:TIIEHenry,项目名称:TIIEHenry-Android-SDK,代码行数:36,代码来源:LocationUtil.java

示例3: handleAuthorizationComplete

import android.app.PendingIntent.CanceledException; //导入依赖的package包/类
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);
    }
}
 
开发者ID:openid,项目名称:AppAuth-Android,代码行数:21,代码来源:AuthorizationManagementActivity.java

示例4: handleAuthorizationCanceled

import android.app.PendingIntent.CanceledException; //导入依赖的package包/类
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");
    }
}
 
开发者ID:openid,项目名称:AppAuth-Android,代码行数:18,代码来源:AuthorizationManagementActivity.java

示例5: openGps

import android.app.PendingIntent.CanceledException; //导入依赖的package包/类
/**
 * 强制帮用户打开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();
		}
	}
}
 
开发者ID:WeiChou,项目名称:Wei.Lib2A,代码行数:21,代码来源:GPS.java

示例6: onPositiveGaiaRecoveryDialogResponse

import android.app.PendingIntent.CanceledException; //导入依赖的package包/类
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;
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:24,代码来源:GaiaRecoveryHelper.java

示例7: startPurchaseIntent

import android.app.PendingIntent.CanceledException; //导入依赖的package包/类
/**
 * 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);
		}
	}
}
 
开发者ID:DuongNTdev,项目名称:StudyMovie,代码行数:25,代码来源:BillingController.java

示例8: onSingleTapUp

import android.app.PendingIntent.CanceledException; //导入依赖的package包/类
@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;
}
 
开发者ID:hvmunlimited,项目名称:QuickControlPanel,代码行数:20,代码来源:NotificationViewProvider.java

示例9: clickMenuItemWithUrl

import android.app.PendingIntent.CanceledException; //导入依赖的package包/类
/**
 * 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.");
    }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:25,代码来源:CustomTabIntentDataProvider.java

示例10: run

import android.app.PendingIntent.CanceledException; //导入依赖的package包/类
@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 = "";
		}
	}
}
 
开发者ID:androidertc,项目名称:iLocker,代码行数:24,代码来源:LockerModeDPicture.java

示例11: onPatternDetected

import android.app.PendingIntent.CanceledException; //导入依赖的package包/类
@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);
	}

}
 
开发者ID:androidertc,项目名称:iLocker,代码行数:27,代码来源:LockerModePPattern.java

示例12: onPatternDetected

import android.app.PendingIntent.CanceledException; //导入依赖的package包/类
@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);
	}

}
 
开发者ID:androidertc,项目名称:iLocker,代码行数:27,代码来源:LockerModeCPattern.java

示例13: onPatternDetected

import android.app.PendingIntent.CanceledException; //导入依赖的package包/类
@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);
	}

}
 
开发者ID:androidertc,项目名称:iLocker,代码行数:27,代码来源:LockerModePattern.java

示例14: openNotify

import android.app.PendingIntent.CanceledException; //导入依赖的package包/类
/**
 * ��֪ͨ����Ϣ
 */
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();
    }
}
 
开发者ID:loveNight,项目名称:GrabRedEnvelop,代码行数:19,代码来源:QiangHongBaoService.java

示例15: onCreate

import android.app.PendingIntent.CanceledException; //导入依赖的package包/类
@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();
}
 
开发者ID:solmaks,项目名称:dashclock-notification,代码行数:24,代码来源:ProxyActivity.java


注:本文中的android.app.PendingIntent.CanceledException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。