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

openScale cordova plugin #119

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

openScale cordova plugin #119

wants to merge 4 commits into from

Conversation

oliexdev
Copy link

@oliexdev oliexdev commented Jan 6, 2019

I created an openScale cordova plugin to exchange the weights and calories data between waistline and openScale, see issue #71.

Note: Currently, it works only with the latest openScale development version, which you can find here. Then you have to enable the 3rd party access in openScale (under Settings->General).

On the waistline startup the user is asked to grant permission to read/write from/to openScale data.
If the user granted the permission then the calories from waistline with their corresponded timestamp is exported to openScale and all weights from openScale with their corresponded timestamps are imported to waistline.

Note: Currently, it is not really written to the waistline database (only printed out on the console; since you know your code better, I will let it by you how you handle the incoming data) also in openScale the data is not really written to the openScale database (I need to add another field for calories first). Edit: implemented it with commit oliexdev/openScale@ed60b24

Some things we may have to discuss:

  • openScale is designed for multiple users. Do you also plan to extend waistline for multiply users? If not which users from openScale should be imported? (Currently all openScale users with their weight data are imported)
  • The reference which I used to match with your waistline data is the timestamp on the day basis. If no weight is logged on that day in openScale, I ignore incoming waistline data. If I have multiple measurements on the same days, I use the first one to store the calories. You could do the same with the weight if you want!? (you have to ignore then the hours, minutes and seconds from the openScale timestamps)
  • I think it is cleaner to move the openScale function in the app.js to another file/function, which I'm gonna to leave it to you.
  • an openScale API check is currently not implemented
  • this PR could be also a solution for issue Multiple suggestions (Body fat measurement) #49

So some things still have to be done but let me hear what do your think?

Note: If you change something in the Android plugin you have to remove and add the plugin again to the project otherwise the plugin isn't compiled. You can do it with the following command:
cordova plugin rm openscale && cordova plugin add android_plugins/openscale/ && cordova run android

@davidhealey
Copy link
Owner

Thanks, this sounds very good. I'll check out the code soon and get back to you.

@yarons
Copy link
Collaborator

yarons commented Jan 6, 2019

Wow @oliexdev ! You did an amazing job! Thank you so much!

@davidhealey
Copy link
Owner

davidhealey commented Jan 6, 2019

I'm getting this in the console when I launch the app. I don't think the request for permission or the import/export of data should be part of the app initialization. I think this would be better in the settings menu.

@oliexdev
Copy link
Author

oliexdev commented Jan 7, 2019

can you give more information? Did you use the latest openScale dev version? How do you launch the waistline app? In the browser? On a smartphone or on a emulator?

@davidhealey
Copy link
Owner

I'm testing in Firefox. I haven't tried it on my phone yet, I don't use OpenScale so don't know anything about how it works.

@oliexdev
Copy link
Author

oliexdev commented Jan 7, 2019

Well, it is an Android plugin so it doesn't work if you run it with your Firefox. Please run it on your Android smartphone and use the latest openScale development version and openScale should be really self explained, it is not rocket science ;)

@davidhealey
Copy link
Owner

Well I do all my dev work in the browser so I'll see if can disable it when using that platform. I'll also want to make sure it's disabled by default on Android for users (like me) who don't use OpenScale or maybe there is a way to detect if OpenScale is installed and automatically activate the plugin. Anyway I'll give it a go on my phone and report back.

@davidhealey
Copy link
Owner

davidhealey commented Jan 7, 2019

I've installed the latest dev version of OpenScale and enabled 3rd party access, I also added some data to OpenScale. I then ran Waistline. I wasn't prompted to provide any permissions for OpenScale (maybe it only works with fresh installs of Waistline?)

I've pasted the logcat output below.


01-07 20:04:44.505 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 155 : App Initialized
01-07 20:04:44.506 22373 22373 I chromium: [INFO:CONSOLE(155)] "App Initialized", source: file:///android_asset/www/js/app.js (155)
01-07 20:04:44.508  1336  2684 I ActivityManager: START u0 {act=android.content.pm.action.REQUEST_PERMISSIONS pkg=com.android.packageinstaller cmp=com.android.packageinstaller/.permission.ui.GrantPermissionsActivity (has extras)} from uid 10160 on display 0
01-07 20:04:44.509 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 157 : openScale Initializing
01-07 20:04:44.509 22373 22373 I chromium: [INFO:CONSOLE(157)] "openScale Initializing", source: file:///android_asset/www/js/app.js (157)
01-07 20:04:44.514 22373 22373 D CordovaActivity: Paused the activity.
01-07 20:04:44.521 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137712
01-07 20:04:44.521 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:44.525 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137713
01-07 20:04:44.525 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:44.559 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 134 : openScale permission denied, please request first the openScale permission
01-07 20:04:44.560 22373 22373 I chromium: [INFO:CONSOLE(134)] "openScale permission denied, please request first the openScale permission", source: file:///android_asset/www/js/app.js (134)
01-07 20:04:44.561 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 146 : error importing openScale data to waistline (openScale permission denied, please request first the openScale permission)
01-07 20:04:44.561 22373 22373 I chromium: [INFO:CONSOLE(146)] "error importing openScale data to waistline (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (146)
01-07 20:04:44.594 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137714
01-07 20:04:44.594 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:44.598 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:44.598 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:44.615  1336  4108 W InputMethodManagerService: Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@aeedc27 attribute=null, token = android.os.BinderProxy@902e9d1
01-07 20:04:44.634 22373 22373 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137712
01-07 20:04:44.634 22373 22373 W CordovaPlugin: Result was: "openScale permission denied"
01-07 20:04:44.643 22373 22373 D CordovaActivity: Resumed the activity.
01-07 20:04:44.645  1336  1357 E Notification: setLatestEventInfo() is deprecated and you should feel deprecated.
01-07 20:04:44.645  1336  1357 E Notification: java.lang.Throwable
01-07 20:04:44.645  1336  1357 E Notification: 	at android.app.Notification.setLatestEventInfo(Notification.java:2084)
01-07 20:04:44.645  1336  1357 E Notification: 	at com.android.server.am.ActivityManagerService$MainHandler.handleMessage(ActivityManagerService.java:2367)
01-07 20:04:44.645  1336  1357 E Notification: 	at android.os.Handler.dispatchMessage(Handler.java:102)
01-07 20:04:44.645  1336  1357 E Notification: 	at android.os.Looper.loop(Looper.java:154)
01-07 20:04:44.645  1336  1357 E Notification: 	at android.os.HandlerThread.run(HandlerThread.java:61)
01-07 20:04:44.645  1336  1357 E Notification: 	at com.android.server.ServiceThread.run(ServiceThread.java:46)
01-07 20:04:44.726   286   286 I MSM-irqbalance: Decided to move IRQ240 from CPU6 to CPU4
01-07 20:04:44.851 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137715
01-07 20:04:44.851 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:44.854 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:44.854 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:44.903 22373 22422 E AndroidProtocolHandler: Unable to open asset URL: file:///android_asset/www/locales/locale-en-GB.json
01-07 20:04:45.039 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137716
01-07 20:04:45.039 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.065 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137717
01-07 20:04:45.065 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.077 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137718
01-07 20:04:45.077 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.088 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137719
01-07 20:04:45.088 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.088 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.089 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.092 22373 22373 D SystemWebChromeClient: file:///android_asset/www/index.html: Line 1 : Uncaught SyntaxError: Unexpected end of JSON input
01-07 20:04:45.092 22373 22373 I chromium: [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected end of JSON input", source: file:///android_asset/www/index.html (1)
01-07 20:04:45.095 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.096 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.098 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.098 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.103 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.105 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.131 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137720
01-07 20:04:45.131 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.134 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.134 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.139 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137721
01-07 20:04:45.139 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.145 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137722
01-07 20:04:45.145 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.148 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.148 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.149 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.150 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.159 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137723
01-07 20:04:45.159 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.163 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.164 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.166 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137724
01-07 20:04:45.166 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.171 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.171 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.173 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137725
01-07 20:04:45.173 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.177 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.177 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.187 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137726
01-07 20:04:45.187 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.190 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.190 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.191 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137727
01-07 20:04:45.191 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.194 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.194 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.196 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137728
01-07 20:04:45.196 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.199 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.199 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.202 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137729
01-07 20:04:45.202 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.205 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.205 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.207 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137730
01-07 20:04:45.207 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.209 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.210 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.211 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137731
01-07 20:04:45.211 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.213 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.214 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.216 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137732
01-07 20:04:45.216 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.218 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.218 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.219 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137733
01-07 20:04:45.219 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.222 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.222 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.223 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137734
01-07 20:04:45.223 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.226 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.226 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.228 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137735
01-07 20:04:45.228 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.230 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.231 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.232 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137736
01-07 20:04:45.232 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.236 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.236 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.237 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137737
01-07 20:04:45.237 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.240 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.240 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.243 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137738
01-07 20:04:45.243 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.246 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.246 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.254 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137739
01-07 20:04:45.254 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.257 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.257 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.259 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137740
01-07 20:04:45.259 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.261 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.261 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.262 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137741
01-07 20:04:45.262 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.265 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.265 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.266 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137742
01-07 20:04:45.266 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.268 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.269 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.270 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137743
01-07 20:04:45.270 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.272 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.272 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.274 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137744
01-07 20:04:45.274 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.276 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.276 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.278 22373 22429 W CordovaPlugin: Attempted to send a second callback for ID: openscale236137745
01-07 20:04:45.278 22373 22429 W CordovaPlugin: Result was: "Invalid action"
01-07 20:04:45.281 22373 22373 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 140 : error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)
01-07 20:04:45.281 22373 22373 I chromium: [INFO:CONSOLE(140)] "error exporting waistline data to openScale (openScale permission denied, please request first the openScale permission)", source: file:///android_asset/www/js/app.js (140)
01-07 20:04:45.665 12276 22437 W btri    : [{0}] Failed to resolve name. status={1}

@oliexdev
Copy link
Author

oliexdev commented Jan 7, 2019

I don't know, normally you don't need a fresh waistline installation on every start. With requestOpenScalePermission the permission is checked. If the permission is not already granted it will be requested. On my phone its works ...

@davidhealey
Copy link
Owner

Did you change your default homepage? Maybe that's affecting it

@oliexdev
Copy link
Author

oliexdev commented Jan 7, 2019

no I run waistline on the smartphone with the command cordova plugin rm openscale && cordova plugin add android_plugins/openscale/ && cordova run android

@davidhealey
Copy link
Owner

I just ran Waistline using your command and unfortunately I'm experiencing the same issue. I noticed this in the console which I think is a little different to last time

01-07 23:17:01.719 25736 25736 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 157 : openScale Initializing 01-07 23:17:01.719 25736 25736 I chromium: [INFO:CONSOLE(157)] "openScale Initializing", source: file:///android_asset/www/js/app.js (157) 01-07 23:17:01.721 1336 4140 I ActivityManager: START u0 {act=android.content.pm.action.REQUEST_PERMISSIONS pkg=com.android.packageinstaller cmp=com.android.packageinstaller/.permission.ui.GrantPermissionsActivity (has extras)} from uid 10160 on display 0 01-07 23:17:01.727 25736 25736 D CordovaActivity: Paused the activity. 01-07 23:17:01.730 25736 25796 W CordovaPlugin: Attempted to send a second callback for ID: openscale403308476 01-07 23:17:01.730 25736 25796 W CordovaPlugin: Result was: "Invalid action" 01-07 23:17:01.737 25736 25796 W CordovaPlugin: Attempted to send a second callback for ID: openscale403308477 01-07 23:17:01.737 25736 25796 W CordovaPlugin: Result was: "Invalid action" 01-07 23:17:01.769 25736 25736 D SystemWebChromeClient: file:///android_asset/www/js/app.js: Line 134 : openScale permission denied, please request first the openScale permission 01-07 23:17:01.770 25736 25736 I chromium: [INFO:CONSOLE(134)] "openScale permission denied, please request first the openScale permission", source: file:///android_asset/www/js/app.js (134)

@oliexdev
Copy link
Author

oliexdev commented Jan 8, 2019

hmmm.... but it looks like the permission request was started with:
157) 01-07 23:17:01.721 1336 4140 I ActivityManager: START u0 {act=android.content.pm.action.REQUEST_PERMISSIONS pkg=com.android.packageinstaller cmp=com.android.packageinstaller/.permission.ui.GrantPermissionsActivity (has extras)} from

Do you test it on a real smartphone not in an emulator?

You can also manual enable the permission in Android under settings->apps->waistline->permission

@davidhealey
Copy link
Owner

Yes I test on my Xiaomi Mi4i running LineageOS. I'll try manually enabling and report back

@davidhealey
Copy link
Owner

That permission isn't showing up for me in the settings

@oliexdev
Copy link
Author

oliexdev commented Jan 9, 2019

I don't know LineageOS but it looks like you have an old smartphone with an old Android version.
The runtime permission works only at Android >= 6.0. Please read https://developer.android.com/training/permissions/requesting

@davidhealey
Copy link
Owner

Lineage used to be called Cyanogen. The version I use is Android 7.1.2. I think we could do with some more people to test this on different devices and see what's happening.

@oliexdev
Copy link
Author

oliexdev commented Jan 9, 2019

Then I don't know why you don't get the permission request!?

@davidhealey
Copy link
Owner

Indeed it's very strange

@casch-at
Copy link

Hey @oliexdev @davidhealey!

Thanks for your work! I'm open to test it. I'm using openScale for a while and just discovered waistline. I installed the dev version of openScale. How do I build waistline?

@davidhealey
Copy link
Owner

Hey @oliexdev @davidhealey!

Thanks for your work! I'm open to test it. I'm using openScale for a while and just discovered waistline. I installed the dev version of openScale. How do I build waistline?

Hi,

There are some build instructions here - #90

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

Successfully merging this pull request may close these issues.

None yet

4 participants