Usage Summary of notification bar for Android programming

This article summarizes the usage of notification bar in Android programming. Share with you for your reference, as follows:

I haven't used the notification function of Android for a long time. Today, I moved out the code two years ago and found that many methods have been abandoned. I'm very unhappy with all kinds of delete lines in the code. So, open Google, view the official documents, and learn the latest method of sending notification bar messages.

The code in this article is written with reference to Google's official documents:

http://developer.android.com/guide/topics/ui/notifiers/notifications.html

1. First, obtain the notification service of the system:

2. Send the simplest notification

3. Delete a notification. The parameter is the ID of the notification

4. Send a notification, click the notification and jump to an activity. After returning from this activity, enter a page in the program (usually the home page)

At the same time, you need to specify the parent activity for the activity opened after clicking the notification in the manifest

(among them, the attribute parentactivityname of activity is the attribute in API 16, and the code in meta data is below API 16. Therefore, for most programs, these two places have to be written.)

5. Similar to the above 4, it only returns to the home page when returning from the open activity

6. Notification with progress bar

7. Notification of extended layout. Press and hold the notification bar to view more details

8. Customize the notification bar of the layout. (according to Google's official documents, this is not recommended because there are too many factors to consider when using this method to adapt different screens. Moreover, the notification bar should display the most concise information, which is enough for the default layout of most programs.)

For more Android related content, readers who are interested can view the topics on this site: introduction and advanced tutorial of Android development, summary of Android debugging skills and common problem solutions, summary of Android multimedia operation skills (audio, video, recording, etc.), summary of Android basic component usage, summary of Android view skills Android layout skills summary and Android control usage summary

I hope this article will help you in Android programming.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>