@@ -18,8 +18,6 @@ Licensed to the Apache Software Foundation (ASF) under one
18
18
*/
19
19
package org .apache .cordova .device ;
20
20
21
- import java .util .TimeZone ;
22
-
23
21
import org .apache .cordova .CordovaWebView ;
24
22
import org .apache .cordova .CallbackContext ;
25
23
import org .apache .cordova .CordovaPlugin ;
@@ -31,14 +29,10 @@ Licensed to the Apache Software Foundation (ASF) under one
31
29
import android .provider .Settings ;
32
30
33
31
public class Device extends CordovaPlugin {
34
- public static final String TAG = "Device" ;
35
32
36
- public static String platform ; // Device OS
37
33
public static String uuid ; // Device UUID
38
34
39
35
private static final String ANDROID_PLATFORM = "Android" ;
40
- private static final String AMAZON_PLATFORM = "amazon-fireos" ;
41
- private static final String AMAZON_DEVICE = "Amazon" ;
42
36
43
37
/**
44
38
* Constructor.
@@ -62,7 +56,7 @@ public void initialize(CordovaInterface cordova, CordovaWebView webView) {
62
56
* Executes the request and returns PluginResult.
63
57
*
64
58
* @param action The action to execute.
65
- * @param args JSONArry of arguments for the plugin.
59
+ * @param args JSONArray of arguments for the plugin.
66
60
* @param callbackContext The callback id used when calling back into JavaScript.
67
61
* @return True if the action was valid, false if not.
68
62
*/
@@ -92,79 +86,46 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
92
86
/**
93
87
* Get the OS name.
94
88
*
95
- * @return
89
+ * @return "Android"
96
90
*/
97
91
public String getPlatform () {
98
- String platform ;
99
- if (isAmazonDevice ()) {
100
- platform = AMAZON_PLATFORM ;
101
- } else {
102
- platform = ANDROID_PLATFORM ;
103
- }
104
- return platform ;
92
+ return ANDROID_PLATFORM ;
105
93
}
106
94
107
95
/**
108
96
* Get the device's Universally Unique Identifier (UUID).
109
97
*
110
- * @return
98
+ * @return android.provider.Settings.Secure.ANDROID_ID
111
99
*/
112
100
public String getUuid () {
113
- String uuid = Settings .Secure .getString (this .cordova .getActivity ().getContentResolver (), android .provider .Settings .Secure .ANDROID_ID );
114
- return uuid ;
101
+ return Settings .Secure .getString (this .cordova .getActivity ().getContentResolver (), android .provider .Settings .Secure .ANDROID_ID );
115
102
}
116
103
117
104
public String getModel () {
118
- String model = android .os .Build .MODEL ;
119
- return model ;
120
- }
121
-
122
- public String getProductName () {
123
- String productname = android .os .Build .PRODUCT ;
124
- return productname ;
105
+ return android .os .Build .MODEL ;
125
106
}
126
107
127
108
public String getManufacturer () {
128
- String manufacturer = android .os .Build .MANUFACTURER ;
129
- return manufacturer ;
109
+ return android .os .Build .MANUFACTURER ;
130
110
}
131
111
132
112
public String getSerialNumber () {
133
- String serial = android .os .Build .SERIAL ;
134
- return serial ;
113
+ return android .os .Build .SERIAL ;
135
114
}
136
115
137
116
/**
138
117
* Get the OS version.
139
118
*
140
- * @return
119
+ * @return android.os.Build.VERSION.RELEASE
141
120
*/
142
121
public String getOSVersion () {
143
- String osversion = android .os .Build .VERSION .RELEASE ;
144
- return osversion ;
122
+ return android .os .Build .VERSION .RELEASE ;
145
123
}
146
124
147
125
public String getSDKVersion () {
148
126
return String .valueOf (android .os .Build .VERSION .SDK_INT );
149
127
}
150
128
151
- public String getTimeZoneID () {
152
- TimeZone tz = TimeZone .getDefault ();
153
- return (tz .getID ());
154
- }
155
-
156
- /**
157
- * Function to check if the device is manufactured by Amazon
158
- *
159
- * @return
160
- */
161
- public boolean isAmazonDevice () {
162
- if (android .os .Build .MANUFACTURER .equals (AMAZON_DEVICE )) {
163
- return true ;
164
- }
165
- return false ;
166
- }
167
-
168
129
public boolean isVirtual () {
169
130
return android .os .Build .FINGERPRINT .contains ("generic" ) ||
170
131
android .os .Build .PRODUCT .contains ("sdk" );
0 commit comments