Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The app doesn't work in mobile devices #12

Open
boxw3r opened this issue May 9, 2016 · 16 comments
Open

The app doesn't work in mobile devices #12

boxw3r opened this issue May 9, 2016 · 16 comments

Comments

@boxw3r
Copy link

boxw3r commented May 9, 2016

Hello, I have followed all the installation and configuration steps of the app and I am unable to work with this application on my mobile devices. I have tried with an iPhone 5 and with an Android mobile but the "Start" button and the rest of the elements of the interface just doesn't work. Do you know what am I doing wrong? Or do you know why is this error happening? I am not having any error in the Terminal during the execution of the app with PhoneGap or Cordova, and I have tried both ways.

Thank you so much.

@wouterbulten
Copy link
Owner

When the app loads but the start button doesn't work there is most likely a JS error. Did you get any popup messages? (bluetooth not enabled, etc.)

If not, can you send the console output of the app running on your Android phone? (e.g. using adb logcat) That would help me finding the source of your problem!

@boxw3r
Copy link
Author

boxw3r commented May 13, 2016

Thank you for your answer.
I have tried it on iPhone 5s, iPad Air, two Android smartphones and one Macbook Pro without success. I haven't got any popup or error while running the app in mobile devices. The errors I got were with laptops without Bluetooth 4.0.

I tried it using Phonegap and following the instructions of configuration and installation.

Here is my logcat:
Logcat

Thank you.

@wouterbulten
Copy link
Owner

Thanks!

It seems that there is a problem with Cordova and the screen orientation. Can you run gulp mobile-setup and copy the output here? Just to make sure that all the necessary plugins are installed!

Ps. It wil not work on your MacBook as the app requires access to mobile sensors :)

@boxw3r
Copy link
Author

boxw3r commented May 13, 2016

Now it fails during the build because the android platform was already added.
Maybe it is because "cordova-plugin-background-mode", I had to change its name from "de.appplant.cordova.plugin.background-mode" because the latest one wasn't available in npm.

[12:40:51] Working directory changed to ~/Downloads/slacjs-master
[12:40:54] Using gulpfile ~/Downloads/slacjs-master/gulpfile.js
[12:40:54] Starting 'mobile-resources'...
[12:40:54] Finished 'mobile-resources' after 135 ms
[12:40:54] Starting 'mobile-setup'...
Fetching plugin "cordova-plugin-device-motion" via npm
Plugin "cordova-plugin-device-motion" already installed on android.
Plugin "cordova-plugin-device-motion" already installed on browser.
Fetching plugin "com.randdusing.bluetoothle" via npm
npm WARN deprecated [email protected]: Please use cordova-plugin-bluetoothle as this version is deprecated.
Plugin "com.randdusing.bluetoothle" already installed on android.
Plugin "com.randdusing.bluetoothle" already installed on browser.
Fetching plugin "cordova-plugin-dialogs" via npm
Plugin "cordova-plugin-dialogs" already installed on android.
Plugin "cordova-plugin-dialogs" already installed on browser.
Fetching plugin "cordova-plugin-console" via npm
Plugin "cordova-plugin-console" already installed on android.
Plugin "cordova-plugin-console" already installed on browser.
Fetching plugin "cordova-plugin-device-orientation" via npm
Plugin "cordova-plugin-device-orientation" already installed on android.
Plugin "cordova-plugin-device-orientation" already installed on browser.
Fetching plugin "cordova-plugin-file" via npm
Plugin "cordova-plugin-file" already installed on android.
Plugin "cordova-plugin-file" already installed on browser.
Fetching plugin "cordova-plugin-device" via npm
Plugin "cordova-plugin-device" already installed on android.
Plugin "cordova-plugin-device" already installed on browser.
Fetching plugin "cordova-plugin-screen-orientation" via npm
Plugin "cordova-plugin-screen-orientation" already installed on android.
Plugin "cordova-plugin-screen-orientation" already installed on browser.
Fetching plugin "cordova-plugin-background-mode" via npm
Plugin "cordova-plugin-background-mode" already installed on android.
Plugin "cordova-plugin-background-mode" already installed on browser.
Adding ios project...
Running command: /Users/jaimels9/.cordova/lib/npm_cache/cordova-ios/3.9.2/package/bin/create /Users/jaimels9/Downloads/slacjs-master/mobile/platforms/ios nl.wouterbulten.slacjs "SLACjs App" --cli
iOS project created with [email protected]
Installing "com.randdusing.bluetoothle" for ios
For more info: http://randdusing.com/
Installing "cordova-plugin-background-mode" for ios
Installing "cordova-plugin-device" for ios
Installing "cordova-plugin-compat" for ios
Installing "cordova-plugin-console" for ios
Plugin "cordova-plugin-device" already installed on ios. Making it top-level.
Installing "cordova-plugin-device-motion" for ios
Installing "cordova-plugin-device-orientation" for ios
Installing "cordova-plugin-dialogs" for ios
Installing "cordova-plugin-file" for ios
Dependent plugin "cordova-plugin-compat" already installed on ios.

The Android Persistent storage location now defaults to "Internal". Please check this plugins README to see if you application needs any changes in its config.xml.

If this is a new application no changes are required.

If this is an update to an existing application that did not specify an "AndroidPersistentFileLocation" you may need to add:

  "<preference name="AndroidPersistentFileLocation" value="Compatibility" />"

to config.xml in order for the application to find previously stored files.

Installing "cordova-plugin-screen-orientation" for ios
Error: Platform android already added.
[12:41:44] 'mobile-setup' errored after 50 s
[12:41:44] Error in plugin 'gulp-shell'
Message:
Command cordova platform add android failed with exit code 1

@wouterbulten
Copy link
Owner

Hmm, to bad that didn't work. Can you try one more thing? Maybe that solves your problem. (If not, I will have to do some more debugging)

Comment the following line: https://github.com/wouterbulten/slacjs/blob/master/src/app/app-mobile.js#L58 This disables the screen locking code (which was the only error present in your logcat log).

@boxw3r
Copy link
Author

boxw3r commented May 15, 2016

Commenting this line I have Motion and Compass working but no Bluetooth (unless it is turned on), and the Start, Restart, Pause buttons aren't working.

I have lots of warnings after typing "sudo gulp serve-mobile", in case it can help you to resolve the problem:

[17:55:53] Working directory changed to ~/Downloads/slacjs-master
[17:55:55] Using gulpfile ~/Downloads/slacjs-master/gulpfile.js
[17:55:55] Starting 'lint'...
[17:55:55] Starting 'mobile-vendor'...
[17:55:55] Starting 'mobile-build-js'...
[17:55:55] Starting 'mobile-polyfill'...
[17:55:55] Starting 'mobile-resources'...
[17:55:55] Finished 'mobile-polyfill' after 35 ms

src/app/app-local.js
line 123 col 13 '$' is not defined.
line 129 col 13 '$' is not defined.
line 1 col 8 'SimulatedUser' is defined but never used.

⚠ 3 warnings

src/app/app-mobile.js
line 7 col 10 'degreeToRadian' is defined but never used.
line 40 col 19 '$' is not defined.
line 41 col 19 '$' is not defined.
line 42 col 19 '$' is not defined.
line 43 col 25 '$' is not defined.
line 44 col 24 '$' is not defined.
line 45 col 18 '$' is not defined.
line 47 col 34 '$' is not defined.
line 48 col 35 '$' is not defined.
line 49 col 31 '$' is not defined.
line 51 col 23 '$' is not defined.
line 52 col 23 '$' is not defined.
line 53 col 23 '$' is not defined.
line 54 col 24 '$' is not defined.
line 110 col 13 'cordova' is not defined.
line 111 col 13 'cordova' is not defined.
line 183 col 13 'cordova' is not defined.
line 328 col 34 Operator + should not stick to preceding expression
line 328 col 44 Operator + should not stick to following expression
line 328 col 22 Illegal space after key
line 329 col 19 Illegal space after key
line 329 col 31 Operator + should not stick to preceding expression
line 329 col 41 Operator + should not stick to following expression
line 330 col 18 Illegal space after key
line 330 col 30 Operator + should not stick to preceding expression
line 330 col 40 Operator + should not stick to following expression
line 331 col 36 Operator + should not stick to following expression
line 331 col 3 Extra quotes for key
line 331 col 14 Illegal space after key
line 331 col 26 Operator + should not stick to preceding expression
line 345 col 17 'device' is not defined.

⚠ 31 warnings

src/app/app-replay.js
line 95 col 19 'user' is defined but never used.
line 133 col 59 Missing semicolon.
line 280 col 10 Missing semicolon.
line 78 col 29 'SlacJsData' is not defined.
line 161 col 42 'SlacJsData' is not defined.
line 168 col 22 'SlacJsData' is not defined.
line 195 col 23 'SlacJsData' is not defined.
line 65 col 62 'SlacJsLandmarkPositions' is not defined.
line 147 col 24 'SlacJsLandmarkPositions' is not defined.
line 215 col 27 'SlacJsLandmarkPositions' is not defined.
line 81 col 47 'SlacJsStartingPosition' is not defined.
line 82 col 47 'SlacJsStartingPosition' is not defined.
line 226 col 13 '$' is not defined.
line 237 col 13 '$' is not defined.
line 252 col 23 'Highcharts' is not defined.

⚠ 15 warnings

src/app/config.js
line 104 col 3 Extra quotes for key
line 108 col 3 Extra quotes for key
line 112 col 3 Extra quotes for key
line 116 col 3 Extra quotes for key
line 120 col 3 Extra quotes for key
line 124 col 3 Extra quotes for key
line 128 col 3 Extra quotes for key

⚠ 7 warnings

src/app/slac-controller.js
line 156 col 53 Missing semicolon.

⚠ 1 warning

src/app/device/data-storage.js
line 9 col 1 Expected indentation of 1 characters
line 11 col 1 Expected indentation of 1 characters
line 14 col 1 Expected indentation of 1 characters
line 15 col 24 Invalid quote mark found
line 15 col 2 Expected indentation of 2 characters
line 16 col 49 Missing '()' invoking a constructor.
line 16 col 66 Invalid quote mark found
line 16 col 24 Invalid quote mark found
line 16 col 2 Expected indentation of 2 characters
line 17 col 3 Expected indentation of 3 characters
line 17 col 28 Invalid quote mark found
line 19 col 3 Expected indentation of 3 characters
line 21 col 4 Expected indentation of 4 characters
line 22 col 4 Expected indentation of 4 characters
line 23 col 4 Expected indentation of 4 characters
line 23 col 32 Invalid quote mark found
line 25 col 4 Expected indentation of 4 characters
line 32 col 3 Expected indentation of 3 characters
line 32 col 17 Missing newline after block
line 33 col 4 Expected indentation of 4 characters
line 37 col 30 Missing semicolon.
line 38 col 3 Expected indentation of 3 characters
line 39 col 2 Expected indentation of 2 characters
line 40 col 1 Expected indentation of 1 characters
line 40 col 9 Missing newline after block
line 41 col 2 Expected indentation of 2 characters
line 45 col 22 Missing semicolon.
line 46 col 1 Expected indentation of 1 characters
line 56 col 1 Expected indentation of 1 characters
line 59 col 16 'device' is not defined.
line 59 col 1 Expected indentation of 1 characters
line 59 col 14 One space required after "switch" keyword
line 60 col 2 Expected indentation of 2 characters
line 60 col 17 Invalid quote mark found
line 61 col 24 'cordova' is not defined.
line 61 col 3 Expected indentation of 3 characters
line 63 col 2 Expected indentation of 2 characters
line 63 col 17 Invalid quote mark found
line 64 col 17 Invalid quote mark found
line 64 col 2 Expected indentation of 2 characters
line 65 col 24 'cordova' is not defined.
line 65 col 3 Expected indentation of 3 characters
line 67 col 2 Expected indentation of 2 characters
line 68 col 3 Expected indentation of 3 characters
line 69 col 63 'device' is not defined.
line 72 col 30 Missing semicolon.
line 73 col 3 Expected indentation of 3 characters
line 74 col 1 Expected indentation of 1 characters

⚠ 48 warnings

[17:55:57] Finished 'mobile-vendor' after 1.79 s

src/app/models/landmark-init-set.js
line 20 col 47 'nParticles' is not defined.

⚠ 1 warning

src/app/models/particle-set.js
line 51 col 47 Missing semicolon.
line 47 col 29 'name' is defined but never used.

⚠ 2 warnings

src/app/models/sensor.js
line 17 col 84 It's not necessary to initialize 'Q' to 'undefined'.
line 17 col 72 Unexpected token =

⚠ 2 warnings

src/app/models/user.js
line 1 col 28 'meanHeading' is defined but never used.

⚠ 1 warning

src/app/simulation/landmark.js
line 66 col 53 Missing semicolon.

⚠ 1 warning

src/app/simulation/user.js
line 101 col 50 Line comments must be preceded with a blank line

⚠ 1 warning

src/app/util/kalman.js
line 12 col 17 Unexpected token =

⚠ 1 warning

src/app/util/motion.js
line 76 col 2 Missing newline after block

⚠ 1 warning

src/app/view/base-renderer.js
line 48 col 3 Missing newline after block
line 132 col 24 Invalid quote mark found

⚠ 2 warnings

src/app/view/landmark-activity-panel.js
line 6 col 1 Expected indentation of 1 characters
line 8 col 9 '$' is not defined.
line 8 col 1 Expected indentation of 1 characters
line 10 col 24 '$' is not defined.
line 10 col 1 Expected indentation of 1 characters
line 13 col 36 'msg' is defined but never used.
line 15 col 10 One space required after "if" keyword
line 15 col 1 Expected indentation of 1 characters
line 16 col 2 Expected indentation of 2 characters
line 17 col 1 Expected indentation of 1 characters
line 19 col 1 Expected indentation of 1 characters
line 21 col 1 Expected indentation of 1 characters
line 23 col 1 Expected indentation of 1 characters
line 23 col 10 One space required after "if" keyword
line 24 col 2 Expected indentation of 2 characters
line 25 col 1 Expected indentation of 1 characters
line 27 col 1 Expected indentation of 1 characters
line 32 col 1 Expected indentation of 1 characters
line 33 col 2 Expected indentation of 2 characters
line 34 col 2 Expected indentation of 2 characters
line 35 col 2 Expected indentation of 2 characters
line 37 col 2 Expected indentation of 2 characters
line 38 col 2 Expected indentation of 2 characters
line 39 col 2 Expected indentation of 2 characters
line 40 col 2 Expected indentation of 2 characters
line 41 col 1 Expected indentation of 1 characters
line 45 col 29 Invalid quote mark found
line 45 col 1 Expected indentation of 1 characters
line 45 col 9 '$' is not defined.
line 46 col 1 Expected indentation of 1 characters
line 51 col 1 Expected indentation of 1 characters
line 52 col 1 Expected indentation of 1 characters
line 54 col 1 Expected indentation of 1 characters
line 54 col 9 '$' is not defined.
line 72 col 1 Expected indentation of 1 characters
line 73 col 2 Expected indentation of 2 characters
line 74 col 2 Expected indentation of 2 characters
line 75 col 2 Expected indentation of 2 characters
line 76 col 22 '$' is not defined.
line 76 col 2 Expected indentation of 2 characters
line 77 col 2 Expected indentation of 2 characters
line 78 col 2 Expected indentation of 2 characters
line 79 col 2 Expected indentation of 2 characters
line 80 col 2 Expected indentation of 2 characters
line 80 col 22 Extra comma following the final element of an array or object literal
line 81 col 1 Expected indentation of 1 characters
line 91 col 1 Expected indentation of 1 characters

⚠ 47 warnings

src/app/view/particle-renderer.js
line 68 col 45 'theta' is defined but never used.
line 100 col 45 'theta' is defined but never used.

⚠ 2 warnings

[17:56:02] Finished 'mobile-build-js' after 6.92 s
[17:56:02] Finished 'lint' after 7.38 s
[17:56:02] Finished 'mobile-resources' after 6.95 s
[17:56:02] Starting 'mobile'...
[17:56:02] Finished 'mobile' after 25 μs
[17:56:02] Starting 'serve-mobile'...
[17:56:02] Finished 'serve-mobile' after 64 ms

Thank you.

@ngamulin
Copy link

ngamulin commented Jun 3, 2016

I have also tried to run on android and iOS and didn't work. @wouterbulten do you know what else could cause the problem?

@wouterbulten
Copy link
Owner

wouterbulten commented Jun 3, 2016

Sorry for my late responses; unfortunately my (free) time is limited right now.

All those warnings are from the js linting, so nothing to worry about. They just give an indication of violations of the Airbnb js style guide.

@ngamulin @jaimels9 does the local version of the algorithm work? I.e. can you run gulp serve and view the demo in your browsers? It should open automatically (something like localhost:3000). If that works then something is wrong with the hardware related parts of the app (connection with cordova, bluetooth, etc.) and not with the core algorithm itself.

@boxw3r
Copy link
Author

boxw3r commented Jun 3, 2016

Yes, I can run this command without problem in my computer and the program works successfully. Maybe the error is in the cordova part...

@wouterbulten
Copy link
Owner

@jaimels9 what did you mean with your comment some time ago regarding

working but no Bluetooth (unless it is turned on)

You must turn Bluetooth on before you open the app; if bluetooth is disabled it should give you a small alert telling you to turn bluetooth on.

@boxw3r
Copy link
Author

boxw3r commented Jun 3, 2016

@wouterbulten yes, I had the app working in the mobile and the Bluetooth was turned on, but the app said it was disabled.

@ngamulin
Copy link

ngamulin commented Jun 7, 2016

@jaimels9 @wouterbulten I managed to solve bluetooth issues by fixing the address of Cordova Bluetooth LE Plugin in config.js (line 59): replace 'com.randdusing.bluetoothle' with 'cordova-plugin-bluetoothle'.

As the plugin requires newer cordova versions for Android and iOS, go to mobile folder and run the following commands:

cordova platform update [email protected]
cordova platform update [email protected]

The bluetooth error doesn't appear anymore and the values x, y, z, and heading are changing in phonegap UI running on mobile device. The window in which points are supposed to appear remains blank when i press start button. Is there any other known issue or setting that has to be modified in order to fix it? The local version runs without problems.

@wouterbulten
Copy link
Owner

@ngamulin very nice! I knew the original BLE plugin was deprecated, but it should have worked with the original cordova version. Nonetheless, this is a good change. Would you be able to do a pull request? Then I'll review/test it and then merge your changes.

Regarding the empty screen: This is probably caused by the device filter. The app filters bluetooth devices (so that you only use your own landmarks). You will probably use other devices names than the default. So you have two options:

Btw, if you want more info about the algorithm itself. There is a paper available here: http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=7471364

@ngamulin
Copy link

ngamulin commented Jun 7, 2016

thanks @wouterbulten Actually I have first read the article and there got the repository address. Excellent work!

I will pull the project and commit changes.

@ngamulin
Copy link

ngamulin commented Jun 7, 2016

@wouterbulten As configuration/filter removal didn't work, I tried to go through the code and noticed that that the call of fuction initRadio() in bluetooth.js doesn't initialize the radio.

@wouterbulten
Copy link
Owner

It will take a few days before I can fully look in to this and try out the new version of the BLE plugin myself. In the meantime, it seems that the signature of the initialise function has changed. The new signature:

bluetoothle.initialize(initializeResult, params);

The docs are however inconsistent about this in some parts (the examples still show the 3 parameter version). Following this issue the above should be the new correct one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants