To launch another specific app we can set the other app's package family name:
var options = new LauncherOptions();
options.TargetApplicationPackageFamilyName = packageFamilyName;
Uri uri = new Uri(protocol);
var succeeded = await Windows.System.Launcher.LaunchUriAsync(uri, options);
If the other app wasn't installed, Store download page opens. But this happens only on Windows 10 desktop, on the phone nothing happens, it just fails.
However if we remove options parameter it searches for any app on Store.
await Windows.System.Launcher.LaunchUriAsync(uri);
Is there anyway to have Desktop behavior on Mobile too? I mean open exactly a specific app not any app that registered for that protocol
The documentation states this is for Desktop only at this point in time. Potentially the feature will make it to Mobile (and other Windows flavours) in the future.
Related
Similar to this question which invokes the Windows 10 store to allow a user to write a review or rate an app, I'd also like to be able to invoke the Windows 10 Feedback app and allow users to provide feedback there.
I cannot seem to find much information on:
How this works in general. Can any old app use this service? (I
notice it just kind of shows whatever apps I have running)
How to invoke the Windows Feedback app with my package id
In short - not that I can see.
Other apps are invoked via protocol activation. I haven't seen this documented for the feedback app though so I have to err on the side of 'we haven't made this available yet' (I'm still checking though)
Here's an overall guide to the process http://blog.jerrynixon.com/2012/10/walkthrough-using-windows-8-custom.html?m=1
When I look in the registry under HKEY_CLASSES_ROOT\Extensions\ContractId\Windows.Protocol I see (shortened a tad)
[HKEY_CLASSES_ROOT\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.WindowsFeedback...\ActivatableClassId\App.AppX7eaybq6p4x7d4jgd6w6jk7r5dg6yhmbf.mca\CustomProperties]
"Name"="windows-feedback"
So - give that a try via launching windows-feedback
If I do Windows Key-R (run): windows-feedback://
it works fine so this should work:
var uri = new Uri(#"windows-feedback://");
var success = await Windows.System.Launcher.LaunchUriAsync(uri);
if (success)
{
// URI launched
}
else
{
// URI launch failed
}
Update
I've done some searching and it seems the magic parameter there is
windows-feedback:?contextid=522
That launches the NFL feedback for example. This is a predetermined number - I'm not sure how one gets on this list though.
I have an exception only in one PC, in others all work fine, anyone know wher it is comming from?
dditional information: Requested Windows Runtime type
'Windows.Media.Capture.MediaCapture' is not registered.
This exception is showing only in modern style apps (windows strore app) in windows 8.1. In WPF or Windows Form apps camera works fine. Code is fine, because in other pc work great:) i install system one more time, but the exception still showing up.
Looking at Microsoft's Windows Universal Samples (https://github.com/Microsoft/Windows-universal-samples/blob/e13cf5dca497ad661706d150a154830666913be4/Samples/SpeechRecognitionAndSynthesis/cs/AudioCapturePermissions.cs#L35) shows following piece of code
try
{
// Request access to the microphone only, to limit the number of capabilities we need
// to request in the package manifest.
MediaCaptureInitializationSettings settings = new MediaCaptureInitializationSettings();
settings.StreamingCaptureMode = StreamingCaptureMode.Audio;
settings.MediaCategory = MediaCategory.Speech;
MediaCapture capture = new MediaCapture();
await capture.InitializeAsync(settings);
}
catch (TypeLoadException)
{
// On SKUs without media player (eg, the N SKUs), we may not have access to the Windows.Media.Capture
// namespace unless the media player pack is installed. Handle this gracefully.
var messageDialog = new Windows.UI.Popups.MessageDialog("Media player components are unavailable.");
await messageDialog.ShowAsync();
return false;
}
So you have to install "Media player components".
I just had this issue with Windows 10. I had installed the N edition, but it looks like since it is missing Media Player, the classes related to MediaCapture are also missing.
As Hans Passant mentioned, the MediaCapture class was not registered in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsRuntime\ActivatableClassId.
I reinstalled Window 10 (not the N edition) and now the class is registered.
Windows Phone 8 gives the ability to change the default camera app with another one downloaded from the store, making this new app the one that's launched when you hit the camera hardware button.
So I was wondering if is there any chance to launch this app using the CameraCaptureTask.
What I'd like to do is something simple like
var camera = new CameraCaptureTask();
camera.Show();
camera.Completed += new EventHandler<PhotoResult>(camera_Completed);
but I want this to work with the default app that the user chose on its device, and not with the basic Microsoft's one.
I've not found anything online, so I'm asking to you guys if I can make what I want.
Sorry, not possible with the current API.
i am facing a weird problem. I am using Windows phone 8.1 silverlight and Windows universal link for toast notification. I am able to get the toast notification in Windows Phone app it is nearly same way in Windows 8.1 as mentioned in the link. But toasts are not comming in Windows 8.1 part.
Steps :-
1 -> I have enabled the Toast from Package.appxmanifest file.
2 -> Then i have added this code in App.Xaml.cs in on_launched event as mentioned
It is showing the registeration successful as mentioned in the link
private async void InitNotificationsAsync()
{
var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
var hub = new NotificationHub("<hub name>", "<connection string with listen access>");
var result = await hub.RegisterNativeAsync(channel.Uri);
// Displays the registration ID so you know it was successful
if (result.RegistrationId != null)
{
var dialog = new MessageDialog("Registration successful: " + result.RegistrationId);
dialog.Commands.Add(new UICommand("OK"));
await dialog.ShowAsync();
}
}
3 -> Now i send the notification from back end(Hub is working in case of phone mpns notification).
public static async void SendNotificationAsync()
{
NotificationHubClient hub = NotificationHubClient.CreateClientFromConnectionString("<connection string with full access>", "<hub name>");
var toast = #"<toast><visual><binding template=""ToastText01""><text id=""1"">Hello from a .NET App!</text></binding></visual></toast>";
await hub.SendWindowsNativeNotificationAsync(toast);
}
Question : -
Do you guys have a clue why it is not working in Windows 8.1 or what i am missing. This is the simplest example i am going through. Any help is appreciated.
Edit :- This is something interesting.
When i tried to send the notification from azure portal. From DEBUG tab of My-NotificationHub and from here i choose WNS toast then it showing an error.
Error - The token obtained from the token provider is wrong
but when i tried to send MPNS notification then there is no error. as i already mentioned it is working for WP 8.1 silverlight MPNS toast.
What could be the cause of this error ?
Toast will not work on simulator, as stated in the MSDN documentation:
Note When testing toast notification code functionality through
Microsoft Visual Studio, you must use either the Local Machine or
Remote Machine debug setting on a Windows x86, x64, or Windows Runtime
machine. You cannot use the Visual Studio Simulator debug function
option—your code will compile and run in the Simulator, but the toast
will not appear.
Source: http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh868254.aspx
If I remember correctly on Windows 8 the toast notifications did not work when I was using the simulator. I had to deploy my Windows 8 application on my computer and not the simulator for me to be able to see toast notifications.
I'm trying launch an external app sending one parameter from my application. Anyone knows one way to do that.
Thanks!
You have only two ways to launch an external application
Launch registered file type
Launch registered URI scheme
You can find additional details at the MSDN: Auto-launching apps using file and URI associations for Windows Phone 8
For example:
await Launcher.LaunchUriAsync(new Uri("ms-settings-emailandaccounts:///"));
This goes to "email and accounts" settings. You can find URI schemes for other system apps here: Reserved file and URI associations for Windows Phone 8
There are also some new options for wp 8.1:
ms-settings-workplace
ms-settings-proximity
ms-settings-nfctransactions
ms-settings-networkprofileupdate
ms-settings-notifications
ms-settings-camera
ms-settings-uicctoolkit
ms-battery
ms-wallet
You can also register your app for a URI association and pass parameters to it:
await Launcher.LaunchUriAsync(new Uri("myapp:///parameters"));