DeviceStatus.ApplicationMemoryUsageLimit doesn't work on WP Silverlight 8.1 - windows-phone-8.1

DeviceStatus.ApplicationMemoryUsageLimit doesn't work on WP Silverlight 8.1 app, it always return 0, do you know why? and is there have new replaceable API for it?

Unfortunatly it will return 0 as mentioned by this msdn link
http://msdn.microsoft.com/en-US/library/windowsphone/develop/microsoft.phone.info.devicestatus.applicationmemoryusagelimit(v=vs.105).aspx
See the Caution section. the new api for this is MemoryManager. see the following link
http://msdn.microsoft.com/en-us/library/windowsphone/develop/windows.system.memorymanager.aspx
Hope this helps.

Related

Universal App (HTML5) deployment to Windows Phone fails when using Background Audio

I am developing a Universal App that uses the HTML5 / JavaScript framework. In this app I have a page with an HTML audio tag (with the attribute msAudioCategory set to "BackgroundCapableMedia"), that is further wired up with Windows.Media.SystemMediaTransportControls.getForCurrentView() in order to get the audio playing in the background. I also have, on both the windows and phone projects, set the Declarations > Background Tasks > Audio, with the default.html page set as the entry page.
Deploying to Windows (either local machine or emulator) works as expected. All to the good. However deploying to either the phone emulator or a physical phone device throws this rather unhelpful error:
Unexpected Error: Package could not be registered. (Exception from HRESULT: 0x80073CF6)
Cant see any obvious reason for this. Searching the net suggests that this might be a bug, but I also suspect that playing background audio on the phone might require a different methodology.
Notably, starting a new blank universal app, adding the declaration as above (with no audio tag or supporting code), deploys on windows but fails with the same error on the phone. Any ideas?
Have discovered the issue that the rather uninformative error was trying to tell me: my entry point was invalid. As mentioned I had it set it to the default.html page, but for the windows phone at least it needs to be set to a valid background task file. In C# this is something that inherits from the Windows.ApplicationModel.Background.IBackgroundTask interface. In JavaScript, this is a JS file that looks a little like this:
(function () {
var backgroundTaskInstance = Windows.UI.WebUI.WebUIBackgroundTaskInstance.current;
function doWork() {
var settings = Windows.Storage.ApplicationData.current.localSettings;
var key = backgroundTaskInstance.task.taskId.toString();
settings.values[key] = "Succeeded";
close();
}
if (!canceled) {
doWork();
} else {
key = backgroundTaskInstance.task.taskId.toString();
settings.values[key] = "Canceled";
close();
}
})();
Taken from the sample here: http://msdn.microsoft.com/en-us/library/windows/apps/hh977045.aspx
Cheers :D
WindowsPhone 8.1 do not support background audio by JavaScript. You should use c# for this task. That is all.
"Important:
You can use JavaScript to write background audio applications. However, Windows Phone 8.1 does not allow JavaScript to run in a background process. Which means, your foreground app and UI can be written in JavaScript, but your background task must be written in C# or C++. The Background audio for Windows Phone 8.1 sample provides an example of a JavaScript app that supports background audio by using a C# background agent."
https://msdn.microsoft.com/en-us/library/windows/apps/dn720802.aspx

Windows Runtime equivalent to the Silverlight PhoneSubtleBrush

In Silverlight there is the PhoneSubtleBrush which is the color used in the Mail app to display the message excerpt below the subject.
Is there something in the Windows Runtime API that has the same color as PhoneSubtleBrush?
Not sure if it's exactly the same but I've been using ListViewItemSubheaderTextBlockStyle so far.

LocalStorage not working with Windows 8 Phone HTML 5 project template

I am making a Windows 8 Phone app using HTML 5.
I am using localStorage for saving some small values as shown in the code below, I have tested my code in all browsers and it was working perfectly fine, then I created a new HTML 5 project and added my code to the project and ran the application.
In the following code, I suspect that localStorage here is not working and I wonder why ?? !
$("#cow_btn").click(function(){
localStorage.selected_category = "cow";
window.location.href = 'animals.html';
});
How did I come to this conclusion ?
1 - I tried giving alerts before and after the localStorage.selected_category = "cow"; line, here the first alert was shown but the second alert was not shown.
$("#cow_btn").click(function(){
alert("hello1");
localStorage.selected_category = "cow";
alert("hello1");
window.location.href = 'animals.html';
});
2 - Next I tried removing the line itself and then my window.location.href = 'animals.html';which was not working earlier now worked.
$("#cow_btn").click(function(){
window.location.href = 'animals.html';
});
What could be the problem here ? My entire app works smoothly with Firefox, Chrome and even with Internet Explorer 10.
Please share your thoughts on this. How do I make the localStorage work on my HTML 5 Windows 8 Phone app ?
NOTE:
I am using the following js
- jquery.min.js & jquery.mobile-1.2.0.min.js
I'm seeing the exact same behavior in my windows 8 phonegap app. The problem only occurs when using jquery mobile. Could you please try to run your app without jquery mobile?
As soon as I remove jquery mobile localstorage is working just fine.
localStorage is fully supported on WP8/IE10. To double check this try this
alert("typeof localStorage=" + typeof window.localStorage);
PS. The followign may help you to troubleshot the problem
Windows Phone 8 IE10 Javascript debugging
Windows Phone will not support your coding style.
Be sure to use the setItem / getItem commands, as in WP8/IE10 the localStorage.key = value; commands are not supported even tough they are W3C standard.

how to play audio through earpiece only in windows phone 8 application

I have tried with AudioRoutingManager class...but i got unauthorizedaccess exception.
here is my code
AudioRoutingManager audioRouting = AudioRoutingManager.GetDefault();
public AudioRoutingEndpoint ChangeAudioRoute()
{
var currentEndPoint= audioRouting.GetAudioEndpoint();
switch (currentEndPoint)
{
case AudioRoutingEndpoint.Earpiece:
case AudioRoutingEndpoint.Default:
return AudioRoutingEndpoint.Speakerphone;
case AudioRoutingEndpoint.Speakerphone:
return AudioRoutingEndpoint.Earpiece;
default:
throw new OperationCanceledException();
}
}
public void SetAudioRoute()
{
audioRouting.SetAudioEndpoint(this.ChangeAudioRoute());
}
The APIs in the Windows.Phone.Media.Devices namespace require the ID_CAP_AUDIOROUTING and the ID_CAP_VOIP capability. (Add this to your manifest)
Also, it's only possible to change the audio routing while in a active VOIP call.
Additionally, you need to do the audio routing in your background VOIP process, and not in the foreground process.
Old question but now I know the answer.
Two things which you need to do:
Tag the audio in question as "communications"
How to do this depends on what API you're using. It could be as simple as . Or you might have to call IAudioClient2::SetClientProperties with an AudioClientProperties structure whose AudioClientProperties.eCategory = AudioCategory_Communications.
Tag your app as either a "voice over IP" app or a "voicemail" app
You should add file called WindowsPhoneReservedAppInfo.xml to your project with the following contents:
<?xml version="1.0" encoding="utf-8"?>
<WindowsPhoneReservedAppInfo xmlns="http://schemas.microsoft.com/phone/2013/windowsphonereservedappinfo">
<SoftwareCapabilities>
<SoftwareCapability Id="ID_CAP_VOIP" />
</SoftwareCapabilities>
</WindowsPhoneReservedAppInfo>
Look for more detailed explanation here:
Playing audio to the earpiece from a Windows Phone 8.1 universal app

FB.Canvas.setSize stopped working (today?)

This method seems to have stopped working.
App code was tested thoroughly last week and all was well. This morning...scrollbars are appearing on our page tab apps.
Example:
http://www.facebook.com/HondaPowersports/app_329359370439338
Very simple code on this page - it is all static HTML with just one FB method call:
window.fbAsyncInit = function() {
FB.Canvas.setSize({ width: 810, height: 975 });
}
Anyone else with this same problem? Any ideas?
According to the documentation (FB.Canvas.setSize):
Note: this method is only enabled when Canvas Height is set to "Settable (Default: 800px)" in the Developer App.
Has someone modified the settings of your Facebook app? If it's not configured as stated above then it stops working.
it seems to me it is deprecated and you have to use setAutoGrow... not sure , take a look :)
Related bug: http://developers.facebook.com/bugs/322561887802154