當前位置: 首頁>>代碼示例>>Java>>正文


Java StatusBarNotification.isOngoing方法代碼示例

本文整理匯總了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)));
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:10,代碼來源:ModLedControl.java

示例2: shouldIgnoreNotification

import android.service.notification.StatusBarNotification; //導入方法依賴的package包/類
private boolean shouldIgnoreNotification(StatusBarNotification sbn) {
    return getPackageName().equals(sbn.getPackageName()) || !sbn.isClearable() || sbn.isOngoing();
}
 
開發者ID:sdrausty,項目名稱:buildAPKsApps,代碼行數:4,代碼來源:ClearService.java

示例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");
        }
    }
}
 
開發者ID:j4velin,項目名稱:HueNotifier,代碼行數:42,代碼來源:NotificationListener.java


注:本文中的android.service.notification.StatusBarNotification.isOngoing方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。