I am using Appery.io app builder and my app is JQM with v5.3 libraires version
I have to js code in click event and run in Android but not in iOS.
I tried this and the same result. Anything argument in window.open run in Andorid but not in IOS (mail, https…).
window.open("tel:+34607507097");
window.location.href = 'tel:+34607507097';
Any suggestions . Thanks
Could I ask you to check if the in-app browser is enabled under App settings > Cordova Plugins and then check out this code:
if (window.cordova) {
cordova.InAppBrowser.open("tel:+34607507097", '_system');
}
Related
Our Ionic 2 mobile app was rejected by apple because of the following reason:
We noticed that the user is taken to Safari to sign in or register for an account, which provides a poor user experience.
Please revise your app to enable users to sign in or register for an account in the app.
The Auth0 Lock provides the user with a sign up button that we configured through the signUpLink option of the Lock. This button opens a registration page in the system browser (Safari) outside of the application, which apparently isn't acceptable for Apple.
Before we upgraded to the latest version of Ionic 2 (Ionic 2 beta 11), the lock would open the link in the InAppBrowser, which is acceptable for Apple. Because of the difference in Ionic 2 version, I imagine this could be an Ionic issue.
I made sure I had the Cordova InAppBrowser plugin installed. It's present in my config.xml as <plugin name="cordova-plugin-inappbrowser" spec="~1.6.1" /> and when I open the .xcproject file in XCode, the plugin is present in the Plugins folder. I have also tested using the InAppBrowser manually using open('https://www.google.com/, '_blank'); which opened the InAppBrowser as it should.
Neither the code regarding the Auth0 Lock, nor the URL to the registration page changed.
Auth0 Lock version: 10.6 (have also tried on 10.11, didn't solve the issue)
Ionic version: 2.1.0
OS: iOS
What could've changed since the Ionic 2 beta 11 that would affect opening the link in the InAppBrowser?
I have come up with a dirty temporary workaround by adding an onclick attribute to the button that opens the link in the window.open function:
this.lock.on('show', () => {
let parent: Element = undefined;
let intervalIndex = 0;
let interval = setInterval(() => {
parent = document.getElementsByClassName('auth0-lock-tabs')[0];
if (parent) {
let item = parent.children.item(1).children.item(0);
item.setAttribute('onclick', `window.open('${AppSettings.registrationUrl}', '_blank'); return false;`);
item.removeAttribute('href');
clearInterval(interval);
}
if (intervalIndex == 20)
clearInterval(interval);
intervalIndex++;
}, 500);
});
With this modification, the sign up link opens in the InAppBrowser and therefore doesn't violate Apple's terms anymore.
Note: this is not a good answer to this problem and is not a guaranteed fix as there is a delay on configuring this onclick attribute on the button.
I'm developing a mobile app both for iOS and Android, I didn't have any issues on android. But in iOS I encountered a problem when using plugins. Plugins I used were cordova-file-transfer and social sharing by EddyVerbruggen. Both plugins worked perfectly when I created my android app, but both got an issue when I did it in iOS. Both plugin only works after I restart the app. Why is that? I tried surrounding the code with $ionicPlatform.ready and device.ready but didn't help. What am I missing?
Here's a sample sequence code:
$scope.myButton = function(){
//I also tried surrounding this with
//document.addEventListener("deviceready", myfunction, false)
$ionicPlatform.ready(function(){
//mycode here that uses the plugin ex. ($cordovaFileTransfer.download)
});
}
I'm going through the docs in React Native and can only find navigating to external links from the app I am in.
I want to be able to navigate to the Settings app (more specifically to the privacy > location services page) but, can not seem to find the necessary information on it. There is the native iOS way of doing it which I am trying to replicate through React Native.
Is this possible?
I have tried the following to detect if there is a Settings URL. The console logs that the Settings url works however, it does not navigate to that page.
Update: thanks to #zvona I am now navigating to the settings page but not sure how to get to a specific deep link.
Linking.canOpenURL('app-settings:').then(supported => {
console.log(`Settings url works`)
Linking.openURL('app-settings:'
}).catch(error => {
console.log(`An error has occured: ${error}`)
})
You can access settings of the application with:
Linking.openURL('app-settings:');
But I don't know (yet) how to open a specific deep-link.
2021 update use:
Linking.openSettings();
otherwise your app will be rejected due use of non-public URL scheme
I successfully opened the settings by the code below, hope it's helpful :)
Linking.canOpenURL('app-settings:').then(supported => {
if (!supported) {
console.log('Can\'t handle settings url');
} else {
return Linking.openURL('app-settings:');
}
}).catch(err => console.error('An error occurred', err));
Reference: https://facebook.github.io/react-native//docs/linking.html
Since React Native version 0.59 this should be possible using openSettings();. This is described in the React Native Linking documentation. Although it did not work for me. When I tried quickly I saw a _reactNative.Linking.openSettings is not a function error message.
Linking.openSettings();
You can deep-link referencing the settings's index like so:
Linking.openURL('app-settings:{index}')
For example Linking.openURL('app-settings:{3}') would open the Bluetooth settings.
Linking.openURL('app-settings:1');
Adding an answer that worked for me and is easy to apply.
openSettings function in #react-native-community/react-native-permissions works for both iOS and Android.
Calling openSettings function will direct the user to the settings page of your app.
import { openSettings } from 'react-native-permissions';
openSettings();
You can import Linking from 'react-native' and then use Linking.openSettings() to trigger the call. This link explains it very concisely:
https://til.hashrocket.com/posts/eyegh79kqs-how-to-open-the-settings-app-in-reactnative-060
For example: to navigate under Settings/Bluetooth you have to use Linking.openURL('App-Prefs:Bluetooth');
For iOS 14 and ReactNative 16.13
You can use the most easiest way to open the app setting from react-native.
just,
import { Linking } from 'react-native';
and user below line anywhere you want open the app setting.
Linking.openSettings();
Old question, but this didn't work for me on Android and I found something that did. Hope this helps anyone looking for the same. :)
https://github.com/lunarmayor/react-native-open-settings
I don't have the ability to test it for iOS though.
Opens the platform specific settings for the given application.
You can handle your case using Linking from react-native. In my case, I accessed the touch id settings on IOS using:-
Linking.openURL('App-Prefs:PASSCODE');
I'm pulling my hair out on this one. I'm using phonegap 3.4 to build an iOS app. When I build the project and run in the simulator, I want to view the output of console.log in the xcode debug window, but it's not working. I've installed the org.apache.cordova.console plugin, but no luck. I see some normal debug output like "Resetting plugins due to page load" but none of my console.logs appear. Any ideas?
And this did not solve my issue: console.log is not working in iOS Phonegap App even after adding the console plugin
try alert();
it is basically the same as console.log();
but you need to install different plugins: org.apache.cordova.dialogs
i dont have iphone nor mac so i can't guarantee it will work on them. But in one android device that i tried, when the console.log() fails. Alert() succeeds.
There are 2 types of alert:
alert('text'); //this is actually javascript
navigator.notification.alert(message, alertCallback, [title], [buttonName]) //this is phonegap function
In my case. i have only need to use the first one.
further documentation on the second alert function is below:
https://cordova.apache.org/docs/en/3.0.0/cordova_notification_notification.md.html#notification.alert
i hope it will work on xcode too.
Make sure you install the console plugin. While Android is able to do this out of the box, logging to console is otherwise not supported on iOS:
https://github.com/apache/cordova-plugin-console/blob/master/doc/index.md
The solution is: call logger.__onDeviceReady function from your deviceready listener function:
function onDeviceReady() {
if (window.cordova.logger) {
window.cordova.logger.__onDeviceReady();
}
}
document.addEventListener('deviceready', onDeviceReady, false);
Try to use "document.write" instead.
I'm using PhoneGap + jQuery Mobile for a new mobile app.
This plugin is used to call native contact view of Android so you don't have to inject contacts in HTML.
https://github.com/phonegap/phonegap-plugins/tree/master/Android/ContactView
I've followed the instructions properly but it doesn't work for me, whenever I try to run (after all the initialization routine) this JS on Android:
window.plugins.contactView.show(
function(contact) {
console.log(contact);
},
function(fail) {
console.log(fail);
}
);
It shows this error:
Error: Status=2 Message=Class not found
Can anyone help?
Note: I haven't used any PhoneGap plugin before.
http://simonmacdonald.blogspot.com/2011/05/installing-childbrowser-plugin-on.html
The issue has been described here in details.