Build Windows 8 style apps quickly 33-Build badge Alerts

Source: Internet
Author: User

Original: Quickly build Windows 8 style Apps 33-Build badge Reminders

Introduction

Windows Phone (8&7.5) and Windows 8 introduced the concept of lock screen, actually done by the Windows Phone 7.5 app developers know that the 7.5 era of mobile phone lock screen is not supported by third-party developers. So now our third-party developers can develop their own app's information in Windows 8 and Windows Phone 8 's lock screen interface.

The Windows 8 lock screen has three uses:

    1. Prevent accidental login attempts on touch devices;
    2. To provide users with a personalized interface;
    3. Display streamlined information to users: Date and time, network status and battery status, notifications from limited applications;

First, lock screen reminders overview

The Windows 8 lock screen can display up to 7 apps at a time. All 7 apps can display badges and toasts, but only one of the apps will be allowed to display the text of their latest tile notifications.

We can add the app that you want to display on the lock screen in PC settings.

For more details on the lock screen, see: Lock Screen Overview (Windows Store app) (Windows).

Ii. Building App Lock screen reminders

A badge is a number or glyph that appears in the lower-right corner (or lower-left corner) of the tile, and is often used to indicate the app state.

The badge is an overlay on the tile, not part of the tile itself, and the badge can be updated with notifications.

So how do we declare a simple app lock screen reminder?

1. Configure the app manifest file

    • On the Application UI tab, select Badge logo, select Lock screen Notification, and specify the badge logo.

    • "Claim" Select the card to add "background tasks", select "Supported Task Types" (Note: The lock screen app must declare "control channel", "Timer", "Push notification" three types of background task type), set "Application Settings".

2. Add a Namespace

   1:  using Windows.UI.Notifications;
   2:  using Windows.Data.Xml.Dom;

Where Windows.UI.Notifications contains the badge API.

3. Select Show numbers or glyphs on the badge

A badge can display a number 0-99 or a system-defined set of state glyphs.

Show numbers:

   1:  XmlDocument badgexml = badgeupdatemanager.gettemplatecontent (Badgetemplatetype.badgenumber);

or display glyphs:

   1:  XmlDocument badgexml = badgeupdatemanager.gettemplatecontent (badgetemplatetype.badgeglyph);

4. Assigning values to the lock screen app

Assigning numeric values:

   1:  XmlElement badgeelement = (XmlElement) badgexml.selectsinglenode ("/badge");
   2:  badgeelement.setattribute ("value""7");

or assign Glyph values:

   1:  XmlElement badgeelement = (XmlElement) badgexml.selectsinglenode ("/badge");
   2:  badgeelement.setattribute ("value""newmessage");

5. Create a badge alert and send it to a badge

Send our well-defined XML to the badge.

   1:  new badgenotification (badgexml);
   2:  badgeupdatemanager.createbadgeupdaterforapplication (). Update (badge);

Finally, we can also pass badgeupdatemanager.createbadgeupdaterforapplication (). The clear () method clears the badge, and the lock screen reminder can be cleared through the cloud.

With these steps we can make a badge for an app.

For more information on building badges, refer to:

    • QuickStart: Sending badge updates (Windows Store apps using C#/vb/c++ and XAML) (Windows)
    • QuickStart: Displaying tile and badge updates on the lock screen (Windows Store apps) (Windows)
Third, lock screen reminder best practices

Because Microsoft officially gives our developers a very detailed approach to lock screen reminders best practices, here is a brief mention.

For example: When an app displays a number on a badge, and the number is greater than 50, then we recommend using the system glyph type.

More detailed information on badge best practices can be found in: Tile and badge guides and checklists (Windows Store apps) (Windows).

Build Windows 8 style apps quickly 33-Build badge Alerts

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.