Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

expo-sensors-interface

expo858MIT3.0.0

An interface for expo-sensors.

react-native, expo, sensors, accelerometer, devicemotion, gyroscope, magnetometer, pedometer, barometer

readme

expo-sensors-interface

An interface for expo-sensors.

Installation

This package is pre-installed in managed Expo projects. You may skip the rest of the installation guide if this applies to you.

For bare React Native projects, you must ensure that you have installed and configured the @unimodules/core package before continuing.

Add the package to your npm dependencies

npm install expo-sensors-interface

Configure for iOS

Add the dependency to your Podfile and then run pod install.

pod 'EXSensorsInterface', path: '../node_modules/expo-sensors-interface/ios'

Configure for Android

  1. Append the following lines to android/settings.gradle:
include ':expo-sensors-interface'
project(':expo-sensors-interface').projectDir = new File(rootProject.projectDir, '../node_modules/expo-sensors-interface/android')
  1. Insert the following lines inside the dependencies block in android/app/build.gradle:
    api project(':expo-sensors-interface')

Contributing

Contributions are very welcome! Please refer to guidelines described in the contributing guide.

changelog

Changelog

This is the log of notable changes to the Expo client that are developer-facing.

master

🛠 Breaking changes

  • deprecated Expo.Util by @EvanBacon (#3539). You should use Expo.Updates & Expo.Localization instead.
  • removed use of expolib_v1.okhttp in favor of regular okhttp dependency by @Szymon20000 (#3539) (an update to MainApplication.getOkHttpBuilder may be required when upgrading)
  • corrected behavior of splash screen image based on resizeMode in Android standalone apps (contain and cover were handled contrary to what docs state) by @bbarthec (#3029)
  • Speech.speak changed option name from voiceIOS to voice. @Szymon20000 (#3423)
  • renamed Haptic to Haptics and deprecated Haptics.{notification, impact, selection} in favour of Haptics.{notificationAsync, impactAsync, selectionAsync} @bbarthec (#3330)
  • ImageManipulator.manipulateAsync is now accepting ImageManipulator.FlipType.{Vertical, Horizontal} as flipping action parameter and ImageManipulator.SaveFormat.{JPEG, PNG} as saving option @bbarthec (#3245)
  • removed devKernel and prodKernel build flavors from Android ExpoKit projects (all Gradle commands become simply [verb](Debug|Release), e.g. installDebug or assembleRelease) by @esamelson (#3386)
  • renamed IntentLauncherAndroid to IntentLauncher and changed signature of startActivityAsync method by @tsapeta (#3427)

🎉 New features

  • BarCodeScanner is now returning barcode's bounding box @Szymon20000 (#2904)
  • added method Speech.getAvailableVoicesAsync() @Szymon20000 (#3423)
  • added BackgroundFetch support for Android by @tsapeta (#3281)
  • added support for overriding MIME type in IntentLauncherAndroid.startActivityAsync for Android by @rhunt4675 (#3300)
  • added Location.enableNetworkProviderAsync method to ask the user to turn on high accuracy location services by @tsapeta (#3273)
  • upgraded Facebook Audience Network SDK dependency to 5.1.1 by @sjchmiela (#3394)
  • upgraded Facebook Core- and LoginKit dependency to 4.40.0 by @sjchmiela (#3394)
  • upgrade react-native-maps to 0.23.0 by @sjchmiela (#3389)

🐛 Bug fixes

  • fixed several issues related to expo-av by @Szymon20000 (#3539)
  • Location.getCurrentPositionAsync and Location.watchPositionAsync are now automatically asking for high accuracy location services by @tsapeta (#3273)
  • fix Location.getCurrentPositionAsync hanging on simultaneous calls by @tsapeta (#3273)
  • fix ImagePicker.launchImageLibraryAsync and ImageManipulator.manipulateAsync in SDKs lower than 32 @bbarthec (#3159)
  • fix app crash when attempting to console.log(Object.create(null)) by @juangl (#3143)
  • GoogleSignInOptions.offlineAccess is now corrected GoogleSignInOptions.isOfflineEnabled

32.0.0

🛠 Breaking changes

  • deprecated import { Font } from 'expo-font' in favor of individually named exports (import * as Font from expo-font) for better dead-export elimination potential. Upgrade @expo/vector-icons if you get a warning about this. By @ide (264c17cd)
  • removed deprecated internal Expo modules (Crypto, Fabric, and ImageCropper), which were never part of the Expo API by @ide (#2880)
  • removed deprecated Expo.Fingerprint API, which has been renamed to Expo.LocalAuthentication to reflect other forms of authentication (ex: FaceID) by @ide (24e94d5)
  • removed deprecated default export from the expo package. Instead of import Expo from 'expo', write import { A, B, C } from 'expo' or import * as Expo from 'expo'. By @ide (#2865)
  • removed deprecated support for passing an array into Font.loadAsync. This feature displayed a deprecation warning for several SDK versions so if you didn't see it, this change shouldn't affect you.
  • deprecated enableHighAccuracy option in Location module in favor of accuracy which gives much more options by @tsapeta (#2338)
  • removed support for deprecated onBarCodeRead prop on Camera component by @Szymon20000 (#2820) (use onBarCodeScanned property)
  • updated underlying Stripe dependency to 8.1.0 on Android and 13.2.0 on iOS and updated expo-payments-stripe with latest updates to tipsi-stripe (up to 6.1.2) by @sjchmiela (#2766). This change dropped support for Bitcoin payments in SDK31.
  • removed READ_SMS use of permission on Android, SMS.sendSMSAsync will now always resolve with { result: 'unknown' } by @esamelson (#2982)
  • upgraded Android build tools — Gradle to 4.10.2, Gradle plugin to 3.2.1 by @sjchmiela (7292c27, d0c8b8d)
  • removed run.sh script from android directory in favor of fastlane android start command by @nicknovitski (9301e95)
  • removed minSdk application flavor from Android project (all Gradle commands in format [verb][minSdkFlavor]minSdk[remoteKernelFlavor]Kernel[buildType], eg. assembleDevMinSdkDevKernelDebug become [verb][remoteKernelFlavor]Kernel[buildType], eg. assembleDevKernelDebug) by @sjchmiela (3b5e158)
  • calling Haptic methods on Android will now raise an error instead of a warning by @EvanBacon (#2787)

🎉 New features

  • added locales on Android ([ar, cs, de, es-rGT, fr, he, jt, ja, ko, nb, nl, pl, pt-rBR, ru-rRU, vi, zh, zh-rCN, zh-rTW]) in ImagePicker.{launchImageLibraryAsync, launchCameraAsync} when using { allowsEditing: true } option by @bbarthec (#2955)
  • added support for passing refs created by React.createRef to takeSnapshotAsync by @sjchmiela (#2771)
  • upgraded Gradle plugin (to 3.2.1) and its wrapper (to 4.10.2) by @sjchmiela (#2716)
  • added new TaskManager module that paves the way to background code execution by @tsapeta (#2338)
  • added API for background location updates by @tsapeta (#2338)
  • added geofencing to Location module by @tsapeta (#2338)
  • added new BackgroundFetch module (iOS only) by @tsapeta (#2338)
  • allowed Expo Jest preset to use TypeScript files by @dalcib (#2810)
  • allowed selecting voice used by Speech on iOS by @pyankoff (#2833)
  • removed obsolete assets from standalone apps by @sjchmiela (#2850)
  • added support for notifications categories by @Szymon20000 and @sjchmiela (#2316, #2557)
  • upgraded libraries: react-native-gesture-handler to 1.0.12, react-native-screens to 1.0.0-alpha.22, react-native-reanimated to 1.0.0-alpha.11 by @tsapeta and @sjchmiela (#2977, #3078, #3172, #3232)

🐛 Bug fixes

  • fixed problem with rerendering SVG (updated react-native-svg to 8.0.10) by @Szymon20000 (#3019)
  • fixed wrong type casting in SQLite result @Szymon20000 (#3005)
  • fixed sending multiple consecutive SMS messages on iOS @bbarthec (#2939)
  • fixed GLView initialization with texture of size 0 on Android by @bbarthec (#2907)
  • fixed app cache size blowing up when using ImagePicker by @sjchmiela (#2750)
  • fixed compression in ImagePicker by @Szymon20000 (#2746)
  • fixed FileSystem forbidding access to external directories by @Szymon20000 (#2748, #2808)
  • upgraded Facebook SDK dependency to 4.39 by @Szymon20000 and @sjchmiela (#2710, #3243)
  • fixed object not beign decycled when sending logs to remote console by @sjchmiela (#2598)
  • unified linear gradient behavior across platforms by @sjchmiela (#2624)
  • fixed device orientation not being used when recording videos by @flippinjoe (expo-camera#2)
  • fixed handling quality option passed to Camera.takePictureAsync on Android properly by @Szymon20000 (#2692)
  • fixed resumable downloads on iOS by base64-encoding resumeData by @Szymon20000 (#2698)
  • fixed Permissions.LOCATION issue that wouldn't allow asking for it in a multi-permission call by @sjchmiela (304fe560)
  • fixed onActivityResult not being called on listeners registered to ReactContext by @sjchmiela (#2768)
  • fixed fatal exception being thrown sometimes on Android when detecting barcodes by @sjchmiela (#2772)
  • fixed GLView.takeSnapshotAsync crashing on Android if framebuffer option is specified by @tsapeta (#2888)
  • fixed onPlaybackStatusUpdate not being called with didJustFinish: true when playing with looping enabled on Android by @sjchmiela (#2923)
  • fixed bundle building/downloading progress indicator not showing in ejected apps by @sjchmiela (#2951, #2954)
  • fixed subscription.remove() not calling native stopObserving() for universal modules by @ide (#2897)
  • fixed calendar ID being returned as integer instead of a string on Android (when calling eg. Calendar.createCalendarAsync) by @Szymon20000 (#3004)
  • fixed wrong fling direction for inverted ScrollViews on Android by @mandrigin (pulled in from React Native facebook/react-native@b971c5b)
  • fixed snapping Android ScrollViews with pagingEnabled by @olegbl (pulled in from React Native facebook/react-native@0869e54)
  • fixed Contacts failing to add and remove contacts on Android by @tsapeta (#3017)
  • fixed Permissions.CONTACTS not asking for Android's WRITE_CONTACTS permission by @tsapeta (#3017)

31.0.6

  • fixed expo-cli wrapper failing on Windows by @fson (#2853)

31.0.5

31.0.4

31.0.3

31.0.2

  • pass undefined through for startPoint and endPoint rather than null in LinearGradient by @brentvatne (643969)
  • remove require cycle in AV by @ide (18d54da)

31.0.1

  • filter out warnings about require cycles in node_modules by @ide (68d130d)

31.0.0 (Partial Changelog)

🛠 Breaking changes

  • The default export from the expo package is deprecated in favor of named exports to pave the way for static analysis tools by @ide (#2387)
  • remove default user_friends permission when authenticating with Facebook module by @EvanBacon (2ad86fad)
  • dropped iOS 9 support by @Szymon20000 (#2324)
  • upgrade react-native-svg to 8.0.8 by @sjchmiela and @esamelson (#2492)
  • upgrade React Native to v0.57.1 by @ide (series of commits, eg. 250589)
  • change translation field to adTranslation in an ad object returned by FacebookAds.NativeAdView by @ide (ece59aa)
  • refreshed, bug-free Localization API by @EvanBacon (#2327)
  • drop Android 4.4 support by @bbarthec (#2367)
  • upgrade underyling Facebook SDK native dependencies to 4.37.0 by @sjchmiela (#2508)
  • upgrade react-native-view-shot to 2.5.0 by @sjchmiela (#2518)
  • upgrade react-native-maps to 0.22.1 by @tsapeta and @sjchmiela (#2496, #2680)
  • FacebookAds.TriggerableView is now FacebookAds.AdTriggerView
  • FacebookAds.MediaView is now FacebookAds.AdMediaView
  • The Speech API’s "onError" function is passed an Error instead of a string
  • Flow types have been removed as we begin to migrate to TypeScript over the next few SDK releases
  • Several Haptic enum types have been renamed: NotificationTypes → NotificationFeedbackType, ImpactStyles → ImpactFeedbackStyle
  • Several AR enum types have been renamed: BlendShapes → BlendShape, FaceAnchorProps → FaceAnchorProp, PlaneDetectionTypes → PlaneDetection, WorldAlignmentTypes → WorldAlignment, EventTypes → EventType, AnchorTypes → AnchorType, AnchorEventTypes → AnchorEventType, FrameAttributes → FrameAttribute, TrackingStates → TrackingState, TrackingStateReasons → TrackingStateReason, TrackingConfigurations → TrackingConfiguration
  • Audio.Sound.create has been renamed to createAsync

🎉 New features

  • return permitted/declined permissions arrays when authenticating with Facebook module by @EvanBacon (2ad86fad)
  • Base64 encoding support for FileSystem by @EvanBacon (#2328)
  • video stabilization support in Camera by @n8 (#2241)
  • add support for asking for an authorization to always access location data by @sjchmiela (#2343)
  • upgrade react-native-gesture-handler to 1.0.8, react-native-reanimated to 1.0.0-alpha.10, react-native-screens to 1.0.0-alpha.15 by @brentvatne (eb2a463, 9bf1754)
  • add Segment.{get,set}EnabledAsync feature by @sjchmiela (#2412)
  • add an Android-only timeout option to Location.getCurrentPositionAsync by @bbarthec (#2369)
  • add support for providing custom headers to send when requesting media source by @sjchmiela (#2431)
  • add Segment.alias support by @sjchmiela (#2440)
  • upgrade Android JSC to r224109 by @esamelson and @Kmakinator (#2437)
  • add LocalAuthentication.supportedAuthenticationTypes method by @bbarthec (#2450)
  • add support for new Apple devices to Constants by @tsapeta (#2410)

🐛 Bug fixes

  • fix react-native-svg toDataURL() method throwing error (undefined is not an object (evaluating 'RNSVGSvgViewManager.toDataURL')) on Android by @sjchmiela (#2492)
  • fix nested traits and properties being stringified on Android in the Segment module, instead of being reported as objects by @sjchmiela (expo-analytics-segment#2, #2517)
  • handle specified behavior on Android when authenticating with Facebook by @EvanBacon (2ad86fad)
  • fix MediaLibrary returning stale assets from getAssetsAsync by @Aasfga (#2106, 09cba8d)
  • fix Pedometer.watchStepCount erroring on Android by @Szymon20000 (#2147, dea2967)
  • fix Branch links not working when first opened on iOS by @AdamPD (#2158)
  • asking for Permissions.BRIGHTNESS no longer throws AbstractMethodError exception on some Android devices by @bbarthec (#2342)
  • properly handle some screen orientation configurations (on iPhone X PortraitUpsideDown is not supported) by changing sync ScreenOrientation.allow method to async ScreenOrientation.allowAsync throwing an error when trying to set an unsupported screen orientation configuration by @bbarthec (af2d7e3)
  • fix Linking.getInitialURL returning a customschemed:// URL instead of the one that really redirected to the application by @schneidmaster (#2352)
  • fix FaceDetector settings not being applied on the first run by @sjchmiela (#2308)
  • update cameraview AAR for it to contain getCameraId() method by @sjchmiela (expo-camera#4, #2323)
  • fix rerendering of ads provided by FacebookAds module by @ide (85f2014)
  • fix a fatal exception being thrown when pausing a resumable download on iOS 12 by @sjchmiela (#2404)
  • fix universal modules being initialized twice by @sjchmiela (#2417)
  • fix media players refusing to redirect from a HTTPS URL to another HTTPS URL on Android by @sjchmiela (#2403)
  • fix SMS.sendSMSAsync not returning correct result on Android by @bbarthec (#2452)
  • fix barcode scanner not working on Pixel 2 by @alexshikov (#2081)
  • fix “Font doesn't support automatic scaling” errors on iOS < 12 by @sjchmiela (#2480)
  • fix missing “Orientation” tag in ImagePicker EXIF data by @bbarthec (#2432)
  • fix react-native-screens compatibility with Expo by @tsapeta (#2509)