本文整理匯總了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();
}