win8_livetile_tile_notification

Send a notification to the game's live tile.

Syntax:

win8_livetile_tile_notification(template, ds_map, expiry, tag);


Argument Description
template The template that the live tile notification should take (see below)
ds_map A ds_map that contains the information for the notification
expiry How long the notification should be shown
tag The name "tag" of the notification


Returns: N/A


Description

This function will "push" a notification through to the live tile associated with your game. What exact information is sent will depend greatly on the template that you choose to use (you can find a complete list of the available templates here), as each template requires a different combination of text and/or images.

The ds_map that is sent along with the template, must contains the appropriate key-value pairs for that template, so for each entry the key should refer to the tag name of an element and the value (which can be either a single value or an array of multiple entries, in which case you should add them into a ds_list, then embed the ds_list into the ds_map). The tag names themselves can only be either "image" or "text", and the image can be either from a local source (in which case the directory to get the file from must be proceeded by ms-appx:///. See the examples given below.) or from a given URL.

The expiry is the time that the notification should be removed at and is best calculated using the GameMaker: Studio Date and Time functions, as shown in the functions below (setting this to -1 will show the notification indefinitely until you use the win8_livetile_tile_clear.

Finally you have the queue "tag". This is a string that you assign to the notification as a means to identify it later, should you need to replace it or update it with another one. in this case you would formulate another notification push with this function and use the same tag as that which you wish to change/replace.



NOTE: You can only queue up to 5 Live Tile notifications, and you must have activated queuing with the function win8_livetile_queue_enable.


Example:

var expiryTime, tileText, tileImage, tileData;
expiryTime = date_current_datetime();
expiryTime = date_inc_minute(expiryTime, 5);
tileText = ds_list_create();
ds_list_add(tileText, "C.T.H.");
ds_list_add(tileText, "This game is paused and awaiting your return!");
tileImage = ds_list_create();
ds_list_add(tileImage, "ms-appx:///" + working_directory + "WideTile_Screenshot.png");
ds_list_add(tileImage, "ms-appx:///" + working_directory + "MiniLogo.png");
tileData = ds_map_create();
ds_map_add(tileData, "text", tileText);
ds_map_add(tileData, "image", tileImage);
win8_livetile_tile_notification("tileWidePeekImage05", tileData, expiryTime, "Paused");
ds_list_destroy(tileText);
ds_list_destroy(tileImage);
ds_map_destroy(tileData);

The above code is for a wide tile, and it needs two lines of text (a header, and one line of long text), and two images (one large one for the whole tile, and one smaller one for beside the text), as this template will switch between the main image and the image/text combination. You need to add the text into a ds_list, with the first entry being the header, and then add the images into another, separate, ds_list, again, with the first image being the larger. Finally you add the text and the image lists into the ds_map, assigning them the appropriate key, and then use the function to send them to the live tile.


Back: Windows 8
Next: win8_livetile_tile_clear
© Copyright YoYo Games Ltd. 2018 All Rights Reserved