No. No. 0 homepage, mobile app shortcut portal

Source: Internet
Author: User



No. No. 0 homepage, mobile app shortcut portal



Our existing applications all use the Android notification bar as a "traditional notification" purpose, such as text messages, and QQ are all used in this way. However, in the same area, there are innovative ways to use it, such as the earliest music playback control, and Baidu search has begun to occupy the notification bar as a shortcut entry for its applications, see the attached picture.



























From the success of mobile app evaluation, "occupy the first three screens of mobile phones", to now installed a large number of application apps, in fact, in addition to a few commonly used, the rest in the sleep of ice, it is difficult to actively think of "Find-click" The use of the process.



However, after Android3.0, with the ongoing (running), can be from a technical point of view to occupy the user's fastest mobile phone entry, the realization of "No. No. 0 Home". As an entertainment tool-based application, Solomo check-in (Checkin), LBS class inquiry, personal bookkeeping, but also provide "rich-functional Way" notification reminders and notification reminders of the back-to-action, some quick tool operations. As the enterprise application, work order reminder and quick operation, attendance check-up and so on.



Of course, the use of this "occupation and strong retention" approach, first of all to ensure that their application "usable, easy to use", or the work/enterprise application "must be used", otherwise annoying rogue class application to occupy the opposite, let people more quickly download.


Technology implementation


Android in the new Notification Alert service, added the ongoing option, notification.flag_ongoing_event, to achieve "in-run" notification reminders, that is, can be resident in the notification bar, to achieve "forever notice" and attach other actions on the notification.



For "Other operations", as the information system commonly used buttons, text, pictures, lists, etc. can be added to display. Use the remoteviews mechanism to implement a customized view in the "No. 0 home" area.



The custom layout of notification is remoteviews, which supports only framelayout, LinearLayout, relativelayout three layout controls and AnalogClock in Custom view layout files, Chronometer, Button, ImageButton, ImageView, ProgressBar, TextView, Viewflipper, ListView, GridView, StackView and Adapterviewflipper These display controls, do not support subclasses of these classes or other controls provided by Android.



At the same time, notification can combine sound, tri-color lights, vibrations, and screen reminders for a better user experience.



A reference sample, code:


public void Addongoingnotify () {notificationcompat.builder-mbuilder = new Builder (this); Remoteviews mremoteviews = new Remoteviews (Getpackagename (), r.layout.view_notify);





Mremoteviews.setimageviewresource (r.id.notify_ongoing_icon_1, r.drawable.notify_ongoing_icon_2);



Mremoteviews.settextviewtext (R.id.txt_label, "Far map Future");



Mremoteviews.setviewvisibility (R.id._notify_button, view.visible);



Mremoteviews.setimageviewresource (R.id.btn_notify_1, r.drawable.btn_notify_2);



Button action Handling



Intent buttonintent = new Intent (Action_button);



Buttonintent.putextra (Intent_buttonid_tag, button_prev_id);



Pendingintent Intent_prev = Pendingintent.getbroadcast (this, 1, buttonintent, pendingintent.flag_update_current);



Mremoteviews.setonclickpendingintent (R.id.btn_notify_1, Intent_prev);






Mbuilder.setcontent (Mremoteviews)



. Setcontentintent (Getdefalutintent (notification.flag_ongoing_event))



. Setsmallicon (R.drawable.notify_ongoing_icon_2)



. SetPriority (Notification.priority_default)



. Setwhen (System.currenttimemillis ())



. Setticker ("Resident Notice @ Abundance Laboratory module")



. Setongoing (True);



Notification notify = Mbuilder.build ();



Notify.flags = notification.flag_ongoing_event;



Mnotificationmanager.notify (Notifyid, notify);



}






Set Vibration: setvibrate (long[] pattern)



Set tri-color lamp: Setlights (Intledargb, Intledonms, INTLEDOFFMS)



Set Voice: Setsound (Uri sound)






Technical support is fundamental, and the application scenario is full of infinite imagination. We are happiest to innovate and design new products or applications from existing technology solutions.



Address of this article,http://blog.xufun.cn/?p=660



No. No. 0 homepage, mobile app shortcut portal


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.