Turn on device features
Most device features are off until you add one setting to angular.json. Bluetooth, NFC, the camera, the calendar and the rest each bring native code, and often a permission. The build leaves out every feature you don't turn on, so your app ships only the native code and permissions it uses.
This turns on the barcode scanner, the image picker's camera, Bluetooth and the calendar. Run ng build --platform or ng serve --platform again to get them: a change to these options rebuilds the native app.
There are two kinds of setting:
- A permission reason: a key in
permissions, with the sentence iOS shows when the app asks. See Permissions. - A switch:
true, or an object for a feature with parts. These features ask for no permission, except reading the Wi-Fi network's name, which needs the location.
Every opt-in feature
In this table, permissions.camera means a camera key in permissions, with its reason.
- Some settings turn on two features.
permissions.cameraturns on both the barcode scanner and the image picker's camera. - Picking needs no setting. Every app has
LynxContacts.pick()and the image picker's photo library. - Every other device API is in every app
--platformbuilds, such asLynxHaptics,LynxClipboardandLynxShare. - Three
permissionskeys turn on no feature:photos,notificationsandlocalNetworkonly declare a permission. See Permissions. - Sign in with Apple on Android uses Apple's web flow instead.
<canvas>and WebGL follow your code, with no setting. The build leaves them out of an app that never draws. See What the build includes.
Links and shortcuts
These options let other apps, websites and Siri reach your app, or add your own native code. They turn on no API of their own.
deepLinkSchemes: the router follows each link to its route. On Android, include the callback scheme of a web sign-in.appLinkDomains: iOS needsios.teamIdwith a paid team, and each site serves the file the build writes.canOpenURLSchemes: iOS and Android 11+ say no for any scheme the app doesn't declare.http,https,mailto,telandsmsare always there.shortcuts: each has anid, atitleand Siriphrases.
Without the setting
The build leaves the feature's native code out of both apps. Your code still compiles and runs, but the API can't reach the phone:
- Most calls reject with
unavailable, such asLynxCalendar.addEvent()andLynxBarcodeScanner.scan(). LynxNfcandLynxAppleSignInreject withunsupported.- Status signals read
unsupported:state()for Bluetooth and geolocation,permission()for contacts,addPermission()for the photo library andstatus()for tracking. - Availability checks find nothing.
LynxBiometrics.availability()reportsnone, andLynxMotion.availability()lists no sensors. - Some do nothing.
LynxStoreReview.request()resolves without showing anything, andLynxShareTargetnever receives a share. backgroundAudioleaves nothing out.LynxAudioPlayeris in every app and plays while the app is on the screen; without the setting, it pauses when the app leaves.backgroundLocationandpermissions.locationAlwaysleave out only what they add. Withpermissions.locationalone,LynxGeolocationfinds the phone while the app is in use; a background watch,requestPermission({ always: true })andwatchRegion()reject withunavailable.
Some features bring a library too, which stays out with them. The barcode scanner brings Google Play services' code scanner, storeReview Google Play's review library, and tracking Google Play's advertising ID library.
Leaving code out is on purpose. App Store Connect flags an app whose code uses the camera, the location or Bluetooth without saying why. See Permissions.
Why some need a paid Apple team
Some features need an entitlement: a capability Apple lets an app use only when its signature says so. The build adds each one to the iOS app:
A free Personal Team can't sign them. To run the app on an iPhone, set ios.teamId to a team in the paid Apple Developer Program. Otherwise the build stops and names the option it can't sign.
- The iOS Simulator needs no team. It has no NFC reader, though.
- Or leave the feature out of the configuration you build for that iPhone.
shareTargetadds a Share Extension to the iOS app. It hands each share to the app through an App Group, the capability that needs the paid team.- Android has no entitlements. These features need no paid account there.
Lynx Explorer and the web preview
These settings only change the apps --platform builds, with ng build or ng serve.
Lynx Explorer has none of these features. It isn't your app, so your native code isn't in it. Calls there behave as without the setting. To try a feature on a phone, run ng serve --platform.
The web preview ignores these settings. It uses the browser's own API where there is one:
LynxGeolocationusesnavigator.geolocation.LynxMotionuses the page'sdevicemotionanddeviceorientationevents.LynxAudioRecorderuses the browser'sMediaRecorder.LynxAudioPlayerplays in an<audio>element, withnavigator.mediaSession. It plays in every app,backgroundAudioor not.LynxImagePickerandLynxFilePickeruse an<input type="file">.LynxCalendardownloads an.icsfile, andLynxPhotoLibrarydownloads the file it saves.LynxContacts.pick()uses the Contact Picker API, which only Chrome on Android has.
The others, such as Bluetooth, NFC, Wi-Fi and the barcode scanner, aren't there. Each API page's platform table says what it does in the web preview.
Ejected apps
Ejecting writes the native projects with the features that are on at that moment. After that, these settings stop applying:
- A feature that was on stays, with its permissions, until you take them out of the native projects.
- A feature that was off is missing. Adding it later is a native change, such as Bluetooth in a project ejected without
bluetooth.
