I have a mobile app using angular.js, Twitter Bootstrap, and grunt with a .NET back end. that after login will constantly show the loading spinner up in the top nav next to the time and battery status. We make server calls at login through a factory using a timeout and promise.
login: function (credentials) {
var that = this;
return login(credentials)
.then(function() {
$timeout(function() {
that.getFamily().then(function (family) {
$cookies.familyId = family.id.toString();
Cart.getCart();
});
}, 100);
});
}
var login = function (credentials) {
return $http.post('/family/login', credentials);
};
We aren't using long polling, so all of the solutions to that problem that I've found won't help. It only happens on mobile safari on ios. Nothing on chrome, firefox, etc. in browser or on mobile devices. I've tried setting a datetime stamp on the POST as well as removing various apple meta tags and nothing helped. I've read around and I've seen all over that there are issues with ios6+ caching posts, which could cause the never ending spinner. I've also just read it's an ios bug, so who knows.
Please help!
I have observed the same problem for fullScreen iOS webApp's installed on the homeScreen. I'm sure it's a bug, but I can remove the spinner with a hard reSet or by reStarting the device. After reSet, the webApp runs without problems until the day the device detects some random netWork problem on loading the app. This problem is remembered by your device until it's reSat.
The bug first occured in iOS 6 but unfortunately not solved on iOS 7.
Related
So I have a redirect working, but it's a little janky & I'm hoping to make it less janky :)
I'm using deep linking to basically open the app only....nothing beyond that at the moment.
Below is the redirect for ios. It works ok, but it's throwing a URL error in safari that I have to tap to close before it will redirect to the app store. (This is the case of a user not having the app installed)
So...I know universal linking is what iOS9 is doing, but I'm trying to avoid implementing too much on the native code side. All I've done is add my custom URL scheme to the plist of the app.
So wise internet...is there a better way?
else if(isMobile.iOS())
{
window.onload = function() {
window.location = 'vrbhome://';
setTimeout("window.location = 'https://itunes.apple.com/us/app/vrb/id1066438072?ls=1&mt=8';", 1000);
}
}
else {
document.location.href="http://vrb.is";
}
This error is by (Apple's) design — the only way to work around it is to decrease the timeout enough that the user goes to the App Store before they have a chance to see the error. Unfortunately as of iOS 9.2, users with your app will also be redirected before they have a chance open the app. Universal Links are the solution Apple wishes you to use.
If you don't want to handle too much native code, you could try https://branch.io
I am using the the Cordova Push Plugin: http://ngcordova.com/docs/plugins/pushNotifications/
This works fine in Android Platform. But, for IOS, I face the following issue:
I register listener for '$cordovaPush:notificationReceived' event as per the documentation and provide the same implementation as given in the documentation in the link above (given below for ease):
$rootScope.$on('$cordovaPush:notificationReceived', function(event, notification) {
if (notification.alert) {
navigator.notification.alert(notification.alert);
}
if (notification.sound) {
var snd = new Media(event.sound);
snd.play();
}
if (notification.badge) {
$cordovaPush.setBadgeNumber(notification.badge).then(function(result) {
// Success!
}, function(err) {
// An error occurred. Show a message to the user
});
}
});
There are 3 scenarios:
1. App is running in foreground. In such case, even though the notification arrives (confirmed by log statements), no visible action happens on the device.
I expected the below two statements to execute but they dont.
navigator.notification.alert(notification.alert);
snd.play();
App is running in background. In such case, the statements seem to execute as per expected behaviour.
App is NOT running at all (coldstart). In this case, the notification and sound are played but when user click on notification, the app opens and hangs / crashes.
Has anyone encountered these problems before? What is the best way to solve these? This is only for IOS.
The plugin you are using is deprecated.
i also used it before and there are many issues.
i would reccomend to use the plugin: phonegap-plugin-push
easy to install and will solve your issue
As mentioned by #Nechemya Kanelsky, use the newer version of the push plugin and scenario 1 and 2 will be handled. But with that plugin as well, the 3rd issue still remains, as mentioned here
You can use the fix for 3rd issue, mentioned here
So I'm looking to launch a mobile app when a web page is landed on. I've seen this done and all is great there (see code below with Facebook and Pandora as an example). But I'm looking for a logic check to route the user one way or the other depending upon the successful or unsuccessful launch of the app. It was said in a previous solution that you cannot use a link to check the user's mobile device to see if an app is installed, but I keep thinking that there might be a way to see if the user's app was successfully launched after-the-fact and route them based on that.
Using the code below, if the app is launched, the web page falls away, if you will (disappears into the background while the app takes center stage). If, however, the app isn't installed on the mobile device, then the web page stays up and you get an error (can't recall off-hand which error). But it seems to me that receipt of this error should be able to trigger a re-routing to a specific URL of your choice. Not at the server-level, but at the code-level. In other words... if the app launches, then grats... enjoy! But if the page loads with an error, then it redirects instantly to say, the app download page on Apple or Google (depending upon the OS detected).
Does anyone have a suggestion as to how to make this happen? Essentially one piece of code that is looking for the trigger error and reacting to that as a way to A) launch the app from a page load (link) B) open the app store in a browser to download the app if the app wasn't successfully launched.
This is my first foray into Stack, but I have found the community very helpful over the years.
<script type="text/javascript"> // <![CDATA[
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
if ( isMobile.Android() ) {
document.location.href = "fb://profile";
}
else if(isMobile.iOS())
{
document.location.href="pandora://";
}
</script>
What you're talking about is called Deferred Deep Linking in terms of App Links. If you were coding an app that wanted to utilize this, there are iOS guides and Android ones. Overall, there doesn't seem to be a standard implementation for all scenarios, however, there is a pretty simple "roll-your-own" implementation that is similar to what you're attempting.
(from another SO answer)
<script type="text/javascript">
window.onload = function() {
// Deep link to your app goes here
document.getElementById("l").src = "my_app://";
setTimeout(function() {
// Link to the App Store should go here -- only fires if deep link fails
window.location = "https://itunes.apple.com/us/app/my.app/id123456789?ls=1&mt=8";
}, 500);
};
</script>
<iframe id="l" width="1" height="1" style="visibility:hidden"></iframe>
As a commentor said above, use an iframe so you can keep processing code even if your window.location fails. Then, set up a simple setTimeout with a reasonable fallback time. You don't need to catch any error messages or response headers. If the app didn't launch, then a website will.
Just thought to add, since you want A) Launch App from link and upon failure B) Go to store to download the app.
A Cross-Platform solution you can use rather than rolling your own as an alternative, I'd suggest trying Firebase Dynamic Links (works on both Android and iOS) and its free.
It also has the benefit of providing your app the link information, like if you put in the link an article ID (from your news website example), then the app can load up that article upon launch, and it persists even if the user has to install the app from the store, when launched it will open to that article you specified in the link.
In addition, Dynamic Links work across app installs: if a user opens a Dynamic Link on iOS or Android and doesn't have your app installed, the user can be prompted to install it; then, after installation, your app starts and can access the link.
https://firebase.google.com/docs/dynamic-links
With very little code you can add the ability for a user to click a link on your mobile web and be taken to the corresponding page in your app, even if they have to go to the App Store or Google Play Store to install it first!
https://firebase.google.com/docs/dynamic-links/use-cases/web-to-app
We use gapi.js for Google authorising.
It works correct on majority of desktop browsers and on mobile Safari.
But it doesn't on Mobile Chrome IOS(41.0.2272.58).
In the begging we load gapi.js script
require(['https://apis.google.com/js/client.js?onload=gapiIsLoaded'];
Then we try authorize using:
gapi.auth.authorize(params, handler);
Params are
var params = {
client_id: MY_CLIENT_ID,
scope: MY_SCOPES,
immediate: false // to open popup
};
Browsers shows popup and I can autorize and continue work.
IOS Safari works correct too.
But Chrome IOS never calls handler callback.
This issue extends to Chrome for Android 5.0. In my case, downgrading to 39.0.2171.59 resolves the problem. Hopefully this information puts you closer to finding the root cause.
Issue was resolve by adding redirect ur instead of window open https://github.com/google/google-api-javascript-client/issues/189
I've seen some other posts about iOS 6's new behaviors with Web sites saved to / launched from the home screen. On iOS 5 (and earlier), we were able to use the Javascript History function for our in-app back button. In iOS 6, however, it works if you've only been to one page in the site. But if you have more than one page that you've visited, it throws a page-not-found error. It works fine in Safari (not from the homescreen), and it works if I remove the <meta name="apple-mobile-web-app-capable" content="yes" /> tag. But then I get the ugly browser chrome that I'm trying to avoid.
I've seen similar posts about the changes to iOS 6 no longer sharing data with Safari, but I was hoping someone had run into a similar issue with the history information being stored / used for the homescreen version of the apps in iOS 6.
We're using this call:
Again, it's working fine from Safari, fine in all of the old operating systems. But it fails on iOS 6 from the homescreen when there are more than two pages that the user has clicked on.
My understanding is that if you add the apple-mobile-web-app-capable tag - it caches the page that is bookmarked to the home screen.
Any subsequent requests once the bookmark is launched will cause the safari browser to launch the url (with ugly chrome added).
You could do some basic error checking - if there is any history:
function GoBack() {
if(history.length) {
history.back();
return false;
}
return true; //follow the regular link
}
And you really should be giving your urls a proper href value instead:
Have your tried
onclick="history.go(-1)"
This simple command should work.
Try one of them
window.history.pushState
http://thelink.is/history-api-ios-bug
OR
window.history.pushState(data, title, 'a/new/url#');
OR
window.history.pushState(data, title, 'a/new/url');
window.location.hash = 'new';