Windows phone 8.1 create contact task - c#

After reverting from windows phone 8.0 to windows phone 8.1, the save contact task no longer exists. All documentation on the internet state that now
You don't have write access to the primary contact store on Windows Phone 8.1, but you have the ability to create your own contact store.
this link on msdn clearly shows how can I add contacts implicitly to my contact store.
What's strange is that WhatsApp and Telegram both allow me to create a contact and choose the account type of it (outlook, ..) and on windows phone 8.1 !
Can anyone explain this?

If you're working with wp rt, your question is a duplicate of this question.
In that case, you have to create your own contact store for the app you're working on (code copied from the linked question's answer):
using Windows.Phone.PersonalInformation;
public async void addPerson() {
var store = await ContactStore.CreateOrOpenAsync();
var contact = new StoredContact(store) {
DisplayName = "Mike Peterson"
};
var props = await contact.GetPropertiesAsync();
props.add(KnownContactProperties.Email, "mike#peterson.com");
props.add(KnownContactProperties.MobileTelephone, "+1 212 555 1234");
await contact.SaveAsync();
}
In order for your app's contacts to appear in "People", each user needs to change the filter settings of their People-App accordingly.

Yes, I did similar things myself. The reason being the upgrade to windowsphone 8.1 brought restrictions on many apis which were released on windowsphone 8.0 like access to alarms, easy phone manager tasks were all changed because they were migrated from Silverlight to a new runtime. So if you'd still like to get accept to all those classes of Windowsphone 8.0 the trick is that is you first target your app to windowsphone 8.0 OS where you get access to all the classes. And then right clicking on the package explorer do a Windowsphone 8.1 Silverlight OS update. In that sense your app gets upgraded to windowsphone 8.1 while it still retains an intermediate namespace of windowsphone 8.0 allowing you to access all classes based for the old silverlight based OS.

Related

BarcodeScanner.GetDefaultAsync() is always returning null

I'm trying to create a simple application in UWP for a Zebra device (Model TC700J) running Windows 8, in which I make use of the built in barcode scanner.
From what I've found, there's plenty of Zebra tutorials for accessing the scanner when programming on Android, but none for Windows due to the fact that Microsoft provide their own generic barcode scanner API found in the Windows.Devices.PointOfService namespace.
The code I currently have looks something like this:
BarcodeScanner scanner;
ClaimedBarcodeScanner claimedScanner;
scanner = await BarcodeScanner.GetDefaultAsync();
if (scanner != null)
{
claimedScanner = await scanner.ClaimScannerAsync();
}
The problem is that the if statement never evaluates to true as the GetDefaultAsync method always returns null.
Over here there was an answer that seemed to work, stating that it depends where the GetDefaultAsync method is placed. I've tried to put it in all of the suggested places though and to no avail.
There is another method, BarcodeScanner.FromIdAsync() which returns a barcode based on the string representation of that barcode scanner's id sent as a parameter, but I'm not sure that'd be valid here as the barcode scanner is built into the device.
Looking at Zebra's site, TC700J seems to be model number of Windows 10 Mobile IoT Enterprize OS.
And the platform is ARM(Qualcomm snapdragon), not Intel x86/x64.
TC70 / TC75 Touch Computer Series
https://www.zebra.com/us/en/products/mobile-computers/handheld/tc7x-touch-computer-series.html
TC70x Operating System (TC700J) Windows 10 Mobile IoT Enterprise v1.13.02 Release Notes
https://www.zebra.com/us/en/support-downloads/software/release-notes/operating-system/tc70x-operating-system-v1-13-02--release-notes.html
For example, if your Zebra device is old hardware and Windows Phone 8/8.1 is running, Windows Phone does not seem to support Windows.Devices.PointOfService namespace.
It is described in the comment of the following article.
Windows Phone 8.1: Scan Barcodes using Camera
If your Zebra device can update to Windows 10 Mobile IoT Enterprise, please check it after doing it.
If you can update it, you can use the barcode scanner sample for Windows 10.
https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/BarcodeScanner
If your device is running on Windows 8 for x86, since Windows.Devices.PointOfService namespace is supported from Windows 8.1, you need to change the OS to Windows 8.1/10 if possible.
In that case you can use following, or above(for Windows10) sample.
Barcode scanner sample for Windows 8.1
https://code.msdn.microsoft.com/windowsapps/Barcode-scanner-sample-f39aa411
If you can not update it, please get the software and documentation for using BarcodeScanner from the vendor on Windows (Phone?) 8.
Seems the usage of Async method wasn't quite right.
Try below code:
BarcodeScanner scanner;
ClaimedBarcodeScanner claimedScanner;
scanner = await BarcodeScanner.GetDefaultAsync();
if (scanner != null)
{
claimedScanner = await scanner.ClaimScannerAsync();
}
More details:
https://learn.microsoft.com/en-us/dotnet/csharp/async
https://msdn.microsoft.com/en-us/magazine/jj991977.aspx?f=255&MSPPError=-2147217396

Windows 10 Universal App Feedback

How in Windows 10 Unviersal Application invoke Feedback Page in Store?
In Windows Phone 8.1 i used
await Windows.System.Launcher.LaunchUriAsync(
new Uri(#"ms-windows-store:reviewapp?appid=" + Windows.ApplicationModel.Store.CurrentApp.AppId));
but now it's not worked for me
Rather than reference an appid in the link use the PackageFamilyName
ms-windows-store://review/?PFN=xxxx
where xxxx comes from Windows.ApplicationModel.PackageId.FamilyName

Make a phone call in Windows 8.1

To make a phone call in Windows Phone 8.1 I have to do the following:
Windows.ApplicationModel.Calls.ShowPhoneCallUI(number, name);
But in Windows 8.1 app there is no class PhoneCallManager in Windows.ApplicationModel.Calls namespace. Is there any way to make a phone call in Windows 8.1 store app?
Thanks in advance!
I've just googled for you and found that link.
http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.calls.phonecallmanager.aspx
Always try to stay on the newest stand in your programming network. I also found that:
Windows Phone 8.1 [Windows Runtime apps only]
is compatible to run
public static void ShowPhoneCallUI(
string phoneNumber,
string displayName
)
I think that microsoft is still updating their classes to 8.1 but you would be able to use already some namespaces.
On Windows Phone (!) you can either use
var phoneCallTask = new PhoneCallTask
{
PhoneNumber = number,
DisplayName = "The Name goes here"
};
phoneCallTask.Show();
or
Windows.ApplicationModel.Calls.PhoneCallManager.ShowPhoneCallUI(number, "The Name goes here");
Maybe you are simply missing an assembly reference?

Open windows store in a windows phone silverlight app

I'm using silverlight to build apps for windows phone 7, 8.0 and 8.1
I have an URI in my code that contains ms-windows-store:PDP?PFN=SupportingComputersInc.Fhotoroom_pxc4cxt3rds1p
I'm trying to open the windows store to this specific app.
I found this code:
Launcher.LaunchUriAsync(uri);
But it is just opening xbox music. Then, I found that:
var options = new Windows.System.LauncherOptions();
options.PreferredApplicationPackageFamilyName = "SupportingComputersInc.Fhotoroom_pxc4cxt3rds1p";
options.PreferredApplicationDisplayName = "Fhotoroom app";
Launcher.LaunchUriAsync(uri, options);
But when I run this code I get a not implemented exception.
Is there another way to open the windows store on windows phone? Am I doing something bad here?
Windows Phone provides special launchers that should do the trick, for example to show a certain app's detail page in Store:
MarketplaceDetailTask marketplaceDetailTask = new MarketplaceDetailTask();
marketplaceDetailTask.ContentIdentifier = "INSERT_APP_ID";
marketplaceDetailTask.ContentType = MarketplaceContentType.Applications;
marketplaceDetailTask.Show();
For a summary of what else is possible (e.g., show the store's search result page for certain search key words) see Launchers for Windows Phone

Is it possible to access a cell phone's contacts from a web app? [duplicate]

This question already has an answer here:
Get iPhone address book contacts into a mobile web app?
(1 answer)
Closed 9 years ago.
Let's say I'm writing an web app that needs to be able to access the contacts in user's phone in order to perform a function, like finding other users of the web app. Similar in nature to how you can find other users of Snapchat on your phone just by letting snapchat access your contacts and march the phone numbers with other snapchat users. Is this possible in a web app? How could I go about implementing it?
Depends for example Windows phone store contacts on your live or hotmail account or android usually on gmail. So if the user login with this information on your site then you can.
see http://msdn.microsoft.com/en-us/library/live/hh826530 for a microsoft example. for a wp example
see https://developers.google.com/google-apps/contacts/v3/?csw=1 for a gmail example.
No, but you can create a phonegap application to publish the phone contact to server.
Apple makes it pretty difficult now days to access any of the phones information(phone number, etc) from an app. You could make it possible in your app to manually get the contacts and then push them to your web app. Might get blocked from the apple store though for trying to do this. Here is an example for iOS
ABAddressBookRef addressBook = ABAddressBookCreate( );
CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople( addressBook );
CFIndex nPeople = ABAddressBookGetPersonCount( addressBook );
for ( int i = 0; i < nPeople; i++ )
{
ABRecordRef ref = CFArrayGetValueAtIndex( allPeople, i );
...
}

Categories