【问题标题】:Notification animation, only on Galaxy nexus通知动画,仅在 Galaxy nexus 上
【发布时间】:2012-10-03 20:56:57
【问题描述】:

我有一个前台服务,通知我每秒更新一次作为计时器。这在我的 android 4.1 模拟器上运行良好。在 Galaxy Nexus 手机上,通知显示为新通知,每次更新时都有动画。这是为什么?相同的 android 版本,但我只在 Galaxy Nexus 上发现了这种行为。

private void postNotification(Context context, int notificationId, String title, String text, String ticker, boolean service) {
    Intent intent = new Intent(context, MyActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP);        
    PendingIntent contentIntent = PendingIntent.getActivity(context, notificationId, intent, 0);

    @SuppressWarnings("static-access")
    NotificationManager nm = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
    NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
    builder.setContentTitle(title);
    builder.setContentText(text);
    if(ticker.length() > 0)
        builder.setTicker(ticker);      
    builder.setSmallIcon(R.drawable.notification);
    builder.setContentIntent(contentIntent);
    builder.setOngoing(service);

    nm.notify(null, notificationId, builder.getNotification()); 
    startForeground(notificationId, builder.getNotification());
}   

【问题讨论】:

    标签: android notifications galaxy foreground


    【解决方案1】:

    这是另一个在通知栏中作为服务运行的应用程序导致了这种行为。在卸载该应用程序后工作。

    【讨论】:

      猜你喜欢
      • 2013-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多