Dan Ardelean
@danardelean
dan.ardelean@live.com
small: 99x99
medium: 336x336
   wide: 691x336
small: 99x99
medium: 336x336
   wide: 691x336




wide center crops
to medium
small: 110x110
medium: 202x202
white with
transparency only

crop tight on
horizontal
API              Front Count Front Title
                 Front Count Front Title   Front Image Back Content Back Title Back ImageMulti Tile
                                            Front Image Back Content Back Title Back      Multi Tile   XML
                                                                               Image
Push             Yes
                 Yes          Yes
                               Yes         Yes
                                            Yes        Yes
                                                        Yes         Yes
                                                                     Yes       Yes
                                                                                 Yes      Yes
                                                                                            Yes        Yes
ShellTile        Yes
                 Yes          Yes
                               Yes         Yes
                                           Partial
                                            Yes        Yes
                                                        Yes         Yes
                                                                     Yes       Yes
                                                                               Partial
                                                                                 Yes      Yes
                                                                                            Yes        Yes
ShellTileSchedule Yes
                  No
                  Yes         Yes
                              No
                               Yes         Yes
                                            Yes        Yes
                                                       No
                                                        Yes         Yes
                                                                    No
                                                                     Yes       Yes
                                                                               NoYes      Yes
                                                                                            Yes        Yes
http://ow.ly/hanGP

                        <AppExtra xmlns="" AppPlatformVersion="8.0">
                                <Extra Name="Tiles"/>
                        </AppExtra>




  private static Version TargetedVersion = new Version(7, 10, 8858);
  public static bool IsTargetedVersion {get{return Environment.OSVersion.Version >= TargetedVersion;}}
http://mangopollo.codeplex.com/
• Le tile secondary non sono usate


• Count solo se la Tile principale ha Count




• Local Shell Tiles API
• Push Notifications
WMAppManifest.xml
 <Extension ExtensionName="LockScreen_Background"
 ConsumerID="{111DFF24-AA15-4A96-8006-2BFF8122084F"
 TaskID="_default" />
Uri imageUri = new Uri("ms-appx:///background1.png", UriKind.RelativeOrAbsolute);
 LockScreen.SetImageUri(imageUri);




Uri imageUri = new Uri("ms-appdata:///local/background2.png", UriKind.RelativeOrAbsolute);
LockScreen.SetImageUri(imageUri);
New updates
   from
Background
  Agent
•   Tiles           •   Display UI
•   Toast           •   XNA libraries
•   Location        •   Microphone and camera
•   Network         •   Sensors
•   R/W ISO store   •   Play audio
•   Sockets             (may only use background
                        audio APIs)
– Utilizzo di memoria<= 6 MB
– Viene cancellato dopo 2 crash consecutivi
– Utilizzo di memoria<= 6 MB
– Viene cancellato dopo 2 crash consecutivi
namespace LocationLogTaskAgent
{
    public class ScheduledAgent : ScheduledTaskAgent
    {
        protected override void OnInvoke(ScheduledTask task)
        {
            //TODO: Add code to perform your task in background
            NotifyComplete();
        }
    }
}
public bool LoadLogFromIsolatedStorageFile()
{
    mut.WaitOne(); // Wait until it is safe to enter

    try   {
           // read the file here
           return true;
    }
    catch {
          LogText = "";
          return false;
    }
    finally {
        mut.ReleaseMutex(); // Release the Mutex.
    }
}
PeriodicTask t;
t = ScheduledActionService.Find(taskName) as PeriodicTask;
bool found = (t != null);
if (!found)
{
    t = new PeriodicTask(taskName);
}
t.Description = description;
t.ExpirationTime = DateTime.Now.AddDays(10);
if (!found)
{
    ScheduledActionService.Add(t);
}
else
{
    ScheduledActionService.Remove(taskName);
    ScheduledActionService.Add(t);
}
#if DEBUG_AGENT
 ScheduledActionService.LaunchForTest(taskName, TimeSpan.FromSeconds(60));
#endif
Il background agent non viene sospeso dopo 2
settimane se:

1. L’applicazione ha Tiles sulla Start Screen
   • e l’agent chiama ShellTile.Update da PeriodicTask


2. L’applicazione usa Lock Screen
   • Count o detailed status (anche senza Tile sulla Start Screen)
   • Background image provider quando chiama SetImageUri
___________________________________________________




                                              Dan Ardelean
                                              @danardelean
                                              dan.ardelean@neologics.eu

Windows Phone Live Apps: tile, notifiche, lock screen e servizi in background

  • 1.
  • 7.
  • 8.
    small: 99x99 medium: 336x336 wide: 691x336 wide center crops to medium
  • 9.
    small: 110x110 medium: 202x202 whitewith transparency only crop tight on horizontal
  • 11.
    API Front Count Front Title Front Count Front Title Front Image Back Content Back Title Back ImageMulti Tile Front Image Back Content Back Title Back Multi Tile XML Image Push Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes ShellTile Yes Yes Yes Yes Yes Partial Yes Yes Yes Yes Yes Yes Partial Yes Yes Yes Yes ShellTileSchedule Yes No Yes Yes No Yes Yes Yes Yes No Yes Yes No Yes Yes NoYes Yes Yes Yes
  • 15.
    http://ow.ly/hanGP <AppExtra xmlns="" AppPlatformVersion="8.0"> <Extra Name="Tiles"/> </AppExtra> private static Version TargetedVersion = new Version(7, 10, 8858); public static bool IsTargetedVersion {get{return Environment.OSVersion.Version >= TargetedVersion;}}
  • 17.
  • 21.
    • Le tilesecondary non sono usate • Count solo se la Tile principale ha Count • Local Shell Tiles API • Push Notifications
  • 25.
    WMAppManifest.xml <Extension ExtensionName="LockScreen_Background" ConsumerID="{111DFF24-AA15-4A96-8006-2BFF8122084F" TaskID="_default" />
  • 26.
    Uri imageUri =new Uri("ms-appx:///background1.png", UriKind.RelativeOrAbsolute); LockScreen.SetImageUri(imageUri); Uri imageUri = new Uri("ms-appdata:///local/background2.png", UriKind.RelativeOrAbsolute); LockScreen.SetImageUri(imageUri);
  • 28.
    New updates from Background Agent
  • 30.
    Tiles • Display UI • Toast • XNA libraries • Location • Microphone and camera • Network • Sensors • R/W ISO store • Play audio • Sockets (may only use background audio APIs)
  • 31.
    – Utilizzo dimemoria<= 6 MB – Viene cancellato dopo 2 crash consecutivi
  • 32.
    – Utilizzo dimemoria<= 6 MB – Viene cancellato dopo 2 crash consecutivi
  • 34.
    namespace LocationLogTaskAgent { public class ScheduledAgent : ScheduledTaskAgent { protected override void OnInvoke(ScheduledTask task) { //TODO: Add code to perform your task in background NotifyComplete(); } } }
  • 35.
    public bool LoadLogFromIsolatedStorageFile() { mut.WaitOne(); // Wait until it is safe to enter try { // read the file here return true; } catch { LogText = ""; return false; } finally { mut.ReleaseMutex(); // Release the Mutex. } }
  • 36.
    PeriodicTask t; t =ScheduledActionService.Find(taskName) as PeriodicTask; bool found = (t != null); if (!found) { t = new PeriodicTask(taskName); } t.Description = description; t.ExpirationTime = DateTime.Now.AddDays(10); if (!found) { ScheduledActionService.Add(t); } else { ScheduledActionService.Remove(taskName); ScheduledActionService.Add(t); }
  • 37.
  • 40.
    Il background agentnon viene sospeso dopo 2 settimane se: 1. L’applicazione ha Tiles sulla Start Screen • e l’agent chiama ShellTile.Update da PeriodicTask 2. L’applicazione usa Lock Screen • Count o detailed status (anche senza Tile sulla Start Screen) • Background image provider quando chiama SetImageUri
  • 44.
    ___________________________________________________ Dan Ardelean @danardelean dan.ardelean@neologics.eu

Editor's Notes

  • #3 Flips from front to backSmall size does not flipMedium size is the same as the WP7.1 tile templateSet as many tiles as you want (must go to different URIs)
  • #4 Abbiamo da 1 a 9 imagesSmall tile does not cycle
  • #5 Displays a small image in the center of the Tile and is designed to reflect Windows Phone design principles
  • #6 (same payload as Push Notifications!)
  • #7 Image size must be less than 150 KB (up from 80KB in WP7.1)Download time must not exceed 45 seconds (down from 60 seconds in 7.1)Lowest update time resolution is 60 minutesIf the schedule for an indefinite or finite number of updates fails too many times, OS will cancel it
  • #8 Background immagine di default nel caso che l’utente non ha mai apretolàapplicazione
  • #9 End user can choose a background image from their own photos or search for an image on BingIn addition, they can choose an app to be the background image providerFor your app to be a lock screen background provider, all you have to do is: Declare the app’s intent in the application manifest fileFornireanchel’imagine di default DefaultLockScreen.jpg Write code to change the background image
  • #10 It is limited in what it can do and the access it has to the processor and other phone facilities
  • #11 This code uses the Find(String) method to obtain a reference to the PeriodicTask with the specified name. If the scheduled task object is not null, then you should call Remove(String) to unregister the agent with the system. You cannot update agents directly. You must remove and then add. When you create a new PeriodicTask object, you assign its name in the constructor. You must also set the Description property as this property is required for Periodic agents and is used to describe the agent to the user in the background tasks Settings page on the device. Call Add(ScheduledAction) to register the Periodic agent with the system. An InvalidOperationException is thrown when Add is called if the user has disabled background agents for the application, so the call should be placed in a try block. If the call throws an exception, verify the message string of the exception. If the string is “BNS Error: The action is disabled”, then you should alert the user that background agents have been disabled. 
  • #12 It would be annoying if we had to wait 30 minutes to get code in the agent running so we could debug itWhen we are debugging we can force the service to launch the agentSuch code can be conditionally compiled and excluded from the release build
  • #13 To help maximize the battery life of the device, there is a hard limit on the number of periodic agents that can be scheduled on the phone. It varies per device configuration and can be as low as 6. There is another limit, which is lower than the hard limit, after which the user is warned that they have multiple background agents running and may, therefore, experience faster battery consumption.
  • #15 Maximum outstanding requests in the queue per application (this includes active and pending requests).25 – Transfers are not removed from the queue automatically when they complete. Applications should use Remove(BackgroundTransferRequest) to remove completed transfers from the queue to keep the slots free for new transfers.Maximum concurrent transfers across all applications on the device2Maximum queued transfers across all applications on the device500Maximum number of HTTP headers per request15Maximum size of HTTP headers16 KB each