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)
Related
My WP8.1 App creates toast notifications that will appear - like SMSs - in the Notification center of the Windows Phone (this part works like a charm).
In one precise scenario, I would like to limit the number of notifications my app can have in the Notification Center at a given time:
"if a user has 3 notifications displayed, he cannot add another until he clears one of them".
Any idea how to hook into the notification center to know its state?
Thanks!
I'm facing a problem with background tasks in Windows Phone 8.1.
I tried to create a new background task with Device User Trigger and Audio, but I got the error saying:
Package could not be registered.
I saw this:
Windows phone 8.1 deployment error when trying to use background task with audio and device use trigger in SO
Windows phone 8.1 deployment error when trying to use background task with audio and device use trigger in the MSFT Forum.
I tried the solution they pointed but without success.
Anyone knows how I can make 2 background tasks communicate?
What worked for me was this:
in one of the Background Task (the audio one) I created a Timer and checked if a LocalSettings value was or not true.
The other Background task was the one responsible to set it to true, so that what I want to do in the audio will happen as soon as I set the value to true.
I know that this is a "strange" way to do it, but it works ;)
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.
I am looking for a way to show the number of unread articles from an RSS feed on a live tile on Windows Phone. How can I do that? I know that I can use background tasks, but I want to use them effectively, so I don't drain the battery of the phone by checking the feed over and over again. Also, I want to reset that number when I open the app.
There are 2 ways of updating the tiles.
From within the app (or background agent)
From a remote service, via push notifications
The method with the least impact on the battery is to send push notifications when there is a new article. This does require a backend service capable of identifying when new content is posted and sending the push notifications though.
If you want to do it all on the device using background agents, the important thing is to remember to not pull down all the content each time. If you have control over the backend then add the ability to return how many new articles there are. If not, only pull down the feed if necessary. Look at the If-Modified-Since header for one way to do this.
It's very easy to reset/clear the tile contents from within the app when launched. When you navigate forwards into the main page is normally the best time.
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.