Is it possible to open a web page from a Cortana background app? - windows-10-universal

Cortana background apps provide deep linking capabilities, which allow the developer to link to a specific page within her app. I'm wondering if it's possible to open a different application instead, for example a web browser.
My current work-around is to deep-link into my app, and then call Windows.System.Launcher.launchUriAsync as soon as my app is launched. However, this means that the app opens along of the web browser. I would like it to not open at all! Is that possible?

From the MSDN page for LaunchUriAsync:
Unless you are calling this API from a Classic Windows application, this API must be called from within an ASTA thread (also known as a UI thread).
Unfortunately, Cortana's background task is not a UI thread. You're running as a background task, and communicating to Cortana's UI via a set of APIs provided for that purpose, which are limited by design.
Anything you try to do that requires you to be in the UI thread is going to fail for the same reason. You could try hosting the web control in your app however to remove the chain-launched browser from the equation.

Related

Winappdriver and selenium in the same automated test

Hi I could do with some help / more experienced eyes.
I have a WPF application which I have started automating some UI tests for using winappdriver, upon further investigation it has embeded html in it - webview, and can fire off requests to open the default browser with app related content - such as help files.
Has anyone had experience in working with this? For example:
open the WPF app,
click on help button on the WPF app which will open a browser and
then continue the test to ensure that the correct help page has been launched with the correct content in relation to the WPF page it was fired from.
Presumably this can be done in my case with chrome driver (winappdriver cannot see the content on the webpage). I have tried using selenium's window handles, but it's like the driver can't see the already open browser page. So I am at a bit of a loss and really not sure what to do.
In previous roles I was used to using Ranorex, which does both windows and web based UI automation. So I have never had any experience using multiple driver types to do the one test.

app should not give service call in background mode

I have built an application in codename one . I want A Scenerio where if my app runs in background on device then it should not give call to the service .it should call only if user opens the application.
Check out the developer guide for details on background execution. Generally an app can't do "anything" in the background and has a lot of restrictions when it comes to that.

restrict a web browser from streaming or downloading a file in Windows Phone 7

I am developing an app which is using a web browser control. In this app I want to restrict all streaming and downloading processes using web browser.
For example, if I click on a song link and if that leads to streaming and playing of that song in the web browser itself, I want to restrict such activity.
Is this possible?
Handle Navigating event of the browser. In the handler check the Uri, if you don't like it you can cancel the navigation.
This approach is not actually very reliable, and definitely should not be used for anything security-related.
It may or may not work for you.
OK, plan “B”.
You can handle browser’s Navigated event, in this event call browser.InvokeScript( "eval", JavaScriptSource ); where JavaScriptSource is the JavaScript code that alters the behavior of your target web site however you want.
The downside of this approach — your JS will likely stop working as soon as the web site owner change their JS to incompatible. If you’re the web site owner, you’re fine with that.

How to integrate payment gateway in applications created using javascript frameworks like ExtJs?

Our application is a one-page application created using ExtJs. For any user action, the browser tab is never reloaded and all the actions are performed using ajax. A user can open/close multiple ExtJs windows/panels within the same browser tab, and this way everything remains confined to the same browser tab.
Now, we need to integrate payment gateway in the application, which involves redirecting the user to the bank website and having her brought back to our application.
The issue is that when browser redirects the user, then all the application javascript code along with panels and windows get destroyed, and when the user comes back to the application then she finds it to be different from one she left.
As a solution to this, we were thinking of using following two appraoches:
Option 1. Maintaining the state of application - When user leaves for the bank's website then somehow we maintain the state of application - like which windows are opened carrying what data, which variables have which values etc.. and when user returns back, we generate the same application state for her.
Option 2. Have a browser pop-up window for payment gateway - We intend to provide a button which will open a small pop-up window carrying the transaction details, and in this pop-up window the entire payment gateway process will take place taking care of redirection and everything.
Option 1 is proving to be very cumbersome and complicated as maintaining the exact state is not getting feasible.
For Option 2, we are not sure if this is safe and possible?
Has anyone implemented such an approach earlier. Otherwise, what are the other options which we can go for?
Thanks for any help in advance.
I faced the problem and I implemented it using websocket/polling in the main application while a new window pops up for the payment.
After the payment is successful the main application will be notified.
That way each payment runs in it own sandbox totally unbound from the main application which makes maintenance quite easy. Note that our backend create a new session for each payment using the existing one.
I think it is not uncommon to open new windows for payment that's why I decided to go this.

Silverlight Notification API in-browser

I'd like to use the Notification API to create toast notifications for a Silverlight app designed to run both in and out of the browser, but the NotificationWindow class is only available OOB.
Does there exist anything that can replicate the behaviour inside the app? My idea is to have a container in the bottom right of the screen overlaying all other content. Then, create a wrapper which detects OOB-mode, passing params to the Notification API if possible, or populating and showing my own container if not. Is there anything that does this available?
It seems strange that MS chose not to implement something like this, as has been pointed out before.
Displaying a notification in browser is simple. You just need to use a popup and make it appear in the right place. See the following post as an example.
Now the difference with that approach is that the notification will show inside the browser. In OOB it shows outside the window and it's visible even if the windows is minimized. Due to security reasons it's not possible to directly do this.
Out of interest, Chrome Applications like Tweetdeck and Gmail, are able to display notifications outside of the browser. I think this might be a possiblity, but not exactly a Silverlight and cross browser solution.

Resources