本文整理匯總了Java中android.service.notification.StatusBarNotification.isOngoing方法的典型用法代碼示例。如果您正苦於以下問題:Java StatusBarNotification.isOngoing方法的具體用法?Java StatusBarNotification.isOngoing怎麽用?Java StatusBarNotification.isOngoing使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.service.notification.StatusBarNotification
的用法示例。
在下文中一共展示了StatusBarNotification.isOngoing方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isHeadsUpAllowed
import android.service.notification.StatusBarNotification; //導入方法依賴的package包/類
private static boolean isHeadsUpAllowed(StatusBarNotification sbn, Context context) {
if (context == null) return false;
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
Notification n = sbn.getNotification();
return (pm.isInteractive() &&
keyguardAllowsHeadsUp(context) &&
(!sbn.isOngoing() || n.fullScreenIntent != null || (n.extras.getInt("headsup", 0) != 0)));
}
示例2: shouldIgnoreNotification
import android.service.notification.StatusBarNotification; //導入方法依賴的package包/類
private boolean shouldIgnoreNotification(StatusBarNotification sbn) {
return getPackageName().equals(sbn.getPackageName()) || !sbn.isClearable() || sbn.isOngoing();
}
示例3: onNotificationPosted
import android.service.notification.StatusBarNotification; //導入方法依賴的package包/類
@Override
public void onNotificationPosted(final StatusBarNotification notification) {
if (!notification.getPackageName().equals("android")
&& (!ignoreLowPriority || notification
.getNotification().priority > Notification.PRIORITY_MIN)
&& (!ignoreOnGoing || !notification.isOngoing())) {
long current = System.currentTimeMillis();
String pkg = notification.getPackageName();
if (current - lastTime < TIME_THRESHOLD && lastPackage.equals(pkg)) {
if (BuildConfig.DEBUG)
Logger.log("ignore duplicate notification from " + pkg);
return;
}
ConnectivityManager cm =
(ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
boolean isWiFi = activeNetwork.getType() == ConnectivityManager.TYPE_WIFI;
if (isWiFi) {
lastTime = current;
lastPackage = pkg;
Collection<String> people = null;
if (Build.VERSION.SDK_INT >= 19) {
people = notification
.getNotification().extras.getStringArrayList(Notification.EXTRA_PEOPLE);
}
if (BuildConfig.DEBUG)
Logger.log(
"received notification from " + lastPackage + ", people=" + people);
Database db = Database.getInstance(this);
if (db.contains(lastPackage)) {
String pattern = db.getPattern(lastPackage, people);
startService(new Intent(this, ColorFlashService.class)
.putExtra("lights", Util.getLights(pattern))
.putExtra("colors", Util.getColors(pattern)));
}
db.close();
} else if (BuildConfig.DEBUG) {
Logger.log("Not connected to WiFi network --> ignore");
}
}
}