如何在android中做通知?

Aju*_*Aju 5 android android-notifications

我在android上做一个帮助台应用程序.我想为未读票证(客户建议或投诉)实施通知.在这个应用程序的iPhone版本中,即使应用程序没有在应用程序图标本身上打开未读票证的计数器,它是否可能在Android中.如果这样请帮我实现像iPhone一样,否则帮我实现正常的Android通知未读票.

谢谢

Ras*_*sel 9

叫这个方法

private void triggerNotification(String s) {
    CharSequence title = "Hello";
    CharSequence message = s;
    NotificationManager notificationManager;
    notificationManager = (NotificationManager) context
            .getSystemService("notification");
    Notification notification;
    notification = new Notification(
            com.yourPackage.R.drawable.notification, "Notifiy.. ",
            System.currentTimeMillis());
    PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
        null, 0);
    notification.setLatestEventInfo(context, title, message, pendingIntent);
    notificationManager.notify(1010, notification);
}
Run Code Online (Sandbox Code Playgroud)