Is there a way by which my fallbackURI can redirect the app to a webview(.xaml) in winRT app
LauncherOptions Options = new LauncherOptions();
Options.FallbackUri = new Uri("ms-appx:///abc.xaml", UriKind.Absolute);
await Windows.System.Launcher.LaunchUriAsync(uri,Options);
Kindly Help.
You cannot just place an internal xaml Uri in there.
What you could do it register you app for a protocol activation and put an uri that utilizes your protocol as fallback.
Read more about protocol activation here.
Related
Hi am developing a Windows store 8.1 app using C# and xaml. I get the some configuration settings in my mail with a URL, which are lets say host address, port number, and some app id. When i click on the url it should open my app and fill the settings in the app(Defaultly am launching Configuration page in my app which contains three textboxes, those three values should pre populate here)
Is it possible to do it Winrt 8.1? If so how can i achieve it? Can someone please help me out to solve this?
Thanks in advance
First you need to handle URI activation.
In your manifest, add a Protocol and reserve a Name(here is alsdk). You can refer here for more information.
Then please override OnActivated event in App.xaml.cs (receive params here).
public App()
{
this.InitializeComponent();
this.Suspending += this.OnSuspending;
}
protected override void OnActivated(IActivatedEventArgs args)
{
if (args.Kind == ActivationKind.Protocol)
{
// Retrieves the activation Uri.
var protocolArgs = (ProtocolActivatedEventArgs)args;
var uri = protocolArgs.Uri.ToString();
}
}
After that you can launch your app with params in the browser:
As for passing params,please refer here.
I tried consume a AX dynamics secured web service in windows phone universal app. But i am unable to do so as windows phone run-time doesn't support service models(i.e. It doesn't provide option to add service reference). Hence Microsoft has proposed a work around using HttpClient Class.
So i did the following:
using (HttpClient client = new HttpClient())
{
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "http://xxxxx/xppservice.svc/GetData");
HttpResponseMessage response = await client.SendAsync(request);
string data = await response.Content.ReadAsStringAsync();
var dialog = new MessageDialog(data);
await dialog.ShowAsync();
}
But the problem here is, the service which i am using is secured and i have the authentication credentials. But i am unable to figure out how supply them while sending the request. Can you please help me?
A
I'm developing a Flex mobile application and I'm using the Http Services within FlashBuilder (4.7) to send/receive data. I'm having some issues with how the server is setup to accept calls (from the mobile platform) and apparently setting the User-Agent in Android works just fine. But I can't seem to be able to find a way to set the User-Agent in FlashBuilder.
Any ideas?
Thanks
var request:URLRequest=new URLRequest('URL_OF_YOUR_SERVICE');
var userCredential:Object = new Object();
userCredential['user_email'] = 'YOUR_MAIL';
userCredential['user_password'] = 'YOUR_PASSWORD';
request.data=JSON.stringify(userCredential);// use this if your service accept json only else give Object directly
request.method = 'post';// specify here method GET or POST
var loader:URLLoader=new URLLoader();
loader.addEventListener(Event.COMPLETE, userLoginCompleteHandler);
loader.addEventListener(IOErrorEvent.IO_ERROR, onIOErrorHanlder);
try
{
loader.load(request);
}
catch(error:Error)
{
trace("Login Error:: "+ error.toString());
}
may this will help you, here i have defined userLoginCompleteHandler and onIOErrorHanlder event listner for result and fault.
No, you can't set the User-Agent header in Flex.
From this Adobe forums post:
Note again that since the underlying Flash API is flash.net.URLLoader there are certain headers that
you cannot send. For details, please see the docs for flash.net.URLRequestHeader.
The URLRequestHeader docs say:
In Flash Player and in Adobe AIR content outside of the application
security sandbox, the following request headers cannot be used:
... User-Agent, ...
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
I have a small multiplayer Flash game in which you can display a player profile by clicking at his or her avatar:
const PROFILE_URL:String = 'http://myserver/user.php?id=';
try {
navigateToURL(new URLRequest(PROFILE_URL+id), '_blank');
} catch(e:Error) {
}
This works well, but now I'd like to extend the user.php, so that players can add comments about each other. For authorization I'd like to use HTTP cookies, passed from the game.swf to the user.php.
(I don't want use GET or POST here, because GET will have the auth. variables in the URL and players might occasionaly send that URL around or post it in my forum. And POST will ask to re-post the request when you reload).
My problem is that I can't find the way to set HTTP cookies through the navigateToURL() method. Please advise me
Regards,
Alex
You could first authenticate by logging in via a seperate call, for example login.php and that script would start a session. Then all other calls to the same domain would already have the session started and you could check authentication. No need to worry about cookies when PHP can do it for you.
Assuming that you already have the cookie value in your swf you should be able to use the URLRequestHeader together with the URLRequest as follows:
var header:URLRequestHeader = new URLRequestHeader("Cookie", "<the cookie>");
var request:URLRequest = new URLRequest("http://example.com/script.php");
request.requestHeader.push(header);
request.method = URLRequestMethod.POST;
navigateToURL(request, "_blank");
Under certain circumstances, the browser will send the cookie to the server if it has been already set even if you don't explicitly include it in the request. This depends on the browser and the version of the Flash Player. You might also need to adjust your crossdomain.xml file.
Also note that there might be security implications of passing around an unencrypted cookie token. See Firesheep.