I am working on the hybrid app
For Paytm integration, I used the in-app browser method
var browser = this.iab.create('http://url?ORDER_ID='+result.orderid+'&CUST_ID='+this.cust_id+'&TXN_AMOUNT='+result.total,'_blank','location=no,hardwareback=no,zoom=yes');
browser.on('loadstop').subscribe((event) => {
if (event.url.match("returnprocess.php")) {
setTimeout(function(){
browser.close();
let loader = this.loadingCtrl.create({
content: 'Back to order, wait a minutes'
})
loader.present();
loader.dismiss();
}, 5000);
//then push to next page
The above code is working fine on Android device. But in IOS device it is not returned to APP.
I googled a lot. But I couldn't find the right solution. Please help me. Thanks
Related
After first app launch/install the app triggers a Firebase dynamic link and opens the browser with this url:
...mypage.page.link//google/link/?request_ip_version=ip_version_here&match_message=No%20pre%2Dinstall%20link%20matched%20for%20this%20device%2E
I'm handling the dynamic links in the app using:
... dynamicLinks().getInitialLink().then((link) => {
handleDynamicLink(link);
});
and
const unsubscribe = dynamicLinks().onLink(handleDynamicLink);
and
Linking.addEventListener("url", (url) => {
// Logic here
});
But the browser opening seems to happen before any of those are triggered. Do I have to do anything in the native iOS code to handle this before to continue initializing the app instead of triggering the browser to open?
Thanks a lot!
I'm using Phonegap Cordova and have an iOS app and web app that sync information to each other, the problem I'm having though is that if the user has the iOS open on their device, but minimized, the data doesn't update realtime. So if they add something on the web app and look at the iOS app the changes wouldn't have been made on the iOS side so they'd have to close the app and relaunch. This isn't very user friendly.
Would anyone have any advice how to fix this? Perhaps refresh the app every time they open, or scroll up to refresh manually?
Any help would be great! Thank you.
use this plugin :
cordova-plugin-background
and in index use this code for refrech the app
document.addEventListener('deviceready', function () {
cordova.plugins.backgroundMode.enable();
cordova.plugins.backgroundMode.onactivate = function () {
setInterval(function () {
location.reload();
}, 10000);
}
}, false);
you app it' well refrech in backround every 10000 second you can change the time
You definitely have a few options here:
You can use Cordova's resume event which should fire when the user brings the app back to the foreground (at least I think that's what it does, I haven't used that event myself)
If it applies to your use case, you could use the push plugin to push data to your device and trigger updates
A manual slide down to refresh would also be good, maybe even on top of the options above
I've just started testing Firebase for website push notifications. The basic code seems to work perfectly well on many Android-based browsers (Chrome, Firefox...) apps but not those installed on iOS such Chrome on my iPad or iPhone. I couldn't find any information related to this issue. Am I missing something?
firebase.initializeApp(config);
const messaging = firebase.messaging();
messaging.requestPermission()
.then(function () {
console.log('Notification permission granted.');
// TODO(developer): Retrieve an Instance ID token for use with FCM.
// ...
})
.catch(function (err) {
console.log('Unable to get permission to notify.', err);
});
Chrome on iOS is built on top of the same basic web view as Safari. Since that underlying component doesn't support Web Push, FCM push notifications cannot be delivered to Chrome on iOS.
For future reference, if you get a blank page on your website on iOS browsers.
just wrap your server worker in an if statement by checking if FCM is supported in that browser firebase.messaging.isSupported()
if (firebase.messaging.isSupported()) {
firebase.initializeApp({
'messagingSenderId': 'your code here'
});
...
}
I am really struggling to add push notification support to my Ionic application. My current issue is related to the documentation, which states that I need to add a cordova push plugin (which I have) and then to add the following event handler:
this.push.on('notification', function (data) {
// do something with the push data
// then call finish to let the OS know we are done
push.finish(function () {
console.log("processing of push data is finished");
}, function () {
console.log("something went wrong with push.finish for ID = " + data.additionalData.notId)
}, data.additionalData.notId);
});
However, I am getting an on property not found the error. How do I fix this issue?
That's correct. The browser outputs that this.push.on is not a function. Probably has to do with the browser not supporting Push and it's native capabilities.
However, using it in your mobile applicationw ill work just fine. If you want to make the error go away because it is confusing you could check on which OS the user currently is or check if he has cordova.
This can be done by wrapping your push.on in a if(this.platform.is('cordova')){} or if(platform.is('cordova')) (not sure about the this.) Source: How to detect if I am in browser (local development) in Ionic 2
I already know how to launch an app from safari, but is it possible to check if the app is installed before launching? I'm thinking to launch the app store if the app isn't currently installed on the iPhone.
It's not possible to check if app is installed from a web page. You could do it inside an other app by checking if your url scheme can be opened using UIApplication's -canOpenURL: method, but there is no javascript equivalent to this.
However, you can use the following workaround:
<script language="javascript">
function open_appstore() {
window.location='http://itunes.com/';
}
function try_to_open_app() {
setTimeout('open_appstore()', 300);
}
</script>
<a onClick="javascript:try_to_open_app();" href="yourappurl:">App name</a>
This code will set a timeout on the link that will call the open_appstore function if this timeout ends. Since your link is pointed at the app's custom url, Safari will try to open that link and if it can, it will open the app and stop the timer, so AppStore link will not be opened.
If the app link can't be opened, when timer runs out it will display an error popup saying it can't open the page (can't get rid of that), but it will immediately go to AppStore and dismiss that error.
iOS 9 adds a really nice feature that lets your app open a http/s url: Universal Links
In iOS 10 there is a popup saying "Open in [App Name]" when you tap the link and the app is installed. If the user does not tap on "Open" in the given timeout, this solution will use the fallback.
As 300ms is too short to tap anything, this solution always fails on iOS 10.
This worked for me with a similar situation: wherein I wanted to open gmaps app if it was supported - otherwise go to gmap site directly.
function mapLink(addy) {
addy = encodeURIComponent(addy);
var fallback = 'http://maps.google.com/?q=' + addy
, link = 'comgooglemaps://?q=' + addy;
try {
document.location = link;
} catch(err) {
document.location = fallback;
}
}
Seems to work pretty well for my use case.
Update:
If you want to do a new window on fallback, this still allowed the ios error message to pop up. To get around it try this.
try {
document.location = link;
} catch(err) {
window.location.reload(true);
window.open(fallback, '_blank');
}
The Solution from Apple:
From Apple Documentation
https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/PromotingAppswithAppBanners/PromotingAppswithAppBanners.html
If the app is already installed on a user's device, the banner intelligently changes its action, and tapping the banner will simply open the app. If the user doesn’t have your app on his device, tapping on the banner will take him to the app’s entry in the App Store. When he returns to your website, a progress bar appears in the banner, indicating how much longer the download will take to complete. When the app finishes downloading, the View button changes to an Open button, and tapping the banner will open the app while preserving the user’s context from your website.
Smart App Banners automatically determine whether the app is supported on the user’s device. If the device loading the banner does not support your app, or if your app is not available in the user's location, the banner will not display.
To add a Smart App Banner to our webpage, include the following meta tag in the head of each page where you’d like the banner to appear:
NOTE: We can also pass the app-argument: like myName,etc.,
Check that Providing Navigational Context to Your App Header in this Page
Updates:
1. Once you have closed the banner that showing up, then that will not be displayed again even though you had that meta tag in our html.
2. To reset that launch the settings App then navigate to General>Resent>Reset all settings
You can simply read the return value from the method -(BOOL)openURL:(NSURL)url*, if it's NO, it means that the target application isn't installed. Following code snipped gives an example using the navigon url scheme:
NSString *stringURL = #"navigon://coordinate/NaviCard/19.084443/47.573305";
NSURL *url = [NSURL URLWithString:stringURL];
if([[UIApplication sharedApplication] openURL:url]) {
NSLog(#"Well done!");
} else {
stringURL = #"https://itunes.apple.com/it/app/id320279293?mt=8";
url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
}
Thanks to zszen for the correction.