Open windows store in a windows phone silverlight app - c#

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

Related

Windows phone 8.1 create contact task

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.

Why ShareStatusTask don't share status via twitter's app and ShareMediaTask I can share media?

I'm trying share status in Windows Phone 8.1 via ShareStatusTask to Twitter's app and him don't appears in list of apps to share status.
See picture: (http://imgur.com/NVDoUXs,ZS2Ty9h#0)
But, when a I try share media via ShareMediaTask, "like a magic", him appears.
See picture: (http://imgur.com/NVDoUXs,ZS2Ty9h#1)
I can't understand the reason of this problem occurs.
Thanks!
According to this thread, if you do have Twitter configured within your device, then you should be able to view the Twitter option when using ShareStatusTask.
For more: Windows Phone 7 ShareStatusTask - Is it possible to customize it further?
I can solved my problem using this code:
WebBrowserTask wbt = new WebBrowserTask();
wbt.Uri = new Uri("twitter.com/intent/tweet?source=webclient&text=" + tbox_status.Text, UriKind.Absolute);
wbt.Show();

How do I read an embedded text file on Windows Phone 8.1?

(I can find many answers for Windows Phone 7 which probably work Windows Phone 8/8.1 Silverlight, but not for Windows Phone [Store] 8.1)
While testing my application, I want to use a dummy server response. Since it's a large amount of data that includes quotation marks, I don't want to use a constant string and have to escape everything.
How can I read a text file that's included with my Windows Phone 8.1 application?
For this example, I have a file called sample-response.txt and its 'Build Action' properties is set to 'Content'.
var folder = Windows.ApplicationModel.Package.Current.InstalledLocation;
var file = await folder.GetFileAsync("sample-response.txt");
var contents = await Windows.Storage.FileIO.ReadTextAsync(file);
and if you want to double-check that it's been read ok
Debug.WriteLine(contents);

Why Package.Appxmanifest is not found in Visual Studio 2012 for Windows Phone Express?

I am new to Windows Phone 8 development. I wanted to show Toast notifiation, and it is suggested that I need to change in Package.Appxmanifest file. I am using C# as language.
I am using VS2012 Express for Windows Phone. WMAppManifest.xml and AppManifest.xml created by Visual Studio wizard, but I am not able to find Package.Appxmanifest.
Please suggest if there any other way to show toast notification.
Code to display toast:
string toast = "This is toast";
ShellToast t = new ShellToast();
t.Title = "Non null";
t.Content = toast;
t.Show();
EDIT:
Ok, now I see you are trying to create and show a local toast notification. The point is that you can't show toast notifications while the app is in foreground. They can be shown from a Background Agent while your app is not on the foreground. Your code is ok, but it should be places in a Background Agent.
If you still want to show a toast notification within your app, you can do so using the ToastPrompt control from the Coding4Fun toolkit:
ToastPrompt toast = new ToastPrompt();
toast.Title = "Title";
toast.Message = "message";
toast.ImageSource = new BitmapImage(new Uri("ImageUri", UriKind.RelativeOrAbsolute));
toast.Show();
Your linked post is about Windows Store apps.
For Windows Phone apps you need to check ID_CAP_PUSH_NOTIFICATION capability in WMAppManifest.xml file:

How to get Uri source for ConnectionSettingsType in windows phone?

I am working on a windows phone app. I need to get Uri source to the ConnectionSettingsType.Wifi . But, it seems there is no way to do that. Kindly suggest me a way if possible
Read this: How to use the connection settings task for Windows Phone (MSDN)
ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask();
connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.WiFi;
connectionSettingsTask.Show();
There's no such thing as a URI available to 3rd party applications. You'll have to use the task to launch the settings page.

Categories