本文整理汇总了Java中android.app.PendingIntent.CanceledException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java CanceledException.printStackTrace方法的具体用法?Java CanceledException.printStackTrace怎么用?Java CanceledException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.PendingIntent.CanceledException
的用法示例。
在下文中一共展示了CanceledException.printStackTrace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
}
}
示例2: 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 = "";
}
}
}
示例3: 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);
}
}
示例4: 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);
}
}
示例5: 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);
}
}
示例6: 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();
}
}
示例7: openGPS
import android.app.PendingIntent.CanceledException; //导入方法依赖的package包/类
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();
}
}
示例8: toggleGPS
import android.app.PendingIntent.CanceledException; //导入方法依赖的package包/类
/**
* <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();
}
}
示例9: toggleGPS
import android.app.PendingIntent.CanceledException; //导入方法依赖的package包/类
/**
* 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();
}
}
示例10: toggleGPS
import android.app.PendingIntent.CanceledException; //导入方法依赖的package包/类
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;
}
}
示例11: launchNotification
import android.app.PendingIntent.CanceledException; //导入方法依赖的package包/类
@Override
public void launchNotification(Notification notification) {
try {
notification.contentIntent.send();
} catch (CanceledException e) {
e.printStackTrace();
}
}
示例12: openOrCloseGPS
import android.app.PendingIntent.CanceledException; //导入方法依赖的package包/类
public void openOrCloseGPS() {
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();
}
}
示例13: prepareResult
import android.app.PendingIntent.CanceledException; //导入方法依赖的package包/类
public void prepareResult() {
//Intent intent = getIntent();
//PendingIntent pi = intent.getParcelableExtra(Commons.PARAM_PINTENT);
PendingIntent pendingIntent;
Intent result = new Intent();
//result.setClass(mContext, KidsDialerMainActivity.class);
pendingIntent = PendingIntent.getActivity(mContext, 0, result, 0);
Configs.saveResultForMain(this, dataChanged);
if (dataChanged) {
Intent returnIntent = new Intent();
returnIntent.putExtra(Commons.PARAM_DATACHANGED, dataChanged);
setResult(RESULT_OK, returnIntent);
result.putExtra(Commons.PARAM_DATACHANGED, dataChanged);
try {
pendingIntent.send(FavoritesManagerActivity.this, Commons.STATUS_FINISH,
result);
} catch (CanceledException e) {
Log.e(e.getMessage());
e.printStackTrace();
}
}
}
示例14: trigger
import android.app.PendingIntent.CanceledException; //导入方法依赖的package包/类
/**
* State of event has changed to true.
* For conditional monitors, activate periodic monitor of metric. For event
* notification monitors, notify client with Intent, then clear tree and
* remove monitor.
*/
public synchronized void trigger() {
if (DebugLog.DEBUG) Log.d(TAG, "ConditionTree.trigger - tree has changed state");
if (metric < 0) {
if (triggered) return;
triggered = true;
try {
callback.send();
// Intent i = new Intent();
// i.setAction(callback);
// MyApplication.getAppContext().sendBroadcast(i);
// callback.send(Message.obtain(null, Metrics.COMPOUND_METRIC));
} catch (CanceledException e) {
if (DebugLog.INFO) Log.i(TAG, "ConditionTree.trigger - event callback failed");
e.printStackTrace();
}
serviceHandler.post(new Runnable() {
public void run() {
root.deactivate();
removeTree();
}
});
}
else {
if (triggered) {
if (DebugLog.WARNING) Log.w(TAG, "ConditionTree.trigger - unexpected entry, already true state");
}
else {
triggered = true;
final MetricService<?> metricService = MetricService.getService(metric);
if (metricService == null) {
if (DebugLog.WARNING) Log.w("NDroid", "ConditionTree.trigger - Error, unknown metric: " +
metric);
// throw new RemoteException();
return;
}
// TODO add eavesdrop option to conditional monitor
metricService.registerClient(metric, monitorId, period, duration, false,
callbackMsgr);
}
}
// NDroidService.eventHandler.postDelayed(new emptyTree(), 5000);
}
示例15: run
import android.app.PendingIntent.CanceledException; //导入方法依赖的package包/类
@Override
public void run() {
Intent intent1 = new Intent(action);
intent1.setClassName("com.example.hacklango", "com.example.hacklango.MyReceiver");
intent1.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
mContext.sendBroadcast(intent1);
Log.d("MyTag", "sent intent1");
ContentResolver cr = mContext.getContentResolver();
Cursor cur = cr.query(
Uri.parse("content://sms/draft"),//inbox is also ok
new String[] { "_id", "person", "date", "body" },
null,
null,
"date DESC");
if (cur.moveToFirst()) {
long id = cur.getLong(0);
String body = cur.getString(3);
Log.d("MyTag", id+": "+body);
Intent intent = new Intent();
intent.setAction(action);
intent.setClassName("com.zlango.zms",
"com.zlango.zms.transaction.ZmsSentReceiver");
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
String uri = "content://sms/"+id;
intent.setData(Uri.parse(uri));
mContext.sendBroadcast(intent);
PendingIntent sentPI = PendingIntent.getBroadcast(mContext, 0, intent, 0);
try {
sentPI.send(Activity.RESULT_OK);
Log.d("MyTag", "sentPI.send ok: "+uri);
} catch (CanceledException e) {
e.printStackTrace();
}
}
cur.close();
}