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.
Related
I'm new and currently working on a Xamarin.IOS app based on a Xamarin.Android app. I noticed that the Android native app does background tasks using a class called Service from Android.App and classes from Android.Support.V7.App and Android.Content. I'm just wondering if there's any similar solution for Xamarin.IOS, or do I have to do it completely from scratch?
From document Backgrounding in Xamarin.iOS,we know that:
In iOS, backgrounding is recognized as an application state, and apps
are moved in and out of the background state depending on the behavior
of the app and the user. iOS also offers several options for wiring an
app to run in the background, including asking the OS for time to
complete an important task, operating as a type of known
background-necessary application, and refreshing an application's
content at designated intervals.
IOS regulates background processing very tightly, and offers three approaches to implement it:
Register a Background Task
If an application needs to complete an important task, it can ask iOS not to interrupt the task when the application moves into the background. For example, an application might need to finish logging in a user, or finish downloading a large file.
Register as a Background-Necessary Application - An app can register as a specific type of application that has known, specific
backgrounding requirements, such as Audio , VoIP , External Accessory
, Newsstand , and Location . These applications are allowed
continuous background processing privileges as long as they are
performing tasks that are within the parameters of the registered
application type.
Enable Background Updates - Applications can trigger background updates with Region Monitoring or by listening for Significant
Location Changes . As of iOS 7, applications can also register to
update content in the background using Background Fetch or Remote
Notifications .
For more details, you can check:https://learn.microsoft.com/en-us/xamarin/ios/app-fundamentals/backgrounding/introduction-to-backgrounding-in-ios.
Im trying to develop an app for Windows 10 which I hope to submit to the store. I want to get access to the Taskbar APIs so I can set the progress level (green bar behind the process text).
In Windows 7 I used the some of these APIs:
https://msdn.microsoft.com/en-us/library/windows/desktop/dd391692(v=vs.85).aspx
They were wrapped by this handy library which I used in my C# app:
http://blogs.microsoft.co.il/sasha/2009/02/12/windows-7-taskbar-apis/
I cant find the equvilant for UWA Desktop Extension, Any ideas?
Mike
Basically the images are comes from the app asserts, see this: Guidelines for app assets Target-based assets session for more information. The asserts are the read-only stuff and we cannot programmatically change from the code, which means we cannot create the animation on taskbar.
The APIs like ITaskbarList3 are not available in Windows Universal App.
Basically base on my understanding, Microsoft wants to use push notification/live tile also badge to deliver the current state like current progress.
I recommend your assistance.
I am using Silverlight 8.1 to program an GPS based alarm app (Because the Microsoft.Phone.Scheduler.Alarm api is blocked in WP 8.1).
Now I am trying to create a BackgroundTask triggered by the GeofenceMonitor.
My problem is that a BackgroundTask must be located in a "Windows Runtime Component" project and you can't set the compilation target to Silverlight 8.1, so I cannot create an Alarm in there.
Is there a workaround or is it just impossible to launch an Alarm from a BackgroundTask?
I would appreciate every solution.
Unfortunately you cannot mix WinRT and WP8.1 Silverlight.
As you mentioned the Alarm API doesn't work with WP (so much for "universal") and the Silverlight Runtime doesn't have the GeofenceMonitor. You can have a Silverlight Project with a WinRT background task, but that won't get you anywhere.
I don't know if you want these alarms permanently associated with a location or rather short-lived, but maybe this would be a solution:
Configure your app to keep running in the background. There is a dedicated "LocationTracking" Execution Type that you can use for any app that tracks the GPS Position in the background (see this site for details).
You can then use the PositionChanged event of your Geolocator to check if you are within your fence and add an (almost) instant alarm.
const string id = "whateverYourIdIs";
var existing = ScheduledActionService.Find(id);
if(existing != null)
ScheduledActionService.Remove(id);
Alarm alarm = new Alarm(id)
{
BeginTime = DateTime.Now.AddSeconds(1),
Content = "You have reached your location!",
};
ScheduledActionService.Add(alarm);
If you don't want to keep your app running, you could (propably) launch another background task (SL) from within the geo-fencing background task (WinRT).
I have created a Window phone 8 app. Which changes the lockscreen image and notification in around 30 sec randomly.
My code works well in the emulator and device. When I install it through the code. My problem is that when I have submitted the app to the store as a beta app. And now I install the app from the store the app don't work as it was working. The lockscreen content don't change it remains static. I have checked the settings background agents that app is running in the background tasks but not showing the result.
What could be the cause that app is running well from the code but not from the xap uploaded to the store.
Link of app is http://www.windowsphone.com/s?appid=00d47e34-a551-4c98-b2a6-32e10babdc2f
am I missing any capability that need to fixed.
Your suggestions are welcome.
Because your title says you are using a background task and you are trying to do something every 30 secs, I assume that you're using ScheduledActionService.LaunchForTest to trigger your background task and which then performs the updating.
ScheduledActionService.LaunchForTest is only supported in DEBUG builds as a way to aid testing. It is not possible to submit an app to the store that is built in DEBUG mode so this will not work.
It is not possible to create an app which will update so often in the background. To have such an app would, potentially, drain the battery really quickly and so provide a very poor experience to users.
The best you can do is to have the background agent run on a periodic schedule (approx. every 30 mins) or trigger the updates via push notifications. (But this wouldn't work for the lock screen image.)
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.