SORU
30 Temmuz 2009, PERŞEMBE


Android hizmetinden bir bildirim gönderme

Bir hizmet olarak çalışan var, ve bir bildirim göndermek ister. Çok kötü, bildirim nesne bir bağlam, bir Faaliyet, bir hizmet gibi değil gerektirir.

Bunu geçmek için herhangi bir yol biliyor musunuz ? Çirkin görünüyor her bildirim bu bir Etkinlik oluşturmak için çalıştı, ve herhangi bir manzarası olmayan bir Faaliyet başlatmak için bir yol bulamıyorum.

CEVAP
30 Temmuz 2009, PERŞEMBE


Her ikisi de Activity Service aslında sadece ** 6 içinde Service this kullanabilirsiniz 3* Context *.

NotificationManager notificationManager =
    (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Notification notification = new Notification(/* your notification */);
PendingIntent pendingIntent = /* your intent */;
notification.setLatestEventInfo(this, /* your content */, pendingIntent);
notificationManager.notify(/* id */, notification);

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Blue Lightning TV

    Blue Lightni

    9 EKİM 2011
  • max2sims2

    max2sims2

    19 Kasım 2008
  • sghaff1

    sghaff1

    23 Mart 2009