@@ -55,17 +55,17 @@ console.log(DeviceInfoModule.systemVersion); // "15.0"
5555console .log (DeviceInfoModule .brand ); // "Apple"
5656console .log (DeviceInfoModule .model ); // "iPhone"
5757
58- // Synchronous methods (immediate - <1ms)
59- const uniqueId = DeviceInfoModule .getUniqueId () ;
58+ // Synchronous properties (immediate - <1ms)
59+ const uniqueId = DeviceInfoModule .uniqueId ;
6060console .log (uniqueId ); // "FCDBD8EF-62FC-4ECB-B2F5-92C9E79AC7F9"
6161
62- const manufacturer = DeviceInfoModule .getManufacturer () ;
62+ const manufacturer = DeviceInfoModule .manufacturer ;
6363console .log (manufacturer ); // "Apple"
6464
65- const isTablet = DeviceInfoModule .isTablet () ;
65+ const isTablet = DeviceInfoModule .isTablet ;
6666console .log (isTablet ); // false
6767
68- const batteryLevel = DeviceInfoModule .getBatteryLevel () ;
68+ const batteryLevel = DeviceInfoModule .batteryLevel ;
6969console .log (` Battery: ${(batteryLevel * 100 ).toFixed (0 )}% ` ); // "Battery: 85%"
7070
7171// Asynchronous methods (Promise-based - <100ms)
@@ -84,21 +84,21 @@ import type { PowerState, DeviceType } from 'react-native-nitro-device-info';
8484
8585// Device Identification
8686const deviceId = DeviceInfoModule .deviceId ; // "iPhone14,2"
87- const manufacturer = DeviceInfoModule .getManufacturer () ; // "Apple"
88- const uniqueId = DeviceInfoModule .getUniqueId () ; // "FCDBD8EF-..."
87+ const manufacturer = DeviceInfoModule .manufacturer ; // "Apple"
88+ const uniqueId = DeviceInfoModule .uniqueId ; // "FCDBD8EF-..."
8989
9090// Device Capabilities
91- const isTablet = DeviceInfoModule .isTablet () ; // false
92- const hasNotch = DeviceInfoModule .hasNotch () ; // true
93- const hasDynamicIsland = DeviceInfoModule .hasDynamicIsland () ; // false
94- const isCameraPresent = DeviceInfoModule .isCameraPresent () ; // true
95- const isEmulator = DeviceInfoModule .isEmulator () ; // false
91+ const isTablet = DeviceInfoModule .isTablet ; // false
92+ const hasNotch = DeviceInfoModule .hasNotch ; // true
93+ const hasDynamicIsland = DeviceInfoModule .hasDynamicIsland ; // false
94+ const isCameraPresent = DeviceInfoModule .isCameraPresent ; // true
95+ const isEmulator = DeviceInfoModule .isEmulator ; // false
9696
9797// System Resources
98- const totalMemory = DeviceInfoModule .getTotalMemory () ;
99- const usedMemory = DeviceInfoModule .getUsedMemory () ;
100- const totalDisk = DeviceInfoModule .getTotalDiskCapacity () ;
101- const freeDisk = DeviceInfoModule .getFreeDiskStorage () ;
98+ const totalMemory = DeviceInfoModule .totalMemory ;
99+ const usedMemory = DeviceInfoModule .usedMemory ;
100+ const totalDisk = DeviceInfoModule .totalDiskCapacity ;
101+ const freeDisk = DeviceInfoModule .freeDiskStorage ;
102102
103103console .log (
104104 ` RAM: ${(usedMemory / 1024 / 1024 ).toFixed (0 )}MB / ${(totalMemory / 1024 / 1024 ).toFixed (0 )}MB `
@@ -108,20 +108,20 @@ console.log(
108108);
109109
110110// Battery Information
111- const batteryLevel = DeviceInfoModule .getBatteryLevel () ;
112- const isCharging = DeviceInfoModule .isBatteryCharging () ;
113- const powerState: PowerState = DeviceInfoModule .getPowerState () ;
111+ const batteryLevel = DeviceInfoModule .batteryLevel ;
112+ const isCharging = DeviceInfoModule .isBatteryCharging ;
113+ const powerState: PowerState = DeviceInfoModule .powerState ;
114114
115115console .log (
116116 ` Battery: ${(batteryLevel * 100 ).toFixed (0 )}% ${isCharging ? ' (charging)' : ' ' } `
117117);
118118console .log (` Low Power Mode: ${powerState .lowPowerMode } ` );
119119
120120// Application Metadata
121- const version = DeviceInfoModule .getVersion () ;
122- const buildNumber = DeviceInfoModule .getBuildNumber () ;
123- const bundleId = DeviceInfoModule .getBundleId () ;
124- const appName = DeviceInfoModule .getApplicationName () ;
121+ const version = DeviceInfoModule .version ;
122+ const buildNumber = DeviceInfoModule .buildNumber ;
123+ const bundleId = DeviceInfoModule .bundleId ;
124+ const appName = DeviceInfoModule .applicationName ;
125125
126126console .log (` ${appName } (${bundleId }) ` );
127127console .log (` Version: ${version } (${buildNumber }) ` );
@@ -136,9 +136,9 @@ console.log(`Carrier: ${carrier}`);
136136console .log (` Location Services: ${isLocationEnabled ? ' enabled' : ' disabled' } ` );
137137
138138// Platform-Specific
139- const apiLevel = DeviceInfoModule .getApiLevel () ; // Android: 33, iOS: -1
140- const abis = DeviceInfoModule .getSupportedAbis () ; // ["arm64-v8a"]
141- const hasGms = DeviceInfoModule .hasGms () ; // Android only
139+ const apiLevel = DeviceInfoModule .apiLevel ; // Android: 33, iOS: -1
140+ const abis = DeviceInfoModule .supportedAbis ; // ["arm64-v8a"]
141+ const hasGms = DeviceInfoModule .hasGms ; // Android only
142142```
143143
144144## API Reference
@@ -156,20 +156,20 @@ DeviceInfoModule.systemVersion; // "15.0"
156156DeviceInfoModule .model ; // "iPhone"
157157```
158158
159- #### Common Methods
159+ #### Common Properties
160160
161161``` typescript
162162// Device Info
163- DeviceInfoModule .getUniqueId () ; // Sync
164- DeviceInfoModule .isTablet () ; // Sync
165- DeviceInfoModule .getTotalMemory () ; // Sync
166- DeviceInfoModule .getBatteryLevel () ; // Sync
163+ DeviceInfoModule .uniqueId ; // Sync
164+ DeviceInfoModule .isTablet ; // Sync
165+ DeviceInfoModule .totalMemory ; // Sync
166+ DeviceInfoModule .batteryLevel ; // Sync
167167
168168// App Info
169- DeviceInfoModule .getVersion () ; // Sync
170- DeviceInfoModule .getBundleId () ; // Sync
169+ DeviceInfoModule .version ; // Sync
170+ DeviceInfoModule .bundleId ; // Sync
171171
172- // Network (Async)
172+ // Network (Async methods )
173173await DeviceInfoModule .getIpAddress (); // ~20-50ms
174174await DeviceInfoModule .getCarrier (); // ~20-50ms
175175```
@@ -216,13 +216,13 @@ import { DeviceInfoModule } from 'react-native-nitro-device-info';
216216const deviceId = DeviceInfoModule .deviceId ; // Property, not method
217217const brand = DeviceInfoModule .brand ; // Property, not method
218218
219- // Most methods are now synchronous
220- const uniqueId = DeviceInfoModule .getUniqueId () ; // Sync now !
221- const totalMemory = DeviceInfoModule .getTotalMemory () ; // Sync now !
222- const batteryLevel = DeviceInfoModule .getBatteryLevel () ; // Sync now !
223- const isTablet = DeviceInfoModule .isTablet () ; // Same as before
219+ // Most values are now synchronous properties
220+ const uniqueId = DeviceInfoModule .uniqueId ; // Property, sync !
221+ const totalMemory = DeviceInfoModule .totalMemory ; // Property, sync !
222+ const batteryLevel = DeviceInfoModule .batteryLevel ; // Property, sync !
223+ const isTablet = DeviceInfoModule .isTablet ; // Property, sync!
224224
225- // Only network/connectivity remain async
225+ // Only network/connectivity remain async methods
226226const ipAddress = await DeviceInfoModule .getIpAddress ();
227227```
228228
0 commit comments