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
1c6d1e04
Commit
1c6d1e04
authored
Dec 08, 2015
by
Rebecca Hughes
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8 from donald-jackson/master
Add user defined deviceName field
parents
e6407db3
175e723f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
0 deletions
+16
-0
RNDeviceInfo.m
RNDeviceInfo/RNDeviceInfo.m
+1
-0
AndroidManifest.xml
android/src/main/AndroidManifest.xml
+2
-0
RNDeviceModule.java
...c/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java
+10
-0
deviceinfo.js
deviceinfo.js
+3
-0
No files found.
RNDeviceInfo/RNDeviceInfo.m
View file @
1c6d1e04
...
@@ -132,6 +132,7 @@ RCT_EXPORT_MODULE()
...
@@ -132,6 +132,7 @@ RCT_EXPORT_MODULE()
@"systemVersion"
:
currentDevice
.
systemVersion
,
@"systemVersion"
:
currentDevice
.
systemVersion
,
@"model"
:
self
.
deviceName
,
@"model"
:
self
.
deviceName
,
@"deviceId"
:
self
.
deviceId
,
@"deviceId"
:
self
.
deviceId
,
@"deviceName"
:
currentDevice
.
name
,
@"uniqueId"
:
uniqueId
,
@"uniqueId"
:
uniqueId
,
@"bundleId"
:
[[
NSBundle
mainBundle
]
objectForInfoDictionaryKey
:
@"CFBundleIdentifier"
],
@"bundleId"
:
[[
NSBundle
mainBundle
]
objectForInfoDictionaryKey
:
@"CFBundleIdentifier"
],
@"appVersion"
:
[[
NSBundle
mainBundle
]
objectForInfoDictionaryKey
:
@"CFBundleShortVersionString"
],
@"appVersion"
:
[[
NSBundle
mainBundle
]
objectForInfoDictionaryKey
:
@"CFBundleShortVersionString"
],
...
...
android/src/main/AndroidManifest.xml
View file @
1c6d1e04
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.learnium.RNDeviceInfo"
>
package=
"com.learnium.RNDeviceInfo"
>
<uses-permission
android:name=
"android.permission.BLUETOOTH"
/>
</manifest>
</manifest>
android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java
View file @
1c6d1e04
...
@@ -49,6 +49,16 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
...
@@ -49,6 +49,16 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
String
deviceName
=
"Unknown"
;
try
{
BluetoothAdapter
myDevice
=
BluetoothAdapter
.
getDefaultAdapter
();
deviceName
=
myDevice
.
getName
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
constants
.
put
(
"deviceName"
,
deviceName
);
constants
.
put
(
"systemName"
,
"Android"
);
constants
.
put
(
"systemName"
,
"Android"
);
constants
.
put
(
"systemVersion"
,
Build
.
VERSION
.
RELEASE
);
constants
.
put
(
"systemVersion"
,
Build
.
VERSION
.
RELEASE
);
constants
.
put
(
"model"
,
Build
.
MODEL
);
constants
.
put
(
"model"
,
Build
.
MODEL
);
...
...
deviceinfo.js
View file @
1c6d1e04
...
@@ -34,5 +34,8 @@ module.exports = {
...
@@ -34,5 +34,8 @@ module.exports = {
},
},
getReadableVersion
:
function
()
{
getReadableVersion
:
function
()
{
return
RNDeviceInfo
.
appVersion
+
"."
+
RNDeviceInfo
.
buildNumber
;
return
RNDeviceInfo
.
appVersion
+
"."
+
RNDeviceInfo
.
buildNumber
;
},
getDeviceName
:
function
()
{
return
RNDeviceInfo
.
deviceName
;
}
}
};
};
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