Get Device Model in windows Phone 8.1 Runtime - windows-runtime

is there a way to retrieve friendly device model in windows phone 8.1?
EasClientDeviceInformation a = new EasClientDeviceInformation();
String b = a.SystemProductName; // RM-994 not lumia 1320
this Api doesn't return device friendly name.

No way to get a friendly name like Lumia 1320 directly from the API, you need to use https://github.com/ailon/PhoneNameResolver to convert the name from API (RM-994) to the friendly name.

Related

How to store user data in window phone 8 app?

Please help me how to store user data in window phone 8 application?
I have a plan to develop an application on windows phone 8 which allow user create xml file to store their private data. The question is how to store user data on window 8.1 phone. After search solution, i know that
+ Isolated Storage can store data but it just small data for application
+ Store data on SD card is read only.
So, is there any other way to store data?
Thank and sorry about my english skill!
ApplicationData (LocalFolder on WP8 or LocalFolder and RoamingFolder on WP8.1) is designed for what you are trying to do. The ApplicationSettings themselves are better for small pieces of data, but apps can save files of any size which the phone has room for in the LocalFolder.
See Accessing app data with the Windows Runtime on MSDN for details. While the docs target Windows Runtime apps, the ApplicationData and StorageFile API are available to Silverlight apps on Windows Phone 8 and later.
Additional Usings:
using System.Xml.Serialization;
using Windows.Storage;
using System.IO;
Code:
StorageFolder localFolder = ApplicationData.Current.LocalFolder;
StorageFile saveFile = await localFolder.CreateFileAsync("data.xml", CreationCollisionOption.ReplaceExisting);
using (var ras = await saveFile.OpenAsync(FileAccessMode.ReadWrite))
{
Stream stream = ras.GetOutputStreamAt(0).AsStreamForWrite();
XmlSerializer serializer = new XmlSerializer(typeof(List<Book>));
serializer.Serialize(stream, data);
}
If you need more structured data than XML then you can store a SQLite database in the local folder. If you need more space than is reasonable for an app to store on the device then you'll need to move it to a web service. Azure Mobile Services is a good place to do that. You can call such a service from a Windows Phone Silverlight app, but the wizards will generate Universal apps.

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 my device token in nokia lumia 630

Basically I am PHP developer! and now I want to implement the push notifications for windows phone! So for this I have refereed many blogs and also started implement on this! but for demo purpose how I can get my device token and device specific type of my phone that having Windows 8.1 OS.
Is any GUI tool for getting this.
If you need the Device Token as follows-
Byte[] DeviceArrayID = (Byte[])Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceUniqueId");
string UniqueDeviceID = Convert.ToBase64String(DeviceArrayID);
Debug.WriteLine("Device ID - " + UniqueDeviceID
Also, if you need help regarding push notifications in Windows Phone apps, follow this link-
http://msdn.microsoft.com/en-us/library/windows/apps/hh202967%28v=vs.105%29.aspx
It also has a project for a simple webpage which can send notification to your device for testing purposes.
The following should work
object DeviceUniqueID;
byte[] DeviceIDbyte = null;
if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out DeviceUniqueID))
DeviceIDbyte = (byte[])DeviceUniqueID;
string di = Convert.ToBase64String(DeviceIDbyte);
The above code will give you the device ID. You can use the string di to pass the Device ID to your web service to provide the user with push notifications.

Create reminder in windows runtime

I am in the process of porting an app from windows phone 8 silverlight to windows phone 8.1 runtime.
Before I could create reminders like this:
Reminder reminder = new Reminder(name);
reminder.Title = titleTextBox.Text;
reminder.Content = contentTextBox.Text;
reminder.BeginTime = beginTime;
reminder.ExpirationTime = expirationTime;
reminder.RecurrenceType = recurrence;
reminder.NavigationUri = navigationUri;
// Register the reminder with the system.
ScheduledActionService.Add(reminder);
How would I do this in windows phone 8.1 runtime?
Thanks,
unfortunately there's no equivalent for Windows phone 8.1 runtime
Migrating your Windows Phone 8 app to a Windows Runtime XAML app
Now you must use toast notifications using the new Action Center feature
MSDN Reference
Action Center QuickStart

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.