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

Extract java library for the data-collection #193

Open
TheoAk opened this issue Jul 28, 2021 · 5 comments
Open

Extract java library for the data-collection #193

TheoAk opened this issue Jul 28, 2021 · 5 comments

Comments

@TheoAk
Copy link

TheoAk commented Jul 28, 2021

Hello,

I'm the intern working in Lyon.
I tried to analyse this repository you send me to create an external library to use with our app but I did not understand where the functions are called in the application.
Could you tell me the steps to extract the android part or how the functions are called and used in the app ?

Thank you

@shankari
Copy link
Contributor

@TheoAk this is a cordova plugin (sort of like a flutter plugin, but older). The interface is defined in
https://github.com/e-mission/e-mission-data-collection/blob/master/src/android/DataCollectionPlugin.java

It is called from the javascript in the phone UI code - e.g. markConsented is called here
https://github.com/e-mission/e-mission-phone/blob/3caed98bd8f6843d7311fdd48e00f9b376ce91f0/www/js/splash/startprefs.js#L32

What are you writing your app in?

Also, as I pointed out, you don't need to write a separate app to test out various settings, you can set them directly from the core phone UI (Profile -> Developer Zone). We might want to have a short chat to orient you with the phone architecture to make the most efficient use of your time.

@shankari
Copy link
Contributor

What are you writing your app in?

If the answer is "java", then @ericafenyo from Transway has packaged this as a library and built a native app.
Please see e-mission/e-mission-docs#621 (comment) for some indications of how he accomplished that.

@TheoAk
Copy link
Author

TheoAk commented Aug 3, 2021

Thank you for the clarifications.

Cozy is creating an app (in React Native) with many features and this library based on this repo could be used with the app to have a start of tracking user's trips.

@shankari
Copy link
Contributor

shankari commented Aug 3, 2021

@TheoAk

The interface to this plugin is currently defined in
https://github.com/e-mission/e-mission-data-collection/blob/master/www/datacollection.js

It is implemented in android at
https://github.com/e-mission/e-mission-data-collection/blob/master/src/android/DataCollectionPlugin.java

and on iOS at
https://github.com/e-mission/e-mission-data-collection/blob/master/src/ios/BEMDataCollection.m

This implementation is for cordova.

You should be able to re-implement the interface in React Native, and then you can use the plugin.
Or maybe this is useful?
https://www.npmjs.com/package/react-native-cordova-plugin

@shankari
Copy link
Contributor

shankari commented Aug 4, 2021

@TheoAk I should point out that this plugin is fairly tightly coupled with other plugins to cache the data locally. In particular, the code to determine whether we need to turn off tracking reads data from the local cache to see how much we have moved recently. You should look at the other plugins under the e-mission-phone repo as well.

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

2 participants