https://github.com/maxgraey/fuse-device
Use the basic Device functions such as UUID and current localization from Fuse
https://github.com/maxgraey/fuse-device
android device fuse information ios localization uuid
Last synced: 23 days ago
JSON representation
Use the basic Device functions such as UUID and current localization from Fuse
- Host: GitHub
- URL: https://github.com/maxgraey/fuse-device
- Owner: MaxGraey
- License: mit
- Created: 2016-08-09T00:11:45.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-20T19:41:40.000Z (over 7 years ago)
- Last Synced: 2025-03-25T07:01:42.571Z (about 1 month ago)
- Topics: android, device, fuse, information, ios, localization, uuid
- Language: Uno
- Size: 201 KB
- Stars: 13
- Watchers: 6
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
fuse-device
============Use the basic Device functions such as UUID and current localization from Fuse.
## Installation
Using [fusepm](https://github.com/bolav/fusepm)
$ fusepm install https://github.com/MaxGraey/fuse-device
Or manually copy **Device.uno** to your project and add link in .unoproj [see example](https://github.com/MaxGraey/fuse-device/tree/master/example)
### Support
- **iOS**
- **Android**
- **Preview**### JavaScript
```js
var Device = require('Device');console.log('Current device language: ' + Device.locale); // format in BCP-47 for all mobile platforms
// output example: en-USconsole.log('UUID:' + Device.UUID);
// output example:
// UUID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXconsole.log('Vendor name: ' + Device.vendor);
console.log('Model name: ' + Device.model);
console.log('System: ' + Device.system);
console.log('System version: ' + Device.systemVersion);
console.log('System SDK ver: ' + Device.SDKVersion);
console.log('Logical processors: ' + Device.cores);
console.log('is retina?: ' + Device.isRetina);
```Since reading UUID in Android requires a run-time permission to `READ_PHONE_STATE`,
the UUID might not always be accessible via `Device.UUID` directly. To work around that,
there is a `getUUID()` method that returns the UUID in a promise.For convenience, `getUUID()` is available on all target platforms, but it only triggers the permission request on Android.
```js
var Device = require('Device');
if (Device.UUID == '') {
Device.getUUID().then(function(uuid) {
console.log('UUID: ' + uuid);
// output example:
// UUID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
}).catch(function(error) {
console.log('UUID error: ' + error);
// output example:
// UUID error: Permissions could not be requested or granted.
});
}
```