Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
R
react-native-device-info
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
放牛的园子
react-native-device-info
Commits
4a235531
Commit
4a235531
authored
Dec 30, 2015
by
Hamza Sharawi
Browse files
Options
Browse Files
Download
Plain Diff
Fix merge conflicts
parents
5a87304c
3e420631
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
1 deletion
+14
-1
README.md
README.md
+2
-0
RNDeviceInfo.m
RNDeviceInfo/RNDeviceInfo.m
+8
-1
RNDeviceModule.java
...c/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java
+1
-0
deviceinfo.js
deviceinfo.js
+3
-0
No files found.
README.md
View file @
4a235531
...
...
@@ -116,6 +116,8 @@ console.log("App Version (Readable)", DeviceInfo.getReadableVersion()); // e.g.
console
.
log
(
"Device Name"
,
DeviceInfo
.
getDeviceName
());
// e.g. Becca's iPhone 6
console
.
log
(
"User Agent"
,
DeviceInfo
.
getUserAgent
());
// e.g. Dalvik/2.1.0 (Linux; U; Android 5.1; Google Nexus 4 - 5.1.0 - API 22 - 768x1280 Build/LMY47D)
console
.
log
(
"Device Locale"
,
DeviceInfo
.
getDeviceLocale
());
// e.g en-US
```
RNDeviceInfo/RNDeviceInfo.m
View file @
4a235531
...
...
@@ -116,10 +116,16 @@ RCT_EXPORT_MODULE()
deviceName
=
@"iPhone"
;
}
}
return
deviceName
;
}
-
(
NSString
*
)
userAgent
{
UIWebView
*
webView
=
[[
UIWebView
alloc
]
initWithFrame
:
CGRectZero
];
return
[
webView
stringByEvaluatingJavaScriptFromString
:
@"navigator.userAgent"
];
}
-
(
NSString
*
)
deviceLocale
{
NSString
*
language
=
[[
NSLocale
preferredLanguages
]
objectAtIndex
:
0
];
...
...
@@ -145,6 +151,7 @@ RCT_EXPORT_MODULE()
@"appVersion"
:
[[
NSBundle
mainBundle
]
objectForInfoDictionaryKey
:
@"CFBundleShortVersionString"
],
@"buildNumber"
:
[[
NSBundle
mainBundle
]
objectForInfoDictionaryKey
:
@"CFBundleVersion"
],
@"systemManufacturer"
:
@"Apple"
,
@"userAgent"
:
self
.
userAgent
,
};
}
...
...
android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java
View file @
4a235531
...
...
@@ -68,6 +68,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
constants
.
put
(
"uniqueId"
,
Secure
.
getString
(
this
.
reactContext
.
getContentResolver
(),
Secure
.
ANDROID_ID
));
constants
.
put
(
"systemManufacturer"
,
Build
.
MANUFACTURER
);
constants
.
put
(
"bundleId"
,
packageName
);
constants
.
put
(
"userAgent"
,
System
.
getProperty
(
"http.agent"
));
return
constants
;
}
}
deviceinfo.js
View file @
4a235531
...
...
@@ -38,6 +38,9 @@ module.exports = {
getDeviceName
:
function
()
{
return
RNDeviceInfo
.
deviceName
;
},
getUserAgent
:
function
()
{
return
RNDeviceInfo
.
userAgent
;
},
getDeviceLocale
:
function
()
{
return
RNDeviceInfo
.
deviceLocale
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment