WindowsPhone 8 (A jump to another application - windows-phone-8

WindowsPhone 8 (A jump to another application
)
I want to in my applications to invoke other applications, the application I don't know any news, just know the name, how do I use
. Await the Windows System. The Launcher. LaunchUriAsync (new Uri (" wechat: "));
"Wechat" should be placed here called program I want to use

First you have to write the following protocol in the WMAppManifest.xml under the Extensions tag. Thereafter you can launch your app from any other apps with the specified protocol name using Launcher.LaunchUriAsync method.
<Protocol Name="webchat" NavUriFragment="LaunchUri=%s" TaskID="_Default"/>
For further clarification you can refer the below link.
http://msdn.microsoft.com/en-in/library/windowsphone/develop/jj206987(v=vs.105).aspx

Related

Windows Phone Custom URI

in my windows phone 8 application i am using custom uri association to launch another application through my phone.
i.e
await Windows.System.Launcher.LaunchUriAsync(new Uri("sixtag:"));
but my app is not able to get certified for store because of this. the testing team tells that you app terminates unexpectedly while executing this.
now, i don't know how to deal with this.
is there any way to throw exception if the app which i am launching is not installed on phone ?
or i should try something else so my task gets accomplished and app gets certified for store as well.
You do not need to wrap your launch in try/catch or check for success as described in the other answers. As soon as you call LaunchUriAsync, the platform takes over and will automatically handle the possibility of no app being installed by asking the user if she wishes to search in the store.
A couple of things to double-check:
1) Ensure that you can successfully back into your app following the navigation to sixtag.
2) Ensure that your call to LaunchUriAsync is the direct result of a user action (eg. tapping a button)
try
{
await Windows.System.Launcher.LaunchUriAsync(new Uri("sixtag:"));
}
catch
{
MessageBox.Show("please install Sixtag from the app store","AppMissing", MessageBoxButton.OK);
}
you can perhaps display another button and on clicking directly navigate to the app store. See if this solves your problem. Do vote it up if it does :)
You are needed to handle that as shown here . Also Read out Remarks given there.

Which function does OpenAs_RunDLL finally calls under Windows 8?

I'm trying to use OpenAs_RunDLLW to let the user select application he wants to open specific file with. But I don't want to really launch anything, just to let the user select and remember his choise so I can then open the file with this program later. In Windows XP, Vista and 7 OpenAs_RunDLLW finally used to call ShellExecuteExW, so I could temporary put the int 3 opcode at the beginning of this function, catch the exception and get all parameters passed to ShellExecuteExW. This was good and really worked.
But under Windows 8/8.1 it seems that OpenAs_RunDLLW does not call ShellExecuteExW, since the breakpoint is never hit. The selected app is launched instead. So, my question is - which API function does OpenAs_RunDLLW finally call to execute the program under Windows 8?
I believe that the shell now uses IAssocHandler::Invoke to open the item. However, you probably don't really care about that; what you want is a way to find out how to get the invocation handler.
For that, you want ShAssocEnumHandlers, which takes a file name extension and returns an association enumerator (that is, a function that will enumerate all the various applications that can open that extension).
On Windows Vista and later, use SHOpenWithDialog() instead of calling OpenAs_RunDLL(), and then use SHAssocEnumHandlers() to find out which handlers are registered and to invoke a particular handler when needed, instead of using ShellExecute().

Windows Phone 8 ShellTile TargetUri

One Quick Question:
I want to navigate to settings(cellular..) from an secondary livetitle.
The Problem is the targetUrl for the Shelltitle(selectedShortcutsMenuControl.TargetUrl) in my app looks like this: "cellular",
and thats not an valid Uri format.
Exception : "An exception of type 'System.UriFormatException' occurred
in System.ni.dll but was not handled in user code"
StandardTileData data = new StandardTileData();
data.Title = selectedShortcutsMenuControl.Title;
data.BackgroundImage = myUri;
ShellTile.Create(new Uri(selectedShortcutsMenuControl.TargetUrl,UriKind.RelativeOrAbsolute), data);
Is there a way to fix this or is there a way, to directly navigate to cellular Settings form the livetitle?
<ctl:MenuData x:Key="ShortcutsMenuControlData">
<ctl:MenuItemData Title="Cellular" TargetUrl="wifi" Image="/Images/Item-fc0d2405-5b0f-4f3d-ba3e-5b93fbfe2c44.png"/>
<ctl:MenuItemData Title="WiFi" TargetUrl="cellular" Image="/Images/Item-c9f6c2c7-44e1-4079-ad90-e31b8a59333e.png"/>
<ctl:MenuItemData Title="Airplain Mode" TargetUrl="plaine" Image="/Images/Item-10845593-26f7-485a-bef7-cf9b9b0cf9fe.png"/>
<ctl:MenuItemData Title="Bluetooth" TargetUrl="bluetooth" Image="/Images/Item-294e2b67-5534-43b3-ae4e-aecf180c9274.png"/>
</ctl:MenuData>
So inorder to navigate to the native phone settings you need to use the built in URI schemes.
They can be found on MSDN here
Specifically for the ones you are asking for the codes are
ms-settings-airplanemode: Launches the Airplane Mode Settings app.
ms-settings-cellular: Launches the Cellular Settings app.
ms-settings-bluetooth: Launches the Bluetooth Settings app.
ms-settings-wifi: Launches the Wi-Fi Settings app.
replace your target url's with these and it should work

How to exit or quit my Windows Phone 8 app programmatically?

I am developing a Windows Phone 8 application.
How can I exit or quit programmatically (through code) from my Windows Phone 8 app?
What are the various ways in which I can programmatically (through code) exit or quit from my Windows Phone 8 app?
In WP8 there's a new API which lets you terminate the application:
Application.Current.Terminate();
By calling the method your app will immediatelly terminate. However the Application_Closing event won't be called, and IsolatedStorageSettings.ApplicationSettings dictionary won't be automatically persisted.
So if you have data hanging around in IsolatedStorageSettings.ApplicationSettings that you don't want to lose then it's wise to save it:
IsolatedStorageSettings.ApplicationSettings.Save();
Application.Current.Terminate();
Also the method should not be misused. See http://msdn.microsoft.com/en-us/library/windowsphone/develop/system.windows.application.terminate(v=vs.105).aspx for more info for legitimate use cases.
while (((PhoneApplicationFrame)App.Current.RootVisual).CanGoBack)
{
((PhoneApplicationFrame)App.Current.RootVisual).RemoveBackEntry();
}
In Windows Phone 8.1, the method has been renamed to
Application.Current.Exit();

Using App.Current.Terminate() method in Windows phone 8

As windows phone 8 provides us with this method for programmatically terminate an app, will there be any issue while app submission if we use this in app for terminating a page while there is no backentry in the navigation history?
There won't be any issue in certification when using this call, but make sure you have saved all data in your app when calling this, because this call effectively kills your app immediately - ApplicationClosing even handler won't be raised after it!
Why would you call Application.Terminate when navigating back with an empty back stack? Just let the app close itself. Seems a bit pointless to me to overuse Application.Terminate().
I can't say much about the new Terminate method, but I do have an app (NOTE: Not a game) that does the following at certain points
private void Kill()
{
new Microsoft.Xna.Framework.Game().Exit();
}
This app passed certification without any problems. This was an app for both WP7 and WP8 so I did not have the ability to use Terminate().