本文整理汇总了Java中android.app.PendingIntent.FLAG_UPDATE_CURRENT属性的典型用法代码示例。如果您正苦于以下问题:Java PendingIntent.FLAG_UPDATE_CURRENT属性的具体用法?Java PendingIntent.FLAG_UPDATE_CURRENT怎么用?Java PendingIntent.FLAG_UPDATE_CURRENT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.app.PendingIntent
的用法示例。
在下文中一共展示了PendingIntent.FLAG_UPDATE_CURRENT属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
String creator = (String) args[1];
String[] resolvedTypes = (String[]) args[6];
int type = (int) args[0];
int flags = (int) args[7];
if ((PendingIntent.FLAG_UPDATE_CURRENT & flags) != 0) {
flags = (flags & ~(PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_NO_CREATE)) | PendingIntent.FLAG_CANCEL_CURRENT;
}
if (args[5] instanceof Intent[]) {
Intent[] intents = (Intent[]) args[5];
if (intents.length > 0) {
Intent intent = intents[intents.length - 1];
if (resolvedTypes != null && resolvedTypes.length > 0) {
intent.setDataAndType(intent.getData(), resolvedTypes[resolvedTypes.length - 1]);
}
Intent targetIntent = redirectIntentSender(type, creator, intent);
if (targetIntent != null) {
args[5] = new Intent[]{targetIntent};
}
}
}
args[7] = flags;
args[1] = getHostPkg();
// Force userId to 0
if (args[args.length - 1] instanceof Integer) {
args[args.length - 1] = 0;
}
IInterface sender = (IInterface) method.invoke(who, args);
if (sender != null && creator != null) {
VActivityManager.get().addPendingIntent(sender.asBinder(), creator);
}
return sender;
}
示例2: buildIntent
public static PendingIntent buildIntent(Class clazz) {
int flags = PendingIntent.FLAG_UPDATE_CURRENT;
Intent intent = new Intent(NotifyUtil.getInstance().getContext(), clazz);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pi = PendingIntent.getActivity(NotifyUtil.getInstance().getContext(), 0, intent, flags);
return pi;
}
示例3: call
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
String creator = (String) args[1];
args[1] = getHostPkg();
String[] resolvedTypes = (String[]) args[6];
int type = (int) args[0];
if (args[5] instanceof Intent[]) {
Intent[] intents = (Intent[]) args[5];
if (intents.length > 0) {
Intent intent = intents[intents.length - 1];
if (resolvedTypes != null && resolvedTypes.length > 0) {
intent.setDataAndType(intent.getData(), resolvedTypes[resolvedTypes.length - 1]);
}
Intent proxyIntent = redirectIntentSender(type, creator, intent);
if (proxyIntent != null) {
intents[intents.length - 1] = proxyIntent;
}
}
}
if (args.length > 7 && args[7] instanceof Integer) {
args[7] = PendingIntent.FLAG_UPDATE_CURRENT;
}
IInterface sender = (IInterface) method.invoke(who, args);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2 && sender != null && creator != null) {
VActivityManager.get().addPendingIntent(sender.asBinder(), creator);
}
return sender;
}