Is it possible to get a WP8 device resolution from a ScheduledTaskAgent? How? I was getting the screen size doing
Application.Current.Host.Content.ActualWidth
but this is not possible in a ScheduledTaskAgent... any alternative or do I have to save this in IsolatedStorage and retrieve when needed?
If you want to register a ScheduledTaskAgent the user needs to run your app. So when your app starts, get the resolution, save it somewhere (like IsolatedStorageSettings) and then read it in the ScheduledTaskAgent.
Related
I have an UWP application which display the battery status. On change of power saving mode in the application need to reflect in System settings.
Is it possible in UWP?
Is it possible in UWP?
No, this is not possible in UWP. We can't change System Settings just within a UWP app programmatically. As #lindexi said, the proper way to achieve what you want is launching the Settings app and then let user change the battery saver setting.
To launch to the battery saver setting page, we can use "ms-settings:batterysaver" URI like the following:
bool result = await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings:batterysaver"));
For more info, please see Launch the Windows Settings app.
And after this, we can use PowerManager.EnergySaverStatus property to check if user has enabled battery saver.
How to make the ScheduledTaskAgent start as soon as the app is installed? I have seen a property LaunchOnBoot when registering the service in WMManifest file. I set it to True and does not seem to serve the purpose. Any ideas?
This is for updating a tile (Primary Tile). The tile need to be updated as soon as the user pins the app to the home screen.
You cannot to it. Your app must run when registering a ScheduledTaskAgent .
If you want this for debugging you may use ScheduledActionService.LaunchForTest(). Otherwise you can not. But the real question then would be why you need it other than debugging?
I am displaying an image from my application's local folder in my metro application developed using Html/WinJS.
app.onactivated = function (args) {
document.getElementById('img').src = "ms-appdata:///local/test.jpg";
}
what i am doing is editing the image in some other application and getting it reloaded again on button click
function update() {
document.getElementById('img').src = "ms-appdata:///local/test.jpg";
}
but the image is not getting updated. It gets updated only after app relaunch.
Does "ms-appdata:///local/" cache data and refreshes only on app relaunch ?
Or where i am going wrong, kindly suggest.
Thanks.
I believe that setting img.src to the same value as before won't trigger a reload, and the rendering engine won't automatically update the image based on file changes. One trick you can try is to attach a ?foo= parameter on the URI, incrementing each time to effectively change the URI and triggering a reload.
Alternately, open the file using StorageFile.getFileFromApplicationUriAsync(new Windows.Foundation.Uri()). Then you can pass the StorageFile to URL.createObjectURL, and assign the result to the img.src. That should completely refresh the image.
Note that for consumption purposes where you don't need to load all the pixels (as you would for editing) it's best to get a thumbnail from StorageFile.getThumbnailAsync (or getScaledImageAsThumbnailAsync on Windows 8.1) and pass that result to URL.createObjectURL instead. This will avoid loading the whole image, especially for smaller display sizes, thus lowering your memory overhead and increasing performance.
I'm building two AIR apps - desktop and mobile.
When using the spark SWFLoader to load a remote SWF file, the desktop app seems to cache the file when loading for a second time (progress jumps to 100% instantaneously). In contrast, the mobile app will go through the same loading time even though the file has been loaded before.
So, my questions are:
Where is the loaded file being stored in the desktop app?
If there is caching, can we do the same for mobile app?
All you have to do is to set the sessionCachingEnabled attribute in your main application file to true. This is a neat feature that allows you to support (with no sweat) scenarios like this: the user navigates to the n screen of the application, he has some data on that screen and the application gets closed (maybe the user went to a new application or decided to close the app); when he opens the application again he will see the same screen as in the previous session.
<s:MobileApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
firstView="views.ASimpleMobileAppHome"
sessionCachingEnabled="true"
splashScreenImage="#Embed(source='loading.png')">
...
</s:MobileApplication>
I created an Air desktop app with Flash CS 5. Usually Windows (XP) is opening an application (like Firefox) with the latest set size and position.
For my installed Air app it's always just the default one.
How to start it with the latest used size and position?
Thanks.
Uli
hope this will work for you:
http://cookbooks.adobe.com/post_Using_the_FullScreen_functionality_in_AIR-8004.html
http://blog.ochodurando.com/2010/04/adobe-air-e-fullscreen/
You need to save a record somewhere that remembers the window's size, and possibly position. If your app has a preferences file, this would be an ideal place to store that information. Then, whenever your app starts, it checks for this information and resizes the window if any values are found.
Most popular programs include this feature (and don't even mention it, since it's pretty basic UI), but it's done intentionally and not as a default for every application. Thus if you want it, you have to program it in.
You can read and write to application.xml. You'll find there and nodes.
file = new File( File.applicationDirectory.nativePath + "/META-INF/AIR/application.xml" );
Adobe restrict writing access to application diractory but this trick is useful if you don't want to create a separate config file in app-storage:/ folder, which is of course prefered.