github react-native-device-info/react-native-device-info v3.0.0
v3.0.0 - WebView removal, async usage, API coherence

latest releases: v11.1.0, v11.0.0, v10.14.0...
4 years ago

Welcome to react-native-device-info v3

This release has a number of important breaking changes.

You will need to adjust your code to use it. However, I believe all existing usage patterns should be supported.

Please see the upgrade guide here for information on breaking changes:

https://github.com/react-native-community/react-native-device-info/wiki/V2-to-V3-Migration-Guide

[Update on 20190915: Windows v3 has been fixed!]

[Update - @acoates-ms fixed up the windows module and the result is released as 3.1.1 - windows users owe him some thanks!]

Original text from v3.0.0 release:

It is very likely that the windows port is broken right now. No windows users helped test it so it may not even compile. If this is important to you, you will have to file PRs to help maintain it as none of the current maintainers has a react-native-windows environment.

Changelog

3.0.0

  • release: promoted release from 3.0.0-rc.5 without change

3.0.0-rc.5

  • fix: various fixes similar to / prompted by #771 / #768 / #769
  • fix: getSystemName() returns value on ios+android #771 thanks @cmpayc!
  • fix: getUniqueId() only returned value 1st call #768 thanks @tamhv!
  • fix: getModel() not working on iOS #769 Thanks @rnnyrk!

3.0.0-rc.4

  • feat: memoize static return values for performance

3.0.0-rc.3

  • fix: TypeScript getPowerState() return type was Object instaed of PowerState interface
  • fix: TypeScript definition file was missing getPhoneNumberSync()

3.0.0-rc.2

  • Added a sync version of each API call, in practice it is very difficult to consume async
    APIs during app bootstrap and device info is frequently fundamental to app startup behavior.
    This still preserves the change away from paying the entire cost of information retrieval at
    startup - now you will only pay for exactly what you need.

3.0.0-rc.1

  • fix incorrect use of macos for API selection vs ios in rc.3, rendering ios builds mostly useless
  • verified last of the v2->v3 discrepancies, this is a release candidate now

3.0.0-beta.3

  • fix some real android device v2->v3 discrepancies
  • BREAKING CHANGE: more capitalization changes for API calls to standardize (see below)
  • BREAKING CHANGE: more return value changes to standardize return values (see below)
  • feat: you no longer have to be careful with platform-specific APIs, all APIs will work, just
    returning standard "unknown" return values (see above breaking change, and example App.js usage)

3.0.0-beta.2

  • fix all emulator/simulator v2->v3 discrepancies

3.0.0-beta.1

Each BREAKING CHANGE contains the required information to migrate. The example App.js shows sample usage.

  • BREAKING CHANGE: Every API call returns a Promise now (and thus no more Android constructor with async boolean argument)
    • This was required to improve module load speed, handle dynamic values, and release the main queue for iOS
  • BREAKING CHANGE: Every API call with acronyms ('getIP', 'getABI' etc follows pure camel-case now, e.g. 'getIp', 'getAbi')
    • This naming style is a consensus standard. Previously APIs here were half one way half the other. Now they are consistent
    • isAirPlaneMode -> isAirplaneMode
    • getIPAddress -> getIpAddress
    • getMACAddress -> getMACAddress
    • getAPILevel -> GetApiLevel
    • getBaseOS -> getBaseOs
    • getInstanceID -> getInstanceId
    • getUniqueID -> getUniqueId
    • supportedABIs -> supportedAbis
  • BREAKING CHANGE: all events prefixed with 'RNDeviceInfo_' (#620)
    • This is required as event names are a global namespace and collisions are inevitable otherwise
    • powerStateDidChange -> RNDeviceInfo_powerStateDidChange
    • batteryLevelDidChange -> RNDeviceInfo_batteryLevelDidChange
    • batteryLevelIsLow -> RNDeviceInfo_batteryLevelIsLow
  • BREAKING CHANGE: Android getBuildNumber returns string like iOS (#648)
  • BREAKING CHANGE: remove is24Hour, getTimezone, isAutoTimeZone and isAutoDateAndTime, getDeviceLocale, getDeviceCountry, getPreferredLocales
    • This was the result of a survey. It removes API duplication in the react-native-community modules
    • Related PR: zoontek/react-native-localize#65
    • Use yarn add https://github.com/mikehardy/react-native-localize.git#e062f0d2dc3171dc18fdb7b7139d347ad03933dc to maintain isAutoTimeZone + isAutoDateAndTime until merged
  • BREAKING CHANGE: iOS switch deprecated WebView for WebKit / getUserAgent returns Promise (#757)
    • The change from WebView to WebKit was required as the API is being removed from the iOS platform
  • BREAKING CHANGE: if an API is platform-specific, all non-implementing platforms will return standard values of -1, false, or 'unknown' depending on return type
    • This was how most APIs behaved before but it was not 100% - some returned null or empty string before
    • getPhoneNumber sometimes returned null, now it will be 'unknown' if not known
  • deprecated: IP-address-related methods deprecated - use @react-native-community/netinfo or react-native-network-info or react-native-carrier-info
  • feat: all APIs are now restricted in Javascirpt to the platforms they have full implementations on so the web polyfill is up to date
  • feat: 'getAndroidId' on Android returns android.provider.Settings.Secure.ANDROID_ID, read platform docs for usage
  • feat: getUsedMemory (#356)
  • feat: getDeviceName() without Bluetooth permission on Android (#735)
  • feat: TurboModule support (#745) for these purposes (zoontek/react-native-localize#65)
  • feat: allow for destructured ES6 imports (#727)
  • feat: update gradle, add react-native devDependency and build.gradle reference to enhance module developer experience
  • fix: remove unnecessary gradle depencies (#746)
  • chore: de-linted all Java code, all Markdown

Don't miss a new react-native-device-info release

NewReleases is sending notifications on new releases.