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

  • Disney Pets and Animals

    Disney Pets

    29 ŞUBAT 2012
  • KarnasCamillo

    KarnasCamill

    24 EKİM 2007
  • lilstevie89

    lilstevie89

    25 Mart 2011