資源簡介
該文件為cordova的獲取移動設備的信息,官方提供的插件中沒有提供獲取設備mac地址,故這個插件添加了獲取mac地址的方法,適用于android和ios,調(diào)用方法和官方其他屬性調(diào)用方法一致,參數(shù)名為mac

代碼片段和文件信息
/*
???????Licensed?to?the?Apache?Software?Foundation?(ASF)?under?one
???????or?more?contributor?license?agreements.??See?the?NOTICE?file
???????distributed?with?this?work?for?additional?information
???????regarding?copyright?ownership.??The?ASF?licenses?this?file
???????to?you?under?the?Apache?License?Version?2.0?(the
???????“License“);?you?may?not?use?this?file?except?in?compliance
???????with?the?License.??You?may?obtain?a?copy?of?the?License?at
?????????http://www.apache.org/licenses/LICENSE-2.0
???????Unless?required?by?applicable?law?or?agreed?to?in?writing
???????software?distributed?under?the?License?is?distributed?on?an
???????“AS?IS“?BASIS?WITHOUT?WARRANTIES?OR?CONDITIONS?OF?ANY
???????KIND?either?express?or?implied.??See?the?License?for?the
???????specific?language?governing?permissions?and?limitations
???????under?the?License.
*/
package?org.apache.cordova.device;
import?java.util.TimeZone;
import?java.net.*;
import?java.util.Enumeration;
import?org.apache.cordova.CordovaWebView;
import?org.apache.cordova.CallbackContext;
import?org.apache.cordova.CordovaPlugin;
import?org.apache.cordova.CordovaInterface;
import?org.json.JSONArray;
import?org.json.JSONException;
import?org.json.JSONobject;
import?android.provider.Settings;
public?class?Device?extends?CordovaPlugin?{
????public?static?final?String?TAG?=?“Device“;
????public?static?String?platform;????????????????????????????//?Device?OS
????public?static?String?uuid;????????????????????????????????//?Device?UUID
????private?static?final?String?ANDROID_PLATFORM?=?“Android“;
????private?static?final?String?AMAZON_PLATFORM?=?“amazon-fireos“;
????private?static?final?String?AMAZON_DEVICE?=?“Amazon“;
????/**
?????*?Constructor.
?????*/
????public?Device()?{
????}
????/**
?????*?Sets?the?context?of?the?Command.?This?can?then?be?used?to?do?things?like
?????*?get?file?paths?associated?with?the?Activity.
?????*
?????*?@param?cordova?The?context?of?the?main?Activity.
?????*?@param?webView?The?CordovaWebView?Cordova?is?running?in.
?????*/
????public?void?initialize(CordovaInterface?cordova?CordovaWebView?webView)?{
????????super.initialize(cordova?webView);
????????Device.uuid?=?getUuid();
????}
????/**
?????*?Executes?the?request?and?returns?PluginResult.
?????*
?????*?@param?action????????????The?action?to?execute.
?????*?@param?args??????????????JSONArry?of?arguments?for?the?plugin.
?????*?@param?callbackContext???The?callback?id?used?when?calling?back?into?javascript.
?????*?@return??????????????????True?if?the?action?was?valid?false?if?not.
?????*/
????public?boolean?execute(String?action?JSONArray?args?CallbackContext?callbackContext)?throws?JSONException?{
????????if?(“getDeviceInfo“.equals(action))?{
????????????JSONobject?r?=?new?JSONobject();
????????????r.put(“uuid“?Device.uuid);
????????????r.put(“version“?this.getOSVersion());
????????????r.put(“platform“?this.getPlatform());
????????????r.put(“model“?this.getModel());
????????????r.put(“manufacturer“?this.get
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-12-04?16:42??cordova-plugin-device\
?????文件????????1401??2018-06-30?16:46??cordova-plugin-device\CONTRIBUTING.md
?????文件???????11357??2018-06-30?16:46??cordova-plugin-device\LICENSE
?????文件?????????163??2018-06-30?16:46??cordova-plugin-device\NOTICE
?????文件????????9963??2018-06-30?16:46??cordova-plugin-device\README.md
?????文件???????21319??2018-06-30?16:46??cordova-plugin-device\RELEASENOTES.md
?????目錄???????????0??2018-12-04?16:42??cordova-plugin-device\doc\
?????目錄???????????0??2018-12-04?16:42??cordova-plugin-device\doc\de\
?????文件????????6998??2018-06-30?16:46??cordova-plugin-device\doc\de\README.md
?????文件????????6798??2018-06-30?16:46??cordova-plugin-device\doc\de\index.md
?????目錄???????????0??2018-12-04?16:42??cordova-plugin-device\doc\es\
?????文件????????6988??2018-06-30?16:46??cordova-plugin-device\doc\es\README.md
?????文件????????6866??2018-06-30?16:46??cordova-plugin-device\doc\es\index.md
?????目錄???????????0??2018-12-04?16:42??cordova-plugin-device\doc\fr\
?????文件????????7321??2018-06-30?16:46??cordova-plugin-device\doc\fr\README.md
?????文件????????7124??2018-06-30?16:46??cordova-plugin-device\doc\fr\index.md
?????目錄???????????0??2018-12-04?16:42??cordova-plugin-device\doc\it\
?????文件????????6983??2018-06-30?16:46??cordova-plugin-device\doc\it\README.md
?????文件????????6783??2018-06-30?16:46??cordova-plugin-device\doc\it\index.md
?????目錄???????????0??2018-12-04?16:42??cordova-plugin-device\doc\ja\
?????文件????????7947??2018-06-30?16:46??cordova-plugin-device\doc\ja\README.md
?????文件????????7747??2018-06-30?16:46??cordova-plugin-device\doc\ja\index.md
?????目錄???????????0??2018-12-04?16:42??cordova-plugin-device\doc\ko\
?????文件????????7130??2018-06-30?16:46??cordova-plugin-device\doc\ko\README.md
?????文件????????6930??2018-06-30?16:46??cordova-plugin-device\doc\ko\index.md
?????目錄???????????0??2018-12-04?16:42??cordova-plugin-device\doc\pl\
?????文件????????6830??2018-06-30?16:46??cordova-plugin-device\doc\pl\README.md
?????文件????????6672??2018-06-30?16:46??cordova-plugin-device\doc\pl\index.md
?????目錄???????????0??2018-12-04?16:42??cordova-plugin-device\doc\ru\
?????文件????????9145??2018-06-30?16:46??cordova-plugin-device\doc\ru\index.md
?????目錄???????????0??2018-12-04?16:42??cordova-plugin-device\doc\zh\
............此處省略32個文件信息
評論
共有 條評論