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

  • Google Россия

    Google Ро

    9 Temmuz 2007
  • Majestic Casual

    Majestic Cas

    28 NİSAN 2012
  • Tomas N

    Tomas N

    14 Kasım 2010