-2

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
31piy
  • 23,323
  • 6
  • 47
  • 67

1 Answers1

0

seems to be a solution because it is composed of javascript

This is Java. Java and JavaScript are completely different programming languages.

Even if it was written in JavaScript, it would probably call APIs that are supplied by Cordova and not by web browsers.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • Thank you for your answer, Quentin. I also asumed that there would be an api to run plugins javascript or something also. But if you see the apk file, plugins is converted to "cordovaWifiInfo.js". So I thought the javascript in plugin folder are the same as the native java code, cordovaWifiInfo.java. assets\www\plugins\org.apache.cordova.wifiinfo\www\cordovaWifiInfo.js – Soondae Gukbap Mar 16 '18 at 01:02