更新记录

1.0.1(2024-07-12)

  1. 支持安卓设备主动获取设备周围WIFI信息(已JSON形式返回)

平台兼容性

Android Android CPU类型 iOS
适用版本区间:5.0 - 14.0 armeabi-v7a:未测试,arm64-v8a:未测试,x86:未测试 ×

原生插件通用使用流程:

  1. 购买插件,选择该插件绑定的项目。
  2. 在HBuilderX里找到项目,在manifest的app原生插件配置中勾选模块,如需要填写参数则参考插件作者的文档添加。
  3. 根据插件作者的提供的文档开发代码,在代码中引用插件,调用插件功能。
  4. 打包自定义基座,选择插件,得到自定义基座,然后运行时选择自定义基座,进行log输出测试。
  5. 开发完毕后正式云打包

付费原生插件目前不支持离线打包。
Android 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/android
iOS 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/ios

注意事项:使用HBuilderX2.7.14以下版本,如果同一插件且同一appid下购买并绑定了多个包名,提交云打包界面提示包名绑定不一致时,需要在HBuilderX项目中manifest.json->“App原生插件配置”->”云端插件“列表中删除该插件重新选择


安卓设备获取周围 wifi

介绍

Uniapp 调用 uniplugin_wifiaround-release.aar 获取周围 wifi

软件架构

代码示例

<template>
    <view class="content">
        <image class="logo" src="/static/logo.png"></image>
        <view>
            <div>
                <button type="primary" @click="getWifiAround">获取WIFI</button>
            </div>
        </view>
    </view>
</template>

<script>
// 获取 module
var wifiModule = uni.requireNativePlugin("wifiaround-module")

export default {
    data() {
        return {
            title: 'wifiaround-module',
            result: 0,
            result1:0,
        };
    },
    onLoad() {},
    methods: {
        getWifiAround(){
            console.log("getWifiAround 进入了")
         var data = wifiModule.getWifiAround();
         console.log(JSON.stringify(data))
        }
    }
};
</script>

安装教程

  1. 直接引入Uniapp 项目即可

使用说明

  1. 插件目录结构

输入图片说明

  1. package.json配置

    {
    "name": "获取周围wifi",
    "id": "wifiaround-module",
    "version": "v1.0.2024.07.09",
    "description": "获取周围wifi,联系QQ:1426429456@qq.com",
    "_dp_type": "nativeplugin",
    "_dp_nativeplugin": {
        "android": {
            "plugins": [{
                    "type": "module",
                    "name": "wifiaround-module",
                    "class": "com.example.uniplugin_wifiaround.WIFIAroundModule"
                }
            ],
            "dependencies": [
                "androidx.appcompat:appcompat:1.0.0-alpha1"
            ],
            "integrateType": "aar",
            "minSdkVersion": "21",
            "abis": [
                        "armeabi-v7a"
                    ],
    
            "useAndroidX": true,
            "permissions": [
                            "android.permission.REBOOT",
                            "android.permission.SHUTDOWN",
                            "android.permission.DEVICE_POWER",
                            "android.permission.READ_EXTERNAL_STORAGE",
                            "android.permission.WRITE_EXTERNAL_STORAG",
                            "android.permission.WRITE_SETTINGS",
                            "android.permission.BLUETOOTH_CONNECT",
                            "android.permission.BLUETOOTH_SCAN",
                            "android.permission.CHANGE_WIFI_STATE", 
                            "android.permission.CHANGE_NETWORK_STATE",
                            "android.permission.MOUNT_UNMOUNT_FILESYSTEMS", 
                            "android.permission.VIBRATE", 
                            "android.permission.READ_LOGS", 
                            "android.permission.ACCESS_WIFI_STATE", 
                            "android.permission.ACCESS_NETWORK_STATE", 
                            "android.permission.CAMERA", 
                            "android.permission.GET_ACCOUNTS", 
                            "android.permission.READ_PHONE_STATE", 
                            "android.permission.WAKE_LOCK", 
                            "android.permission.FLASHLIGHT", 
                            "android.permission.WRITE_SETTINGS", 
                            "android.permission.INTERNET", 
                            "android.permission.ACCESS_COARSE_LOCATION", 
                            "android.permission.ACCESS_FINE_LOCATION" 
    
                        ]
    
        }
    }
    }
  2. 运行效果 输入图片说明
  3. 返回示例
    {"data":[{"MAC":"9c:2b:a6:a8:d0:f5","SSID":"xinquhulianw","Level":"-40"},{"MAC":"9e:2b:a6:58:d0:f5","SSID":"","Level":"-40"},{"MAC":"9e:2b:a6:88:d0:f5","SSID":"xinquhulianw","Level":"-41"},{"MAC":"a6:39:b3:64:35:54","SSID":"","Level":"-50"},{"MAC":"10:b1:df:bf:b0:1f","SSID":"HP-Print-1F-LaserJet Pro MFP","Level":"-52"},{"MAC":"a4:39:b3:74:35:55","SSID":"Redmi_B171_5G","Level":"-52"},{"MAC":"16:75:90:04:b9:ca","SSID":"qianjing2","Level":"-56"},{"MAC":"a4:39:b3:74:35:54","SSID":"Redmi_B171","Level":"-58"},{"MAC":"9c:2b:a6:a8:d0:cd","SSID":"xinquhulianw","Level":"-59"}],"code":200,"msg":"success"}

注意

需要打开手机 WIFI 和 定位

输入图片说明

隐私、权限声明

1. 本插件需要申请的系统权限列表:

<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/> <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/> <uses-permission android:name="android.permission.VIBRATE"/> <uses-permission android:name="android.permission.READ_LOGS"/> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> <uses-feature android:name="android.hardware.camera.autofocus"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.CAMERA"/> <uses-permission android:name="android.permission.GET_ACCOUNTS"/> <uses-permission android:name="android.permission.READ_PHONE_STATE"/> <uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-permission android:name="android.permission.FLASHLIGHT"/> <uses-feature android:name="android.hardware.camera"/> <uses-permission android:name="android.permission.WRITE_SETTINGS"/> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不采集任何数据

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

暂无用户评论。

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问