本文整理汇总了Java中android.app.PendingIntent.CanceledException方法的典型用法代码示例。如果您正苦于以下问题:Java PendingIntent.CanceledException方法的具体用法?Java PendingIntent.CanceledException怎么用?Java PendingIntent.CanceledException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.PendingIntent
的用法示例。
在下文中一共展示了PendingIntent.CanceledException方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onClick
import android.app.PendingIntent; //导入方法依赖的package包/类
@Override
public void onClick(View view) {
final Launcher launcher = Launcher.getLauncher(view.getContext());
Bundle activityOptions = launcher.getActivityLaunchOptions(view);
try {
if (AndroidVersion.isAtLeastMarshmallow)
intent.send(null, 0, null, null, null, null, activityOptions);
else
intent.send(null, 0, null, null, null, null);
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
if (autoCancel) {
launcher.getPopupDataProvider().cancelNotification(notificationKey);
}
PopupContainerWithArrow.getOpen(launcher).close(true);
}
示例2: openNotify
import android.app.PendingIntent; //导入方法依赖的package包/类
/**
* 打开通知栏消息
*/
private void openNotify(AccessibilityEvent event) {
if (event.getParcelableData() == null || !(event.getParcelableData() instanceof Notification)) {
return;
}
Notification notification = (Notification) event.getParcelableData();
if (notification == null) {
return;
}
PendingIntent pendingIntent = notification.contentIntent;
try {
pendingIntent.send();
if (mHandler == null) {
mHandler = new MHandler();
}
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
clickMoneyAndKey();
}
}, 200);
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
示例3: onClick
import android.app.PendingIntent; //导入方法依赖的package包/类
@Override
public void onClick(View view) {
// Usually this is done in BrowserMenuViewHolder.onClick(), but that also tries to submit
// the click up to the fragment, which we explicitly don't want here:
if (menu != null) {
menu.dismiss();
}
if (pendingIntent == null) {
throw new IllegalStateException("No PendingIntent set for CustomTabMenuItemViewHolder");
}
try {
final Intent intent = new Intent();
intent.setData(Uri.parse(browserFragment.getUrl()));
pendingIntent.send(view.getContext(), 0, intent);
} catch (PendingIntent.CanceledException e) {
// There's really nothing we can do here...
}
TelemetryWrapper.customTabMenuEvent();
}
示例4: openGPS
import android.app.PendingIntent; //导入方法依赖的package包/类
public static 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 (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
示例5: onReceive
import android.app.PendingIntent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) {
case Installer.ACTION_INSTALL_COMPLETE:
case Installer.ACTION_UNINSTALL_COMPLETE:
refreshUpdatesList();
unregisterInstallReceiver();
break;
case Installer.ACTION_INSTALL_INTERRUPTED:
case Installer.ACTION_UNINSTALL_INTERRUPTED:
unregisterInstallReceiver();
break;
case Installer.ACTION_INSTALL_USER_INTERACTION:
case Installer.ACTION_UNINSTALL_USER_INTERACTION:
PendingIntent uninstallPendingIntent =
intent.getParcelableExtra(Installer.EXTRA_USER_INTERACTION_PI);
try {
uninstallPendingIntent.send();
} catch (PendingIntent.CanceledException ignored) { }
break;
}
}
示例6: onReceive
import android.app.PendingIntent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) {
case Installer.ACTION_INSTALL_STARTED:
break;
case Installer.ACTION_INSTALL_COMPLETE:
localBroadcastManager.unregisterReceiver(this);
showRelevantView(true);
break;
case Installer.ACTION_INSTALL_INTERRUPTED:
localBroadcastManager.unregisterReceiver(this);
// TODO: handle errors!
break;
case Installer.ACTION_INSTALL_USER_INTERACTION:
PendingIntent installPendingIntent =
intent.getParcelableExtra(Installer.EXTRA_USER_INTERACTION_PI);
try {
installPendingIntent.send();
} catch (PendingIntent.CanceledException e) {
Log.e(TAG, "PI canceled", e);
}
break;
default:
throw new RuntimeException("intent action not handled!");
}
}
示例7: openNotification
import android.app.PendingIntent; //导入方法依赖的package包/类
/**
* 打开通知栏消息
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void openNotification(AccessibilityEvent event) {
if (event.getParcelableData() == null || !(event.getParcelableData() instanceof Notification)) {
return;
}
//以下是精华,将微信的通知栏消息打开
Notification notification = (Notification) event.getParcelableData();
PendingIntent pendingIntent = notification.contentIntent;
try {
pendingIntent.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
示例8: sendNotifacationReply
import android.app.PendingIntent; //导入方法依赖的package包/类
/**
* 拉起微信界面
* @param event
*/
private void sendNotifacationReply(AccessibilityEvent event) {
hasAction = true;
if (event.getParcelableData() != null
&& event.getParcelableData() instanceof Notification) {
Notification notification = (Notification) event
.getParcelableData();
String content = notification.tickerText.toString();
String[] cc = content.split(":");
name = cc[0].trim();
scontent = cc[1].trim();
PendingIntent pendingIntent = notification.contentIntent;
try {
pendingIntent.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
}
示例9: watchNotifications
import android.app.PendingIntent; //导入方法依赖的package包/类
private boolean watchNotifications(AccessibilityEvent event) {
// Not a notification
if (event.getEventType() != AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED)
return false;
// Not a hongbao
String tip = event.getText().toString();
if (!tip.contains(WECHAT_NOTIFICATION_TIP)) return true;
Parcelable parcelable = event.getParcelableData();
if (parcelable instanceof Notification) {
Notification notification = (Notification) parcelable;
try {
/* 清除signature,避免进入会话后误判 */
signature.cleanSignature();
notification.contentIntent.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
return true;
}
示例10: send
import android.app.PendingIntent; //导入方法依赖的package包/类
public static void send(String room, String message) throws IllegalArgumentException { // @author ManDongI
Notification.Action session = null;
for(KakaoData data : KakaoManager.getInstance().getDataList().toArray(new KakaoData[0])) {
if(data.room.equals(room)) {
session = data.session;
break;
}
}
if(session == null) {
throw new IllegalArgumentException("Can't find the room");
}
Intent sendIntent = new Intent();
Bundle msg = new Bundle();
for (RemoteInput inputable : session.getRemoteInputs()) msg.putCharSequence(inputable.getResultKey(), message);
RemoteInput.addResultsToIntent(session.getRemoteInputs(), sendIntent, msg);
try {
session.actionIntent.send(context, 0, sendIntent);
Logger.Log log = new Logger.Log();
log.type = Logger.Type.APP;
log.title = "send message";
log.index = "room: " + room +"\nmessage: " + message;
Logger.getInstance().add(log);
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
示例11: openNotify
import android.app.PendingIntent; //导入方法依赖的package包/类
/** 打开通知栏消息*/
private void openNotify(AccessibilityEvent event) {
if(event.getParcelableData() == null || !(event.getParcelableData() instanceof Notification)) {
return;
}
Notification notification = (Notification) event.getParcelableData();
PendingIntent pendingIntent = notification.contentIntent;
try {
pendingIntent.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
示例12: onResponse
import android.app.PendingIntent; //导入方法依赖的package包/类
@Override
public void onResponse(String response) {
try {
ArrayList<RssItem> rssItems = parser.parse(new String(response.getBytes("ISO-8859-1")));
Intent result = new Intent();
result.putParcelableArrayListExtra(PARCELABLE_EXTRAS, rssItems);
reply.send(RssService.this, FETCH_SUCCESS, result);
} catch (PendingIntent.CanceledException | UnsupportedEncodingException e) {
Log.e(TAG, "onHandleIntent error", e);
}
}
示例13: onClickStartTestApk
import android.app.PendingIntent; //导入方法依赖的package包/类
public void onClickStartTestApk(View v) {
Log.i("onClickStartTestApk", "Yay I was clicked.");
mFullName.setText("Start Test Apk button pushed!");
if (intents.containsKey("gov.nasa.arc.irg.test_guest_science_apk")) {
PendingIntent start_apk_intent = intents.get("gov.nasa.arc.irg.test_guest_science_apk");
try {
start_apk_intent.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
} else {
Log.e("MainActivity", "Couldn't start test gs apk since we don't have a pending intent.");
}
}
示例14: onHandleIntent
import android.app.PendingIntent; //导入方法依赖的package包/类
@Override
protected void onHandleIntent(@Nullable Intent intent) {
Log.i(TAG, "onhandleIntent: ");
final PendingIntent pi = intent.getParcelableExtra(Constants.PI_KEY);
final Integer first = intent.getIntExtra(Constants.FIRST_KEY, 0);
final Integer second = intent.getIntExtra(Constants.SECOND_KEY, 0);
try {
Integer result = first + second;
TimeUnit.SECONDS.sleep(5);
Intent resultIntent = new Intent().putExtra(Constants.RESULT_KEY, result);
pi.send(CalcIntentService.this, Constants.SERVICE_RESULT, resultIntent);
} catch (InterruptedException | PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
示例15: openAppByNotification
import android.app.PendingIntent; //导入方法依赖的package包/类
/**
* 根据收到的[通知事件] 打开通知
* @param event
*/
public void openAppByNotification(AccessibilityEvent event) {
if (event.getParcelableData() != null && event.getParcelableData() instanceof Notification) {
Notification notification = (Notification) event.getParcelableData();
// 获取通知的内容 ...
String content = notification.tickerText.toString();
try {
PendingIntent pendingIntent = notification.contentIntent;
pendingIntent.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
}