Wi-Fi Direct in Windows Phone 8.1 - windows-phone-8.1

According to documentation:
https://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.wifidirect.wifidirectdevice.aspx
it should be available on 8.1 store and it is, the problem is that each time it code below returns 0. Code taken from msdn example for Windows 8.
String deviceSelector = Windows.Devices.WiFiDirect.WiFiDirectDevice.GetDeviceSelector();
var devInfoCollection = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(deviceSelector);
Anyone knows if WiFi Direct is actually supported on Windows Phone?
Thanks

Related

How to get the Application Process ID in Windows Phone 8.1 Store Apps

I am developing a Windows Phone 8.1 Application and there is a need to get the Application Process ID from code. Any API with which I can get that?
You can use GetCurrentProcess followed by DuplicateHandle (and later CloseHandle) but I'm curious what you need it for... there's not much you can do with it in a Store app so maybe this won't complete your scenario.
Finally got the solution.
The Dll's for Desktop apps and Phone apps are different though the function names will be same.
When tried to import Kernal.dll lib in WIn Phone 8.1 and used p/invoke code, an exception, DllNotFoundException will be thrown. Instead in Win Phone 8.1 instead use "api-ms-win-core-processthreads-l1-1-1.dll"
To get the process ID in Win Phone 8.1 :
1)Create binding to WIN32 lib:
[DllImport("api-ms-win-core-processthreads-l1-1-1.dll", CharSet = CharSet.Unicode, ExactSpelling = false, PreserveSig = true)]
internal static extern uint GetCurrentProcessId();
2)Call the function:
uint id= GetCurrentProcessId();
For the complete set of Win Phone 8 supported API's see the MSDN link:
https://msdn.microsoft.com/library/windows/apps/jj662956(v=vs.105).aspx#BKMK_ListofsupportedWin32APIs

How to get a query string in a windows phone 8.1 app?

Sorry to ask such a basic question, but I've spent the last 30mins on google and found nothing (very likely my poor search engine skills!)
I'm upgrading (well, moving code) from a windows phone 8 app to a universal app (the windows store code is largely absent at the moment, I'm currently concentrating on porting over the windows phone stuff).
Previously I was using
NavigationContext.QueryString.TryGetValue
But with 8.1 this doesn't work and I can't for the life of me find out how to get the querystring.
Any help would be very gratefully appreciated.
You can send a parameter the way Vyas_27 written, but make it looks like
//id - first parameter
//value - second parameter
Frame.Navigate(typeof(SecondPage), "id&value");
To get parameters
string[] parameters = ((string)e.Parameter).Split(new char[] {'&'});
string id = parameters[0];
string value = parameters[1];

DeviceFirmwareVersion, OSVersion, DeviceStatus missing in Windows Phone 8.1 runtime

in my Silverlight Windows Phone 7/8 projects I always used these methods/classes to get informations about the user phone:
Microsoft.Phone.Info.DeviceStatus.DeviceFirmwareVersion;
System.Environment.OSVersion.Version;
Microsoft.Phone.Info.DeviceStatus.DeviceName;
Microsoft.Phone.Info.DeviceStatus.DeviceManufacturer;
But now in Windows Phone 8.1 runtime they are missing. Are there some alternatives? My app doesn't use networking.
Thanks and sorry for bad english.
You can use the EasClientDeviceInformation class
e.g.
var deviceInfo = new EasClientDeviceInformation();
var manufacturer = deviceInfo.SystemManufacturer;
var name = deviceInfo.SystemProductName;
var firmwareVersion = deviceInfo.SystemFirmwareVersion;
var osVersion = "8.1"; // Only 8.1 so far. No os version method exists afaik in 8.1
Universal/WinRT apps only work in wp 8.1, so the OS version can only be 8.1. When they make wp8.2 or wp9, they'll probably add a way to check what OS version is installed...
If you're looking for the firmware version, you can get it with:
Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation deviceInfo = new Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation();
var firmwareVersion = deviceInfo.SystemFirmwareVersion;

Windows Phone 8 Emulator returning Redmond location only

I am using the following code
Geolocator myGeolocator = new Geolocator
{
DesiredAccuracy = PositionAccuracy.High
};
Geoposition myGeoposition = await myGeolocator.GetGeopositionAsync();
Geocoordinate myGeocoordinate = myGeoposition.Coordinate;
while running the simulator each time i get the location as Redmond, is this a bug, if yes then how can we get rid out of it?
There is location sensor simulator available for Windows Phone emulator (both 7.5 and 8): How to test apps that use location data for Windows Phone.
It looks like that:
You can set current phone location to anything you want using that tool. IT also allows you to record paths and playing recorded paths.
To open it click Additional Tools button - the last one within emulator toolbar. It's hovered to yellow on photo below.

Windows Phone 8 find out IMEI / device name + manufacturer

I need to find out on which Windows phone device my app is running. Is there a reliable way to find out the IMEI in WP8? If not, is the DeviceName and DeviceManufacturer field reliably filled in by most devices? The documentation says those fields may be empty.
You could use
//Device Name
Microsoft.Phone.Info.DeviceStatus.DeviceName
//Device Unique Identifier (not IMEI)
Convert.ToBase64String((byte[])Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceUniqueId")))
//Device Manufacturer
Microsoft.Phone.Info.DeviceStatus.DeviceManufacturer
Hope this helps someone
This may work on Windows Phone 7. Maybe, it will also work on Windows Phone 8.
byte[] byteData = (byte[])DeviceExtendedProperties.GetValue(“DeviceUniqueId”);
string imei = System.Convert.ToBase64String(byteData);
DeviceExtendedProperties.GetValue(“DeviceUniqueId”) works as stated on Windows Phone 7 but on Windows Phone 8, this API will return unique id common across all the apps for the same publisher on a wp8 device. But two different publisher's apps will have different device ID's.