private void cancelNotification(int userId, int id, String pkg) { id = VNotificationManager.get().dealNotificationId(id, pkg, null, userId); String tag = VNotificationManager.get().dealNotificationTag(id, pkg, null, userId); nm.cancel(tag, id); }
private void postNotification(int userId, int id, String pkg, Notification notification) { id = VNotificationManager.get().dealNotificationId(id, pkg, null, userId); String tag = VNotificationManager.get().dealNotificationTag(id, pkg, null, userId); // VNotificationManager.get().dealNotification(id, notification, pkg); VNotificationManager.get().addNotification(id, tag, pkg, userId); try { nm.notify(tag, id, notification); } catch (Throwable e) { e.printStackTrace(); } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { String pkg = MethodParameterUtils.replaceFirstAppPkg(args); if (getHostPkg().equals(pkg)) { return method.invoke(who, args); } String tag = (String) args[1]; int id = (int) args[2]; id = VNotificationManager.get().dealNotificationId(id, pkg, tag, getAppUserId()); tag = VNotificationManager.get().dealNotificationTag(id, pkg, tag, getAppUserId()); args[1] = tag; args[2] = id; return method.invoke(who, args); } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { String pkg = (String) args[0]; if (getHostPkg().equals(pkg)) { return method.invoke(who, args); } int notificationIndex = ArrayUtils.indexOfFirst(args, Notification.class); int idIndex = ArrayUtils.indexOfFirst(args, Integer.class); int tagIndex = (Build.VERSION.SDK_INT >= 18 ? 2 : 1); int id = (int) args[idIndex]; String tag = (String) args[tagIndex]; id = VNotificationManager.get().dealNotificationId(id, pkg, tag, getAppUserId()); tag = VNotificationManager.get().dealNotificationTag(id, pkg, tag, getAppUserId()); args[idIndex] = id; args[tagIndex] = tag; //key(tag,id) Notification notification = (Notification) args[notificationIndex]; if (!VNotificationManager.get().dealNotification(id, notification, pkg)) { return 0; } VNotificationManager.get().addNotification(id, tag, pkg, getAppUserId()); args[0] = getHostPkg(); if (Build.VERSION.SDK_INT >= 18 && args[1] instanceof String) { args[1] = getHostPkg(); } return method.invoke(who, args); } }
private void cancelNotification(int userId, int id, String pkg) { id = VNotificationManager.get().dealNotificationId(id, pkg, null, userId); String tag = VNotificationManager.get().dealNotificationTag(id, pkg, null, userId); nm.cancel(tag, id); }
private void cancelNotification(int userId, int id, String pkg) { id = VNotificationManager.get().dealNotificationId(id, pkg, null, userId); String tag = VNotificationManager.get().dealNotificationTag(id, pkg, null, userId); nm.cancel(tag, id); }
private void postNotification(int userId, int id, String pkg, Notification notification) { id = VNotificationManager.get().dealNotificationId(id, pkg, null, userId); String tag = VNotificationManager.get().dealNotificationTag(id, pkg, null, userId); // VNotificationManager.get().dealNotification(id, notification, pkg); VNotificationManager.get().addNotification(id, tag, pkg, userId); try { nm.notify(tag, id, notification); } catch (Throwable e) { e.printStackTrace(); } }
private void postNotification(int userId, int id, String pkg, Notification notification) { id = VNotificationManager.get().dealNotificationId(id, pkg, null, userId); String tag = VNotificationManager.get().dealNotificationTag(id, pkg, null, userId); // VNotificationManager.get().dealNotification(id, notification, pkg); VNotificationManager.get().addNotification(id, tag, pkg, userId); try { nm.notify(tag, id, notification); } catch (Throwable e) { e.printStackTrace(); } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { String pkg = MethodParameterUtils.replaceFirstAppPkg(args); if (getHostPkg().equals(pkg)) { return method.invoke(who, args); } String tag = (String) args[1]; int id = (int) args[2]; id = VNotificationManager.get().dealNotificationId(id, pkg, tag, getAppUserId()); tag = VNotificationManager.get().dealNotificationTag(id, pkg, tag, getAppUserId()); args[1] = tag; args[2] = id; return method.invoke(who, args); } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { String pkg = MethodParameterUtils.replaceFirstAppPkg(args); if (getHostPkg().equals(pkg)) { return method.invoke(who, args); } String tag = (String) args[1]; int id = (int) args[2]; id = VNotificationManager.get().dealNotificationId(id, pkg, tag, getAppUserId()); tag = VNotificationManager.get().dealNotificationTag(id, pkg, tag, getAppUserId()); args[1] = tag; args[2] = id; return method.invoke(who, args); } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { String pkg = (String) args[0]; if (getHostPkg().equals(pkg)) { return method.invoke(who, args); } int notificationIndex = ArrayUtils.indexOfFirst(args, Notification.class); int idIndex = ArrayUtils.indexOfFirst(args, Integer.class); int tagIndex = (Build.VERSION.SDK_INT >= 18 ? 2 : 1); int id = (int) args[idIndex]; String tag = (String) args[tagIndex]; id = VNotificationManager.get().dealNotificationId(id, pkg, tag, getAppUserId()); tag = VNotificationManager.get().dealNotificationTag(id, pkg, tag, getAppUserId()); args[idIndex] = id; args[tagIndex] = tag; //key(tag,id) Notification notification = (Notification) args[notificationIndex]; if (!VNotificationManager.get().dealNotification(id, notification, pkg)) { return 0; } VNotificationManager.get().addNotification(id, tag, pkg, getAppUserId()); args[0] = getHostPkg(); if (Build.VERSION.SDK_INT >= 18 && args[1] instanceof String) { args[1] = getHostPkg(); } return method.invoke(who, args); } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { String pkg = (String) args[0]; if (getHostPkg().equals(pkg)) { return method.invoke(who, args); } int notificationIndex = ArrayUtils.indexOfFirst(args, Notification.class); int idIndex = ArrayUtils.indexOfFirst(args, Integer.class); int tagIndex = (Build.VERSION.SDK_INT >= 18 ? 2 : 1); int id = (int) args[idIndex]; String tag = (String) args[tagIndex]; id = VNotificationManager.get().dealNotificationId(id, pkg, tag, getAppUserId()); tag = VNotificationManager.get().dealNotificationTag(id, pkg, tag, getAppUserId()); args[idIndex] = id; args[tagIndex] = tag; //key(tag,id) Notification notification = (Notification) args[notificationIndex]; if (!VNotificationManager.get().dealNotification(id, notification, pkg)) { return 0; } VNotificationManager.get().addNotification(id, tag, pkg, getAppUserId()); args[0] = getHostPkg(); if (Build.VERSION.SDK_INT >= 18 && args[1] instanceof String) { args[1] = getHostPkg(); } return method.invoke(who, args); } }