I am trying to get the BSSID of an android phone which connected to a website. I found some information about getting BSSID using javascript, and the answer is it is impossible unless I made native code or plugin.
I know it is kind of weird, but Cordova plugin, PhoneGap-WifiInfoPlugin, seems to be a solution because it is composed of javascript. So I built and inspected the structure of the apk file and, all files in assets/www/
folder seem like working on apache.
So I placed all files and folders (index.html
, cordova.js
, cordova-js.src
...) in Apache/htdocs
folder, and connected to index.html
via chrome browser on an android emulator. But plugin did not work and wifi.lan
always returned empty object, {}
. On the other hand, Cordova webview application works well and show bssid on the emulator. So plugin has no err.
I noticed that nativeApiProvider
in cordova.js
is empty, and require('cordova/android/nativeapiprovider')
is not working.
I tried to load all javascripts by html tag <script src="XXXX">
in index.html
and completed loading JavaScript. But it did not work again.
Is there any way to use cordova plugin on web server or I have to find another way?
The below is the log of access.log
history:
127.0.0.1 - - [15/Mar/2018:15:09:02 +0900] "GET /index.html HTTP/1.1" 200 3225
127.0.0.1 - - [15/Mar/2018:15:09:02 +0900] "GET /js/jquery-1.12.3.js HTTP/1.1" 200 293650
127.0.0.1 - - [15/Mar/2018:15:09:02 +0900] "GET /cordova.js HTTP/1.1" 200 73303
127.0.0.1 - - [15/Mar/2018:15:09:12 +0900] "GET /js/index.js HTTP/1.1" 200 1664
127.0.0.1 - - [15/Mar/2018:15:09:12 +0900] "GET /cordova_plugins.js HTTP/1.1" 200 465
127.0.0.1 - - [15/Mar/2018:15:09:12 +0900] "GET /js/ni.js HTTP/1.1" 200 79
127.0.0.1 - - [15/Mar/2018:15:09:12 +0900] "GET /plugins/org.apache.cordova.wifiinfo/www/cordovaWifiInfo.js HTTP/1.1" 200 1390
127.0.0.1 - - [15/Mar/2018:15:09:12 +0900] "GET /cordova-js-src/exec.js HTTP/1.1" 200 11143
127.0.0.1 - - [15/Mar/2018:15:09:20 +0900] "GET /cordova-js-src/platform.js HTTP/1.1" 200 4924
127.0.0.1 - - [15/Mar/2018:15:09:20 +0900] "GET /cordova-js-src/android/nativeapiprovider.js HTTP/1.1" 200 1322
127.0.0.1 - - [15/Mar/2018:15:09:20 +0900] "GET /cordova-js-src/android/promptbasednativeapi.js HTTP/1.1" 200 1441
127.0.0.1 - - [15/Mar/2018:15:09:20 +0900] "GET /cordova-js-src/plugin/android/app.js HTTP/1.1" 200 4005