Notification is useful class in android.
You can see easily notification in your phone when if you received SMS or email, etc...
This is my code.
- NotificationManager nm=(NotificationManager)mContext.getSystemService(mContext.NOTIFICATION_SERVICE);
- int icon=setIcon(weathericon);
- PendingIntent pi=PendingIntent.getActivity(mContext, 0, new Intent(mContext,MainActivity.class),0);
- if(dbnotify.equals("notifyUse")){
- }else if(dbnotify.equals("notifyOngoing")){
- }
- notification.setLatestEventInfo(mContext, name, weather, pi);
- nm.notify(notifyId,notification);
I not use vibration& sound. If you will use vibration& sound that add this code
You can see to above notification bar "날씨가 업데이트 되었습니다."
The code making that notification bar.
Notification was deprecated but possibly to use.
If you down scroll notification bar that can see this picture.
- PendingIntent pi=PendingIntent.getActivity(mContext, 0, new Intent(mContext,MainActivity.class),0);
- notification.setLatestEventInfo(mContext, name, weather, pi);
Pending intent is set will moving activity when you touched notification.
setLatesetEventinfo is notification data.
This flag is notification property.
If you want ongoing mode that need this code
No comments:
Post a Comment