iPhone URL Schema block safari error alert - iphone

I tried open my app if installed in iPhone from safari browser simply passing like myApp:// using javascript document.location="myApp://"; if not redirect to another webpage to display app details. but when app not installed safari throw "Cannot open Page" alert ,if redirect to another webpage that time also safari alert box not dismiss automatically.
Any one help me to how redirect the webpage without safari cannot open page alert if app not installed on device.
My Code :
Simply html file and body onload="checkdevice();return false;"
display message in textarea "document.getElementById('txtMsg').value"
function checkdevice() Check browser detection
{
if((navigator.userAgent.match(/iPhone/)) || (navigator.userAgent.match(/iPad/)) || (navigator.userAgent.match(/iPod/)))
{
document.getElementById('txtMsg').value ="Running on iPhone /iPod /iPad Device";
checkAppExists();
return true;
}
else
{
document.getElementById('txtMsg').value ="Please run this page on iPhone / iPod / iPad Device";
checkAppExists();
return false;
}
}
function checkAppExists()
{
var time = (new Date()).getTime();
window.location="myApp://";
setTimeout(function(){
var now = (new Date()).getTime();
if((now-time)< 400)
{
window.location="http://mydomin.com/appdetails.html";
}
else
{
document.getElementById('txtMsg').value ="App Installed"; * App will launch here *
}
},300);
}

Related

How do i make flutter application that open another app within it and not webview

I have tried to make flutter app in which within it I have a list of another application. I want on tap of any app within a list to open that app, like the code below. How to do it in flutter ?
openExternalApp : function(packageName) {
try {
var KonyMain = java.import("com.konylabs.android.KonyMain");
var context = KonyMain.getAppContext();
var pm = KonyMain.getAppContext().getPackageManager();
var intent = pm.getLaunchIntentForPackage(packageName);
if(intent !== null && intent!== undefined){
context.startActivity(intent);
}
else {
var url = "https://play.google.com/store/apps/details?id="+packageName;
kony.application.openURL(url);
}
} catch(e) {
kony.print("error opening app external: "+e)
}
}
If i understood correctly you want to do something like kindle which allows the user to open a book (in this case an app) directly from your app.
That being the case, maybe this package can help you https://pub.dev/packages/device_apps
to check for installed apps List<Application> apps = await DeviceApps.getInstalledApplications();
and to launch the app DeviceApps.openApp('package.name');
This package currently only supports android.

React-native facebook login shows blank screen / white screen

facebook: ~5.0.1andexpo: 33.0.0`
onFacebookSignIn = async () => {
try {
const {
type,
token,
} = await Facebook.logInWithReadPermissionsAsync(facbookAppId, {
permissions: ['public_profile', 'email'],
browser: 'browser'
});
if (type === 'success') {
const response = await fetch(`https://graph.facebook.com/me?access_token=${token}`);
Alert.alert('Logged in!', `Hi ${(await response.json()).name}!`);
} else {
console.log('cancel');
}
} catch ({ message }) {
alert(`Facebook Login Error: ${message}`);
}
}
**on click of a button it opens facebook login page login via my email and password works fine but in case of login via install facebook app, it takes me to next allow page but than next page show blank:(
i have spent couple of days on this on and off, thankyou.
screen**
Since Facebook actually opens and you are prompt with the login page then it is most probably that you make a mistake setting up your Facebook app on your Facebook developer account.
Follow this to set your Facebook app correctly
Make sure to set host.exp.Exponent for your app field iOS Bundle ID
Make sure to set rRW++LUjmZZ+58EbN5DVhGAnkX4= for your app field Android key hash
Please follow this since you are using expo SDK 33

Facebook login popup doesn't close after login on iOS8

I'm testing my web app login flow on the iOS8. I notice that on iOS8, the login dialogue pops up, but after logging in, it just stays there, showing a blank page.
The login works, because the page behind it shows the user information, but the popup just stays there, while it should close automatically. On iOS7 and iOS6 it does close. On desktop browsers it closes too.
I've tested some other random sites (for example brainfall.com) using FB.login(): same thing.
Does anyone have a fix for this?
Any help is much appreciated!
Check this:
fb_window_redirect
Override de window.open method. This allows you to know what windows are opened.
Then you can redirect the window opened by the FB SDK.
...
window._open = window.open; // saving original function
//Override the function
window.open = function(url,name,params) {
var new_window = window._open(url,name,params);
if (typeof onWindowOpen === "function") {
onWindowOpen(url, name, params, new_window);
}
return new_window;
};
...
var openedWindows = [];
var fbWindows = [];
function onWindowOpen(url, name, params, new_window) {
...
// Filter the facebook oauth request
if (url.contains('facebook.com')
&& url.contains('oauth')) {
fbWindows.push(new_window);
}
openedWindows.push(new_window);
}
...
//On fb login button pressed callback:
FB.login(function(response) {
//Try login
if(response.authResponse) {
//Login succesful
// Fb window redirect.
// see onWindowOpen
var fbwin = fbWindows[0];
var redirect_url = ''
fbwin.location = redirect_url;
}
},
{scope: 'email,publish_stream,user_birthday'});
...

connect to quickbooks, refresh app

In my app I have the 'Connect To QuickBooks' button that works as it should. When it is clicked it opens a window that allows the user to sigh in to their company. My problem is that I need to refresh my app to show the new information (Company name, etc), but I have not been able to find a way to refresh my app from the OauthHandler.aspx, that is opened in another browser window, by the 'Connect To QuickBooks' call. I must not be understanding something, can anybody help.
Thanks
Use the following in OauthHandler.aspx-
My refreshed page is default.aspx. Please set the page you want for your application.
<script type="text/javascript">
try {
var parentlocation = window.parent.opener.location.hostname;
var currentlocation = window.location.hostname;
if (parentlocation != currentlocation) {
window.location = "/default.aspx";
}
else {
window.opener.location.href = window.opener.location.href;
window.close();
}
}
catch (e) {
window.location = "/default.aspx";
}
</script>

webworks blackberry 10 window.open twitter facebook

i am just trying to implement facebook and twitter in my Webworks App and cannot get them work together.
I am using the FaceBook-OAuth-2 and the Twitter-OAuth-1 sample and i just put both stuff together and my problem is that only the first startOAuth() opens a window in the app to login the second doesn't so if i first clicked facebook it works after when i try twitter nothing happens.
https://github.com/blackberry/BB10-WebWorks-Samples
thanks
function setClickHandlers() {
console.log('set click handlers');
var fb = document.getElementById('facebookOn');
fb.addEventListener('click', function(e) {
// if the childWindow is already open, don't allow user to click the button
if(childWindow !== null) {
return false;
}
e.preventDefault();
toast('Contacting Facebook...');
setTimeout(function() {
startOAuth();
}, 500);
});
console.log('set twitter click handlers');
var tw = document.getElementById('twitterOn');
tw.addEventListener('click', function(e) {
// if the childWindow is already open, don't allow user to click the button
if(childWindow !== null) {
return false;
}
e.preventDefault();
toast('Fetching access token...');
setTimeout(function() {
twittergetAccessToken();
}, 500);
});
}
I would start by adding some debug code in your click handler to see if that's getting called when you click the button in the first place.
If it is, then I recommended you use Web Inspector (console) to see if there are any errors. If there are, they'll show up there.
Good reference for Web Inspector here - http://developer.blackberry.com/html5/documentation/web_inspector_overview_1553586_11.html
If the click handler is not being fired then perhaps you have the wrong element ID, or the setClickHandlers function is not being executed.