How to link to phone settings from react native app - ios

I'm creating an react-native app and I want to show and warning to user if their IOS version is < 11.0.
That works fine. I have something as follows:
What I want is to go the phone settings if they click on Go to settings.
The code for that is as follows:
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));
Thus I try to do it with Linking.openURL('app-settings:'). But the problem is that that goes to the settings of my app, but I want to go to the settings index page or even better to system upgrade setting.
I need it only for IOS.
Any idea how can I do that?

You can no longer do that. You could use the URL App-Prefs:, which does what you want, but that will cause your app to be rejected upon review, because it's considered non-public URL scheme.
The only URL allowed by Apple is the constant UIApplicationOpenSettingsURLString, which takes you to your app's setting, not general settings of the device.

Related

Ionic 4 IOS deeplinks redirect to broswer instead of the actual app

i am trying to set up deeplinks for my ionic 4 ios app, i followed these steps to accomplish the given task:
i uploaded an apple site association file to the web version of the app, i used the actual bundle id and app id prefix from Certificates, Identifiers & Profiles page on apple.com
i verified the website url using https://branch.io/resources/aasa-validator, i got 5/5 green results
i also enabled associated domains in both xcode and on apple.com dev space for the application
inside the code in the app components i used the following code :
const subDeepLinks = this.deeplinks.route({
'/verify/:code': VerifyPage,
'/reset-password/:token': ResetPasswordPage,
}).subscribe((match: any) => {
this.zone.run(() => this.router.navigate([match.$link.path]));
}
});
And here is the list of the deeplink variables from package.json
"ionic-plugin-deeplinks": {
"URL_SCHEME": "<my-domain-name>",
"DEEPLINK_SCHEME": "https",
"DEEPLINK_HOST": "<my-domain-name>"
}
I test this using iPhone simulator, i created a contact with a url that is supposed to lead to the app. But when i click on it i get redirected to the web version of the app.
Any help is appreciated, thanks!
well, it turned out aasa worked. i used my gf's iphone installed the app and checked. so nevermind

Firebase dynamic link: deeplink always empty

I am developing an app in ionic 3 for android and ios platform. For deeplinking, I am using cordova firebase dynamic link plugin.
This is working fine for android platform. But in the ios platform, though it is not throwing any error, it is not working.
My current ionic code.
this.platform.ready()
.then(() => {
return this.firebaseDynamicLinks.onDynamicLink();
}).then((dynamicLink:any) => {
console.log(dynamicLink); // always gives {matchType: "weak", deepLink:""} in ios
}).catch((error: any) => {
console.log(error);
});
The android part working fine. But in ios, the deeplink is always coming as empty.
my manually created dynamic url
https://xxxx.app.goo.gl/?link=<encoded url to mysite>&apn=<android bundle id>&ibi=<ios bundle id>
The provided link is returning HTTP 200 status when opening in the browser.
Testing steps (in ios):
In my iphone (ios9) I have placed this dynamic link in notepad
Then by clicking on the dynamic link the app opens.
In the console, I get
{matchType: "weak", deepLink:""}

Apple Watch screen stays blank telerik

I use Telerik-AppleWatch plugin for cordova.
i followed the instructions and i copied the simplified example from the project.
when i run the project the Built successfully but on the iwatch i see just the name of the app and blank screen.
I didn't receive error on the console.
i use xcode. target is- 8.2
There is not much information on the internet about it
function initAppleWatch() {
applewatch.init(function () {
alert("init");
onAppRequestsUpdate();
onGlanceRequestsUpdate();
});
applewatch.callback.onLoadAppMainRequest = onAppRequestsUpdate;
applewatch.callback.onLoadGlanceRequest = onGlanceRequestsUpdate;
}
can anybody know what can i do?
I work on it all week without success
thanks!:)

Is it possible to have Fabric and AppStore builds at the same time?

I have an app for iPhone and always sending a testing builds to client. At the same time I have an App Store version of this app. Client wants to have beta and stable app version on device at the same time. Is it possible to do without creating a new app with another bundle id?
You can only have on app on your device with the same BundleID.
If you want both the appstore version and a test version you will need to create a new BundleID for this test version.
I suspect you could do this using separate IDs for the debug and built app and using multiple schemes to share the code base between them.
Check out this article that will help
http://nilsou.com/blog/2013/07/29/how-to-have-two-versions-of-the-same-app-on-your-device/
--Edit--
Just noticed you specifically don't want different bundles due to Push Notifications. We got around this by letting our back end services know which app we were using, and targeting the different services based on which app they use. You can do this by defining preprocessor macros like this: Add preprocessor macro to a target in xcode 6
... then reference them just before you call your back end service to register your device like this...
#ifdef ENTERPRISE
env = GLOBAL_PushNotificationEnvironmentEnt;
#endif
#ifdef DEBUG
// In debug mode, the environment should be set to Development
env = GLOBAL_PushNotificationEnvironmentDev;
#endif
if (notificationsOnBool) {
[service RegisterPushNotificationTarget:self
TargetType:GLOBAL_PushNotificationTargetType
TargetToken:deviceID
DeviceName:[UIDevice currentDevice].name
EnvironmentType:env];
}
... then in your back end code you do something like this (psuedo-code)
if (device.env == Fabric) {
sendNotification(fabricService);
} else {
sendNotification(prodService);
}

Open Settings App from another App in iOS - React Native

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');

Resources