资源简介
该文件为cordova的获取移动设备的信息,官方提供的插件中没有提供获取设备mac地址,故这个插件添加了获取mac地址的方法,适用于android和ios,调用方法和官方其他属性调用方法一致,参数名为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个文件信息
- 上一篇:Lucene3.0.1 jar包
- 下一篇:基于java的图像分割数字图像处理
相关资源
- Android Studio 原生项目集成 Cordova 插件
- cordova2.9.1.jar
- cordovalib.jar
- 使用Cordova开发android项目简单
- 设备树学习资料
- 调用cordova插件的一个ionic,插件包含
- Visual Studio 2015 X Cordova跨平台App實戰特
- cordova barcodescanner 仿微信样式并支持从
- android 用SO_BINDTODEVICE绑定发出包的测试
- ble device monitor
- Device ID Changer 2020_v1.4-free_apkpure.com.a
- Cordova+Vue+Mint-UI+Android构建Andriod app C
- cordova3.4 jar和js文件
- android 第三方webview cordova的集成使用
- cordova调用Android关于服务的插件
- android安装应用插件 Cordova插件
- 基于cordova Android js 串口插件
- 自定义的扫描二维码界面的cordova 扫码
评论
共有 条评论