in Windows 8 C# WindowsStore app if I call
System.Globalization.RegionInfo.CurrentRegion
I get US, although in Control Panel - Region I have location and language = UK...
How do I get country of the device NOT using geolocation?
var region = new Windows.Globalization.GeographicRegion();
Parameterless constructor of GeographicRegion sreates a GeographicRegion object that defaults to the user's home region.
Related
So I have spent the whole night looking like a zombie in the morning trying to figure out how the OS handles an NFC tap for an NDEFLaunchApp Record and I have known the following.
I'm pretty sure that there is a workaround which lets you launch a system app / third party app (if you know the product Id / GUID) from your app. As there are apps in the Windows Phone Store which I have somehow figured out what I've been trying to.
I have come up with the following code:
NdefLaunchAppRecord appLaunchRecord = new NdefLaunchAppRecord();
appLaunchRecord.AddPlatformAppId("WindowsPhone", "{App GUID}");
appLaunchRecord.Arguments = "_default";
// Creating a new NdefMessage from the above record.
var message = new NdefMessage { appLaunchRecord };
// Getting the record from the message that we just created
foreach (NdefLaunchAppRecord record in message)
{
var specializedType = record.CheckSpecializedType(false);
if (specializedType == typeof(NdefLaunchAppRecord))
{
var x = String.Join(" ", record.Payload);
// Getting the payload by GetString gets a formatted Uri with args
string result = System.Text.Encoding.UTF8.GetString(record.Payload, 0, record.Payload.Length);
// result = "\0\fWindowsPhone&{5B04B775-356B-4AA0-AAF8-6491FFEA5630}\0\b_default";
// result = "(null)(form feed)WindowsPhone&{App GUID}(null)(backspace)_default
// So this will be sent to the OS and I believe the OS will then launch the specified app by an unknown protocol
// like xxx://result
// and the app will be launched?
// So is it then possible to somehow call the following:
await Windows.System.Launcher.LaunchUriAsync(new Uri("OUR MAGIC RESULT?", UriKind.RelativeOrAbsolute));
If anyone has / can figure out a way for this, it would be a REAL Service to the WP Community as developers are restricted by Microsoft to open certain settings / apps which are actually needed by those apps. For instance (speech settings, audio settings, about settings, alarms, region settings, date+time);
APPS that possibly have a workaround:
Music Hub Tile (Launches the old Music+Videos Hub)
http://www.windowsphone.com/en-gb/store/app/music-hub-tile/3faa2f9e-6b8d-440a-bb60-5dd76a5baec1
Tile for Bing Vision
http://www.windowsphone.com/en-gb/store/app/tile-for-bing-vision/05894022-e18c-40a4-a6cc-992383aa7ee8
There are reserved uri schemes for bing and zune.
See: http://msdn.microsoft.com/en-us/library/windows/apps/jj207065(v=vs.105).aspx
Those two apps propably use these and have found some undocumented use of the scheme.
If there is an uri scheme that launches any app by guid from within your app, it is hidden well.
Currently you can only launch apps that registered for an uri scheme or file association.
I am creating a windows Phone 8.1 application with the Geo Location. The code works, well pretty much, the one thing that I have noticed in the simulator, if the phone does not reside in the Geo-Fenced area for a 2 .. 3 .. seconds the background code does not fire even though I create my dwell time with no parameters.
MonitoredGeofenceStates mask = 0;
mask |= MonitoredGeofenceStates.Entered;
var geocircle = new Geocircle(position, 100);
gFence = new Geofence(ID, geocircle, mask, false);
I found the following blog but it was not that useful
http://blogs.windows.com/buildingapps/2014/02/25/testing-and-debugging-your-geofencing-apps/
How often does a phone or device check if its in a Geo fenced area? I would like to tell my users for their geo-fence to be active they must reside in the geo-fenced area for a minimum of x seconds...
I'm trying to create a secondary tile for a windows 8.1 application, i need this tile to contain images for all sizes and all of them come from internet. this is my code :
string dynamicTileId = selectedItem.UniqueId;
string sLogo = selectedItem.logo;
string wLogo = selectedItem.widelogo;
string lLogo = selectedItem.imagen3;
Uri logo = new Uri(sLogo);//150x10 image
Uri wideLogo = new Uri(wLogo);//310x150 image
Uri largeLogo = new Uri(lLogo);//310x310 image
string tileActivationArguments = dynamicTileId;
var secondaryTile = new SecondaryTile(dynamicTileId, selectedItem.Title, tileActivationArguments, largeLogo, TileSize.Square310x310);
secondaryTile.VisualElements.ForegroundText = ForegroundText.Light;
secondaryTile.VisualElements.BackgroundColor = Colors.CadetBlue;
secondaryTile.VisualElements.Square310x310Logo = largeLogo;
secondaryTile.VisualElements.Square150x150Logo = logo;
secondaryTile.VisualElements.Wide310x150Logo = wideLogo;
await secondaryTile.RequestCreateAsync();
I'm having this error while the app tries to use the 310x310 logo:
WinRT information: Could not initialize secondary tile with provided arguments.
All the other images work fine. I'm using this picture for testing : http://www.usatodayeducate.com/staging/wp-content/uploads/2013/03/310x310-0313-gapyear.jpg
if i comment the line that includes the 310x310 logo everything works fine.
Any idea why this is happening?
As per the SecondaryTile class
public SecondaryTile(string tileId, string displayName, string arguments, Uri square150x150Logo, TileSize desiredSize);
where
desiredSize:The size of tile to pin. This value must be Default
(which provides Windows 8 behavior), Square150x150, or Wide310x150.
Any other TileSize value causes an exception to be thrown during
runtime.
Here you used 310x310 size for desiredSize which is not acceptable by the Secondary tile.
Please check your code.
looks that you're using a high dpi image, 300 dpi.
I was reviewing the image and the unique attribute looking unusual is image dpi (high).
Try using same image in traditional screen 96 dpi, you could try with this one I have conveted to 96 dpi:
You cannot link to web resources.
They must be either local in the app (A path within the deployed app package. This path is resolved for languages and DPI plateau supported by the app.) or on the user device (A file found in the per-user app storage.).
Documentation of this:
http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.startscreen.secondarytilevisualelements.square310x310logo.aspx
I am new to windows phone app development.
I am trying to use the powerStatus class in a windows phone 7 app. I have searched quite a bit regarding that and learnt that it is necessary to add reference of System.Windows.Forms
But in the add reference of the project 'System.Windows.Forms' is not present.
How can I use the powerStatus class?
Please help.
Thank you.
Please Refer this msdn link that will clearly shows that how can you get the status of the Battery. i.e. The remaining Percentage of charge in phone;s battery.
Know the battery status in windows phone
In this link, use the RemainingChargePercent() Method this will return the value that indicates the percentage of the charge remaining on the phone's battery.
This things will used in windows phone 8 only.
But, you are with windows phone 7. so, currently there is no API available for windows phone 7 to know the remaining charge in phone's battery.
You will get the information like the if your phone is connected to power source or running in battery.
I will show here some important msdn question links that shows that there is no method or the class is available to get the charge level in windows phone 7.
The MSDN Question link: how to get the battery status in windows phone 7.
if you have the need to show the battery charge percentage, then i suggest you to proceed with windows phone 8.
It work for wp8. but I am not sure about wp7.
_battery = Battery.GetDefault();
var remainingCharge = string.Format("{0} %", _battery.RemainingChargePercent);
var remainingTime = _battery.RemainingDischargeTime.TotalMinutes;
_battery.RemainingChargePercentChanged += OnRemainingChargePercentChanged;
private void OnRemainingChargePercentChanged(object sender, object e)
{
var remainingCharge = string.Format("{0} %", _battery.RemainingChargePercent);
var remainingTime = _battery.RemainingDischargeTime.TotalMinutes;
if(Microsoft.Phone.Info.DeviceStatus.PowerSource == Microsoft.Phone.Info.PowerSource.External)
var text = "Charger Connected";
else
var text = "Charger Not Connected";
}
I like to know how to open location toogle in c#, for example for wifi i use this:
ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask();
connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.WiFi;
connectionSettingsTask.Show();
I like a stuff like that but for location.
Though, in Windows Phone 8, this can be done using
Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings-location:"))
There is no task to do this for you - each app that uses the location sensors is expected to have this setting in their own settings page.