Android hizmetinden bir bildirim gönderme | Netgez.com
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

  • 24 Канал

    24 КанаÐ

    5 ÅžUBAT 2006
  • CHISTOSITOJAJA

    CHISTOSITOJA

    27 HAZİRAN 2010
  • Erica Griffin

    Erica Griffi

    8 HAZİRAN 2009