Is it possible that Cordova plugin run on apache webserver?

206
March 15, 2018, at 5:51 PM

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
Answer 1

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.

Rent Charter Buses Company
READ ALSO
Why I need add the `Authorization` in the request header when access the APIs?

Why I need add the `Authorization` in the request header when access the APIs?

I use the Python/Django write the backend, use Django-Rest-Framework write the APIs, I also used the rest_auth, allauth, see my settingspy:

190
formData image attribute file issue

formData image attribute file issue

I'm sending an image attribute file by ajax callBut having problems on getting that file in image attribute array in formData

266
Get selected text position inside div and persist

Get selected text position inside div and persist

I am trying to get the position of the selected text, replace it with some HTML and then I want to persist the position of the selected text, so that the next time I render the html I want to show the highlight on the selected text

308
How to limit copying from electron app to certain word length?

How to limit copying from electron app to certain word length?

I have an electron app with some data which I want to protect from being copiedI'm aware that there can't be 100% safety but the users will be not be techies, so a simple solution will do it

223