Notification Verhalten unter Android 2.2 und Android 4.0.3 und höher

  • Antworten:3
Gelöschter Account
  • Forum-Beiträge: 35

07.12.2012, 13:07:51 via Website

Hallo Android Freunde.
In meiner App erstelle ich die Notification mit diesem Code:
1public class MainActivity extends Activity {
2
3 @Override
4 protected void onCreate(Bundle savedInstanceState) {
5 super.onCreate(savedInstanceState);
6 setContentView(R.layout.activity_main);
7
8 NotificationManager notificationManager = (NotificationManager)
9 this.getSystemService(this.NOTIFICATION_SERVICE);
10 Notification notification = new Notification(
11 R.drawable.ic_launcher,
12 "test" + 1, System.currentTimeMillis());
13 notification.flags |= Notification.FLAG_AUTO_CANCEL;
14
15 RemoteViews contentView = new RemoteViews(this.getPackageName(),R.layout.test_notif);
16 contentView.setTextViewText(R.id.tv_1, 12 + " "+16);
17 contentView.setTextViewText(R.id.tv_2,8 + " "+ 5);
18 contentView.setTextViewText(R.id.tv_3, "tja" +": "+ 89);
19 contentView.setTextViewText(R.id.tv_4, "hi "+" "+ 100);
20
21 contentView.setTextColor(R.id.tv_1, Color.BLACK);
22 contentView.setTextColor(R.id.tv_2, Color.BLACK);
23 contentView.setTextColor(R.id.tv_3, Color.BLACK);
24 contentView.setTextColor(R.id.tv_4, Color.BLACK);
25
26 notification.number = 7;
27 notification.contentView = contentView;
28 PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, new Intent(), 0);
29 notification.contentIntent = pendingIntent;
30
31 notificationManager.notify(0, notification);
32 }
33}

Das Funktioniert einwandfrei, NUR: wenn ich die App am Smartphone mit Android 2.3.4 teste dann sehe ich das Icon der Notification und ein rotes Kreis mit der Anzahl der Benachrichtigungen (in diesem Fall 7) (Siehe Bild).
Wenn ich die gleiche App an dem Gerät mit Android 4.0.3 und höher ausführe, dann sehe ich nur das Icon und kein Kreis mit der Anzahl der Benachrichtigungen. Das Problem ist, der Kreis und die Anzahl dadrin sollte auf jedem Fall da sein.
Das Projekt wurde für Android 2.2 Platform entwickelt.

Kann mir jemand sagen woran es liegt dass der Kreis einmal bei Android 2.2 da ist und bei 4.0.3 und höher nicht mehr da ist ? Kann man es irgendwie machen dass der Kreis und die Anzeige bei allen Geräten kommt, oder ist es systemabhängig und somit nicht bei jedem Gerät möglich?
MfG.

Antworten
Gelöschter Account
  • Forum-Beiträge: 35

08.12.2012, 10:45:31 via Website

keine Ideen ? kommt schon, kann doch nicht sein

Antworten
Carsten M.
  • Forum-Beiträge: 33.204

08.12.2012, 10:48:20 via App

Du kannst darauf keinen Einfluss nehmen.

Das Icon für "mehr Benachrichtigungen da als in der Statusleiste darstellbar" kommt vom System und wie es aussieht kannst Du nicht beeinflussen.

Das kann bei jedem Gerät anders aussehen.

Herzliche Grüße

Carsten

Ich komm' mir langsam vor wie jemand, der ich bin // #cäthe

Antworten
Gelöschter Account
  • Forum-Beiträge: 35

08.12.2012, 12:49:34 via Website

oh. ok das habe ich schon befürchtet. naja, wenns nicht anders geht, dann lass ich es so wie es ist

Antworten