I am working on a Windows 8 app where i want to execute a process with its parameters. Say "shutdown.exe"
I am working on the app in Javascript and HTML5. As far as i have researched it is not possible to do the same due to sandboxing (which i am not sure).
So is there a way to invoke a command process within a Windows 8 App ?
No. The closest thing is protocol activation, whereby an app can launch another via a URL. You can register an app to respond to any URI you want, but if someone else does the same, then your app won't run by default, and the user will be prompted to select which app they want to use to respond to the launch request.
You can check out how this works via the Application launching sample and the MSDN documentation.
Related
I am developing a public Windows 10 app that should also be launched using a specific URL (https://app.scancircle.com) from my website and emails.
I partially managed to do that using the info on https://learn.microsoft.com/en-us/windows/uwp/launch-resume/web-to-app-linking. This works great when the URL is activated from an email or a command prompt, but not from within a web browser.
It should be possible as it works for MS Teams and Skype invitations (see e.g. https://join.skype.com/bYUOZtOCL4pi), but I cannot figure out how they managed to do it.
Anyone any suggestions?
Some further info:
It should work in Windows 10 with any modern web browser and without any specific settings or add-ons (unless that can easily be done during the installation of the app);
If the app is not installed, the specified URL should be opened so I cannot use a specific URL protocol like scancircle://
On my computer, my app is listed under Settings > Apps > Apps for websites (so that worked);
The app is not yet listed in the Microsoft Store (working on that);
The suggested JSON file has been installed in the root directory (but does not seem to be used for local installations);
I am converting an existing program to a Windows 10 app in VisualStudio 2019 using the info on https://learn.microsoft.com/en-us/windows/msix/desktop/desktop-to-uwp-packaging-dot-net.
I am creating a small debugging app to monitor a particular interaction (WebRTC) between two users of my main app.
I have a web app (React) and a mobile app (React-Native) that each connect through socket.io to a node server I created. This node server's purpose is to collect information from both users, and display this information in a web page in real time.
My web app has a button that when you click it it opens up that debugging web page in a new tab with the debugging information; I just use window.open. Is it possible to do something similar from my mobile device, running a react-native application? That is, can I click a button and have a browser tab open on my laptop somehow? Does React-Native remote debugging work with something like this?
There is currently no supported way you can do this in React Native.
However, you can certainly add it yourself.
Navigate to node_modules/react-native/local-cli/server/middleware/getDevToolsMiddleware.js
Look for launchChrome(debuggerURL);, you can invoke another launchChrome function with your desired URL.
This will only appear when you select Debug JS Remotely.
You can configure the CLI server code more to launch the URL when you are not debugging.
I'm trying to create a web page that automatically opens an Android app but only if app is installed. In case it's not it should redirect to another web page.
The app is already in production and is properly handling deep links like example://content?id=42. The format of the link could not be changed.
What I've already tried
1) Redirects and timeout:
window.location.replace('example://content?id=42');
setTimeout(function() {
window.location.replace = 'http://example.com/content?id=42';
}, 500);
Works fine for iOS but for Android it redirects to example:// immediately and thus gives me ERR_UNKNOWN_URL_SCHEME. Seems to be no go for Android.
2) iframe approach. Impossible in rencent Chrome versions. Also doesn't seem to work in Samsung browser.
3) Intents with S.browser_fallback_url. Works well but in Chrome only. Doesn't work in Opera and Samsung browser... most probably nowhere else but Chrome 25+.
use http://example.com/content?id=42 as the link and add the intent filter to your activity in manifest
<intent-filter>
<data android:scheme="http" android:host="example.com" />
...
</intent-filter>
However, a list of app registered, e.g. browsers, will show up when the link is first accessed on the machine.
You need to be aware of the browser of the client, and its operating system and adapt your site to them. For example, if the browser is Chrome and the OS is Android, use the Intent solution; if the browser is Safari use the example:// schema. You can get the info looking at the User-Agent header of the request, but I'm sure there are many open source libraries that can help you to get infos related to browser and OS.
Seems like you could at least approximate the experience by letting the user give a one-time assist:
Have your web page itself have the fallback url content.
When the page is hit check the user agent to see if the os is Android
If its Android, show the user a choice prompt/dialog to use web or Android
If they choose web (remember the choice with local storage), dismiss the dialog and show the fallback
If they choose android (remember the choice), redirect to the app with the intent:// URL (without fallback_url), will take them to market to install if necessary
After the first interaction, it'll work as you describe - automatically taking them to the web page or the installed app.
You can try using this scheme(to be sent to the user):
intent://details?id=X&url=Y&referrer=Z#Intent;scheme=market;action=android.intent.action.VIEW;package=com.android.vending;end";
X: Package name of the App
Y: Deep link scheme which should be defined in the App's manifest.
(Please refer this)
Here, they have used this URL as an example: "http://www.example.com/gizmos" , therefore Y should be replaced by this URL.
Z: Can be any data which you want to pass to the App via Google Play.
Please take note that any data which you pass should not be '&' separated because the original parameters are itself '&' separated.
PS: The Google Play makes a broadcast to the app. So make sure you receive the broadcast in a receiver.
How can you check that a web page is being served under a native app on Windows phone?
You cant use custom user agents, so to date we have done the following...
Check the user agent for Windows Phone, check it for WebBrowser which indicates its served from the WebBrowser windows control, and then try to call a method in our native app to guarantee we are in our app.
However, the latest browser updates to windows have removed WebBrowser from the user agent.
This means there would be delay when viewing the page on Mobile IE, as we would have to try to talk to our native app to see if it's there or not, and wait for a timeout to assume its not there.
So..
1) Is there anyway now to set custom user agents in windows Mobile - everything we have tried to date has failed.
2) Is there another way we can indicate to the page that its running in our app? Inject some JS at the start some how?
3) Any other way to somehow tell the web page what its running in? Cookies, local storage?
We need to know where its running before it has finished loading, so JS scripts can tell where they are running as they load up.
m
My organization already developed iOS and Android apps, and is starting to develop an app for Windows 8. In case it matters, the app is using Phonegap a.k.a. Cordova.
On the existing apps, the user downloads a very "slim" app from the store, containing a minimal HTML page. The user logs into a server, and then script tags are dynamically added pointing to locations on that server. Similar to web apps, scripts are downloaded to the client and then executed.
Windows 8's new security model blocks this behavior. Since the app runs in the local context and the script is on the web, I get the error "An app can’t load remote web content in the local context."
Is there a way to get around this restriction?
I'm open to "creative" suggestions and hacks, up to a point. I've already tried a few things, such as fetching a script with plain XHR calls and then injecting the response to a pre-defined script tag. Windows blocked this and all other attempts.
I also considered rendering everything in an iframe with a "ms-appx-web:" scheme (learned about this scheme here, "Schemas and contexts" section). This might allow me to load remote scripts, but would prevent code from accessing APIs of the locally-running JavaScript code -- Cordova and Windows Runtime. This access is necessary for my app. If there's a way to access Cordova and Windows Runtime from the web context, that might be useful too.
I very much doubt it.
The whole point of the MS Windows Store certification model is that they can test your code for malware/ crashes. If you can change the code on the fly, you could ship a perfectly harmless app, have it certified by MS, and then change it to something dreadful after the user installs it.