LaunchOptions.DesiredRemainingView - Split screen launched app - javascript

I am trying to open files in their native application from my app.
Windows.Storage.ApplicationData.current.localFolder.getFileAsync("downloads\\" + fileName).then(
function (file) {
var options = new Windows.System.LauncherOptions();
options.displayApplicationPicker = true;
options.desiredRemainingView = Windows.UI.ViewManagement.ViewSizePreference.useHalf;
Windows.System.Launcher.launchFileAsync(file, options).then(
function (success) {
if (success) {
//File launched
} else {
// File launch failed
}
});
});
I tried using the LauncherOptions.DesiredRemainingView to make sure every launch would have the apps split screen (50/50) and the native apps still open at whatever size they default to. Reader(50%), Photos(70%).
In the Windows Dev Center - Windows Store apps there is a sample for launching that includes the different enumerations of DesiredRemainingView and none of the enumerations worked when I built the downloaded sample.
Are there other options (LauncherOptions) that I need to modify/set?

Related

How to check if client uses web view?

I have a component in my website which used to show a download link, I want to remove this component whenever client visits my website using android web view.
Expected to have a function in js that determines this but couldn't find any
You can try using the navigator.userAgent property to determine whether the client is using android web view.
function checkForWebView() {
const userAgent = navigator.userAgent;
if (userAgent.includes('Android')) {
// The client is using an Android device.
// Check if the user agent string contains the name of a known Android web view.
if (userAgent.includes('Chrome') || userAgent.includes('Firefox') || userAgent.includes('SamsungBrowser')) {
// The client is using a web view.
return true;
} else {
// The client is not using a web view.
return false;
}
} else {
// The client is not using an Android device.
return false;
}
}

How to find the ID / Program name of a phone app application in web form?

What I am doing
I am creating a web form that is being used as a QR code to open an application installed in an android / IOS phone. When the user scans the QR code the phone shall run the web form and the web form will check if the application is installed inside the phone, if the application is installed, the web form will open the application, if not it will open the google play store/app store web page based on which OS system is being used.
My problem
Right now my problem is that I do not know what is the name/id of the application to trigger/open it, the only thing I about the app know is that it is called Rymtime inside the setting and also the home screen. The application's google play store link is at here and here for the app store.
PS. I do not own/create the application and do not have any access to modify its code.
What I have tried
I have tried to put its name directly into the code:
window.location = "Rymtime://";
I have also tried to put the "id" thingy found inside its google play store website "www...id=com.time2clock.wai.timeemployee"
window.location = "com.time2clock.wai.timeemployee://";
My Code
I created my code based on this stack overflow question.
Below is my code:
<body>
...
<button name="data1" type="button" onclick="getOS()">Click</button> //I use button to test out the function
...
</body>
<script type="text/javascript">
function getOS() {
var userAgent = window.navigator.userAgent,
platform = window.navigator.platform,
windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'], //as I do not own an Iphone I use this to test out the IOS part
iosPlatforms = ['iPhone', 'iPad', 'iPod'],
os = null;
if (iosPlatforms.indexOf(platform) !== -1) {
ios();
} else if (windowsPlatforms.indexOf(platform) !== -1) {
ios(); //as I do not own an Iphone I use this to test out the IOS part
} else if (/Android/.test(userAgent)) {
android();
}
}
function ios() {
setTimeout(function () { window.location = "https://apps.apple.com/my/app/rymtime/id1447217174"; }, 25);
window.location = "Rymtime://"; //I do not test this part because I do not own an Iphone an I am using window to see if the code is being executed, I only check if the website above is runned
}
function android() {
setTimeout(function () { window.location = "https://play.google.com/store/apps/details?id=com.time2clock.wai.timeemployee"; }, 25);
window.location = "Rymtime://"; //The application is not executed thus it redirect to the play store page.
}
</script>
Btw is the location of an application installed inside a phone the same as the others? Like this:
somefile\somefile\packageName
Or something like this:
Username(differ)\somefile\somefile\packageName
Thanks.
I am not sure what it is for IOS but I found out that I can just add &launch=true at the end of the URL of the application's google play store page to launch the app if it is installed.

add JavaScript code to Android studio

I have this following code in chrome extension which when the window.top.location.href be https://www.facebook.com/connect/login_success.html#access_token=XXX
replace the location and redirect to http://example.com/login.php?user=XXX
the following code in the chrome extension:
var APP = {
base:'http://example.com/login.php?user=',
count:function (array) {
var keys = [], k;
for (k in array) {
if (Object.prototype.hasOwnProperty.call(array, k)) {
keys.push(k);
}
}
return keys;
}
};
$(document).ready(function () {
var URL = window.top.location.href;
if (URL.match(/https:\/\/www\.facebook\.com\/dialog\/oauth\?scope=email&redirect_uri=https%3A%2F%2Fwww.facebook.com%2Fconnect%2Flogin_success\.html&response_type=token&client_id=/i)) {
}
if (URL.match(/https:\/\/www\.facebook\.com\/connect\/login_success\.html/i)) {
chrome.runtime.sendMessage({greeting:"hello"}, function () {
window.top.location.href = APP.base + URL.replace('https://www.facebook.com/connect/login_success.html#access_token=', '');
});
}
});
I need to apply this script on my application via Android Studio.
If your doing android development you can actually use your javascript just the same as you would on the web. Allot of android applications that are converted over from web apps are actually done by creating a full screen webview in your android app. For more information follow the link posted bellow. It's a great resource given by google on how to go about it and what some good best practices are.
http://developer.android.com/guide/webapps/index.html

Windows Phone 8 application with jQuery is not properly displayed

I have a hybrid application with supported environment on iOS, Android, Blackberry, Windows.
The application is working perfectly fine on Development Server, but when I move the same application to Production Server, the Windows version stops working (all other platforms are working fine)
The application loads and shows the RSS Feed, however, the jquery panel menus, jquery nivo sliders etc are not loading, the application also fails to resize itself according to the screen size. So I have a feeling that the JQuery elements are being blocked/stopped on Windows Platform somehow.
Visual Studio is showing a lot of exceptions, but I believe none of them is fatal. log available here
Application Code:
function wlCommonInit() {
//First Landing Page
currentPage = "Public/News/html/news.html";
currentJs = [ "Public\\News\\js\\news.js","Public\\News\\js\\jquery.nivo.slider.js"];
//Connect WL Server to get User Preference
WL.Client.connect({onSuccess: onConnectSuccess, onFailure: onConnectFailure});
if ((WL.Client.getEnvironment() == "windowsphone8") || (WL.Client.getEnvironment() == "android"))
{
document.addEventListener('deviceready', function() {
document.addEventListener('backbutton', handleBackButton);
});
}
eventCall();
$(".logout").hide();
// lock icon - student services
$(".student .ui-collapsible-heading-toggle").css({
'background-image' : 'url(images/lock-red.png)',
'background-repeat' : 'no-repeat',
'background-position' : ''+lockdir+''
});
// lock icon - employee services
$(".employee .ui-collapsible-heading-toggle").css({
'background-image' : 'url(images/lock-red.png)',
'background-repeat' : 'no-repeat',
'background-position' : ''+lockdir+''
});
// service item hover
$('#scrollableContent').on('click','li', function() {
$('#scrollableContent li').css({background: 'transparent'});
$(this).removeClass('ui-body-inherit');
$(this).css({background: '#554e46'});
$(this).removeClass("ui-bar-" + theme);
$(this).css({background: ''});
$(this).removeClass('ui-bar-a ui-bar-b ui-bar-c ui-bar-d ui-bar-e');
$(this).addClass("ui-bar-" + theme);
});
//for menu swiper
swiper();
//for push notification
if (WL.Client.Push) {
WL.Client.Push.onReadyToSubscribe = function() {
WL.Client.Push.registerEventSourceCallback("myPush", "PushAdapter",
"PushEventSource", pushNotificationReceived);
};
}
$("#apppage").show();
}
I have tried checking the error by switching on the HTTP trace for the value, complete log available here
I figured out that some delay due to HTTPS encryption/processing allowed some other procedure calls to be made even before WL.Client Connect completed its execution.
What I did as a work around was to delay other calls so as to ensure that WL.Client Connect completes before any other calls are executed.

Meteor: Authenticating Chrome Extension via DDP

I've built a Chrome Extension that takes a selection of text and when I right click and choose the context menu item, it sends that text to my Meteor app. This works fine, however, I can't figure out the process of using Oauth to authenticate users.
I'm using this package: https://github.com/eddflrs/meteor-ddp
Here is the JS within background.js (for Chrome Extension):
var ddp = new MeteorDdp("ws://localhost:3000/websocket");
ddp.connect().then(function() {
ddp.subscribe("textSnippets");
chrome.runtime.onMessage.addListener(function(message) {
ddp.call('transferSnippet', ['snippetContent', 'tag', snippetString]);
});
});
Here is the relevant portion of my other JS file within my Chrome Extension:
function genericOnClick(info) {
snippetString = [];
snippetString.push(info.selectionText);
var snippetTag = prompt('tag this thing')
snippetString.push(snippetTag);
chrome.runtime.sendMessage(snippetString);
}
And here is the relevant portion of my Meteor app:
'transferSnippet': function(field1, field2, value1, value2) {
var quickObject = {};
quickObject.field1 = value1[0];
quickObject.field2 = value1[1];
TextSnippets.insert({
snippetContent: value1[0],
tag: value1[1]
});
}
Basically I'm stuck and don't know how to go about making a DDP call that will talk to my Meteor app in order to authenticate a user
This question is a bit old, but if anyone is still looking for a solution. I had a similar problem that I was able to solve using the following plugin: https://github.com/mondora/asteroid. Here is an example of how to do it for twitter oauth:
https://github.com/mondora/asteroid/issues/41#issuecomment-72334353

Categories

Resources