锁屏通知(Lock screen notifications for Windows Phone 8)

Creating a lock screen icon

Create a 38 x 38 pixel PNG image that will identify your app on the lock screen. The image must contain only white pixels plus some level of transparency.

Update the app manifest file by following these steps:

  1. In Solution Explorer, expand Properties, right-click WMAppManifest.xml, choose Open With, and then select Source Code (Text Editor) With Encoding.

  2. Update the DeviceLockImageURI element inside the Tokens element. Add the full path to your image file, set IsRelative="true" and IsResource="false" as shown in the following code example.

    <DeviceLockImageURI IsRelative="true" IsResource="false">Assets\LockImage.png</DeviceLockImageURI>


Setting app manifest extensions for the lock screen

Next, declare what aspects your app will support in the lock screen notifications area by updating the app manifest file.

  1. In Solution Explorer, expand Properties, right-click WMAppManifest.xml, choose Open With, and then select Source Code (Text Editor) With Encoding.

  2. Add the lock screen wallpaper <Extension> element in the <Extensions> element. If the <Extensions>element doesn’t appear in the file, place the entire following code example in the file. The <Extensions>element must be placed below the <Tokens> element.

<Extensions>
      <Extension ExtensionName="LockScreen_Notification_IconCount" ConsumerID="{111DFF24-AA15-4A96-8006-2BFF8122084F}" TaskID="_default" />
      <Extension ExtensionName="LockScreen_Notification_TextField" ConsumerID="{111DFF24-AA15-4A96-8006-2BFF8122084F}" TaskID="_default" />
    <Extension ExtensionName="LockScreen_Background" ConsumerID="{111DFF24-AA15-4A96-8006-2BFF8122084F}" TaskID="_default" />
</Extensions>

  3. Only include the <Extension> elements that you want to support. If you plan to include your Tile's Count on the lock screen, include the LockScreen_Notification_IconCount extension. If you plan to include text, include the LockScreen_Notification_TextField extension.

Linking the lock screen settings screen from within your app

Consider adding a link to the phone's lock screen settings screen from within your app for your app user’s benefit. This is useful for the user because you can’t programmatically turn off your app as a lock screen background image provider from within the app. The user will need to visit the phone's settings screen and make the change themselves. Providing a link to the settings screen makes this straightforward and easy.

The following code example shows you how you can route a button click to the phone's lock screen settings screen.

private async void btnGoToLockSettings_Click(object sender, RoutedEventArgs e)
{
    // Launch URI for the lock screen settings screen.
    var op = await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings-lock:"));
}

 

 http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj207048(v=vs.105).aspx

转载于:https://www.cnblogs.com/Hack-ok/archive/2013/01/04/2844130.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值