I find different instructions, for making Live Tile of Windows 8.1 app update in the background using IBackgroundTask. Others include this row
await BackgroundExecutionManager.RequestAccessAsync();
others not.
Question is, is it required for the background updating of Live Tile to work? I do NOT need lock screen access in my app, just updating Live Tile.
If you want to run a lock-screen capable background task then you need to call the RequestAccessAsync(). Here are your options:
You can create a background task that updates the live tile doesn't need lock-screen access. If you want it to run periodically regardless of whether it is plugged in, you need to RequestAccessAsync(). Here is a good article on when you should use the MaintinanceTrigger and the TimerTrigger.
You can update the live tile from your app directly.
You can create a periodic tile update using TileUpdater.StartPeriodicUpdate
In Windows 8.1, you can update the app's live tile using the TileUpdate element in the manifest (look at the Tile Update section on the Manifest Editor Application page.)
You can use push notification to update the live tile.
Related
I am working on a Windows Phone 8.1 application which has to update tiles based on certain conditions like WiFi available, content exists in the knownfolders, etc...
During each Background task cycle i do something like this,
EnableNotificationQueue();
ClearTile();
CheckWiFi();//posts a notification saying Wifi is Present or not
CheckKnownFolderesContent();//posts a notifications with file count
This essentially creates a Notification queue of upto 5 tile notifications and clears the previous tile and post a tile notification accordingly.
What i am trying to understand is if it is possible to just update a tile notification which is already in the queue. For example: One background task create two notifications 1. No Wifi 2. 5 files in the folder.
Is it possible to just update the 2nd tile with new count by not clearing the other tile which already exists?
Found the answer. This can be done using tags.
https://msdn.microsoft.com/en-us/library/windows/apps/xaml/Hh868234(v=win.10)
How do I pin/unpin an application to the Windows 8 start screen using C#?
You can pin secondary tiles to the start screen via RequestCreateAsync (or one of its variants), but this step requires user approval.
If you mean create the main tile for an application that's listed in All apps, but perhaps the user had previously opted to remove the tile from the Start Screen, AFAIK there's no equivalent API for that, and it would occur only through the user opting to do so via the Start Screen UI.
My very simple Windows Store App (c#) only shows some data on it's tile. To initialize it, at the moment, the app has to be started by the user which is impractical.
Is there a possibility to auto-start the app or to execute any code on installation?
AFAIK there's no way to execute any code without actually starting the app. This means that the user will need to start the app to initialize the tile and its data. You have multiple options for setting up your data then:
You can create a fixed tile directly from the app.
You can register the trigger and refresh the tile from there.
You can setup push notifications for refreshing the tile.
Considering this I suggest you try to make the best out of your app that needs to be run. For example you could show a preview of the tile and add some options for configuring it if that makes sense in you case.
I have a windows 8 metro app that displays data on a live tile which is refreshed every minute.
When the metro app is started it creates a sequence to do the tile updates. This works perfectly.
The problem:
When I restart my computer the metro tile stops working. Instead it goes back to the default metro tile (app name bottom left image middle).
I can get it to work again by simply starting and stopping the metro app. But I do not wish to do this.
I implement a class that implements IBackgroundTask and implements the run method.
public void Run(IBackgroundTaskInstance taskInstance){
BackgroundTaskDeferral deferral = taskInstance.GetDeferral();
TileScheduler.CreateSchedule();
deferral.Complete();
}
In the metro app package manifest added declaration "Background Task" and under entry point pointed to this class. I also register timer and system event.
This class code basically calls the same code path the main app does when setting the tile sequence for the first time except that it is wrapped with a deferral.
The Question
Is this the right path (as it doesn't seem to be working so I guess my implementation is wrong)? or is there a better way to do this?
This might just be a case of "you can't do that with a simulated program". I'm assuming you are doing this by running the app using a developers license in visual studio. My understanding of how the tiles updating works (correct me if I'm wrong) but the tiles poll a website to get the next item to display. Since you've bounced your box any visual studio spun up services like an ASP.net host etc will not be running so the tile won't be able to get its new update.
If you want to test the functionality before deploying to the store I'd suggest in your project deploying your web service to IIS not to the test environment and configuring IIS to host that service at startup.
I'm not grasping the idea behind Windows Phone 7 live tile push notifications.
How do you have 2 projects (one in Visual Studio - C#, the other in Visual Studio - Web Developer) and they work together?
I am trying to create an application that stays active even when the user puts it in deactive state as it needs to stay constantly connected to there e-mail account.
how would I put all of this push notification code into one project? Or do I not need to?
Any help is greatly appreciated, thanks.
Edit:
What I wish to do after diving a little further into this is locally push notifications to the tiles, I don't need to go to a server, when the application updates itsself I want to be able to push a notification to the live tile if they got a new e-mail.
Is there anyway I can do this?
In Mango, you can change Live Tile information using the ShellTile class:
ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault();
// The first tile is the application tile.
// I'm not sure if it will be there if you application is not pinned
if (tile != null)
{
tile.Update(new StandardShellTileData
{
Title = "New Tile Title!",
Count = 50
});
}
Oddly, it doesn't appear that you can access the current shell tile properties (at least not from what I can see).
MSDN has a full list of StandardShellTileData properties that can be set.
Take a look at the link, it's from Mix and shows exactly how to use the new Live Tile API in Mango.
What you want to do, updating the tile locally is not possible in the current OS but will be possible in Mango.
Live Tile Mix 11 Demo
Having two projects in the same solution is an issue for how you manage your project.
For Windows Phone 7 push live tiles, it's not required, as the push notification comes from Microsoft's Push Notification Service. So your web project should make a request to MSFT Push Service, which will in turn push the livetile to your phone.
Your app should just register for a Tile Notification Channel.
This should be changing for Mango, however.