Changes

Jump to navigation Jump to search
m
Line 1: Line 1: −
This page contains notes regarding the development of the Open Food Facts mobile apps.
+
This page contains notes regarding the development of the Open Food Facts mobile apps (Cordova version).<br><br>
 +
[https://github.com/openfoodfacts/cordova-app Source code]<br><br>
    
The current Open Food Facts apps for iOS, Android and Windows Phone use Apache Cordova (previously known as Phonegap).
 
The current Open Food Facts apps for iOS, Android and Windows Phone use Apache Cordova (previously known as Phonegap).
   −
Cordova: http://cordova.apache.org/
+
== Installing Cordova on your machine ==
 
+
* Cordova: http://cordova.apache.org/
Installing Cordova 3.6 : http://cordova.apache.org/docs/en/3.6.0/guide_overview_index.md.html
+
* Installing Cordova 3.6 : http://cordova.apache.org/docs/en/3.6.0/guide_overview_index.md.html
 
+
* http://cordova.apache.org/docs/en/3.6.0/guide_cli_index.md.html#The%20Command-Line%20Interface
http://cordova.apache.org/docs/en/3.6.0/guide_cli_index.md.html#The%20Command-Line%20Interface
+
* Following notes are for the Windows Platform, but most of it probably applies for Mac or Linux.
 
  −
Following notes are for the Windows Platform, but most of it probably applies for Mac or Linux.
      +
== Installing Node.js ==
 
Install Node.js
 
Install Node.js
   Line 16: Line 16:  
* Current Version: v0.10.32
 
* Current Version: v0.10.32
   −
Install git client
+
== Install Git client ==
    
* http://git-scm.com/
 
* http://git-scm.com/
   −
Install Cordova
+
== Install Cordova ==
    
in git-bash client:
 
in git-bash client:
   −
* npm install -g cordova
+
<pre>npm install -g cordova</pre>
   −
cordova -v : 3.6.3-0.2.13
+
<pre>cordova -v : 3.6.3-0.2.13</pre>
 +
 
 +
Use cordova platform to know which platform you can install.
 +
<pre>cordova platform</pre>
 +
Install your platforms
 +
<pre>
 +
cordova platform add firefoxos
 +
cordova platform add android
 +
</pre>
 +
 
 +
=== Possible errors ===
 +
 
 +
==== "error android_home is not set and android command not in your path" when doing "cordova platform add android" ====
   −
* "error android_home is not set and android command not in your path" when doing "cordova platform add android"
   
**Install Eclipse ADT  (Note : for win8 32bit/64bit install 32bit ADT)
 
**Install Eclipse ADT  (Note : for win8 32bit/64bit install 32bit ADT)
 
**Setup Environment Variables :
 
**Setup Environment Variables :
Line 36: Line 47:  
*** C:\Users\Stéphane\AppData\Roaming\npm;C:\Users\Stéphane\AppData\Local\Android\android-sdk\tools;C:\Users\Stéphane\AppData\Local\Android\android-sdk\tools;C:\Users\Stéphane\AppData\Local\Android\android-sdk\platform-tools
 
*** C:\Users\Stéphane\AppData\Roaming\npm;C:\Users\Stéphane\AppData\Local\Android\android-sdk\tools;C:\Users\Stéphane\AppData\Local\Android\android-sdk\tools;C:\Users\Stéphane\AppData\Local\Android\android-sdk\platform-tools
   −
"error failed to run javac -version make sure"
+
===="error failed to run javac -version make sure" ====
    
Java JDK
 
Java JDK
Line 51: Line 62:     
which java
 
which java
--> un vieux java dans C:\Windows\System32 était la cause du problème.. :-(
+
--> an old version of java in C:\Windows\System32 was causing the issue.. :-(
    
http://stackoverflow.com/questions/24493693/cordova-android-revision-to-low
 
http://stackoverflow.com/questions/24493693/cordova-android-revision-to-low
Line 57: Line 68:  
Run SDK Manager, install Android build tools.
 
Run SDK Manager, install Android build tools.
   −
== android version code ==
+
== Get the source code ==
 +
 
 +
Clone the Open Food Facts Cordova repository
 +
<pre>git clone https://github.com/openfoodfacts/cordova-app.git</pre>
 +
 
 +
== iOS specific issues ==
    +
== Android specific issues ==
 +
=== Android version code ===
 
in config.xml : http://stackoverflow.com/questions/23001780/how-to-get-cordova-3-4-0-to-set-android-version-name-code-on-build
 
in config.xml : http://stackoverflow.com/questions/23001780/how-to-get-cordova-3-4-0-to-set-android-version-name-code-on-build
    +
== Cordova plugins ==
 +
 +
* http://plugins.cordova.io/#/package/com.phonegap.plugins.barcodescanner
 +
 +
=== Camera, File, File transfer plugins ===
 +
Install the various plugins
 +
<pre>
 +
cordova plugin add org.apache.cordova.camera
 +
cordova plugin add org.apache.cordova.file
 +
cordova plugin add org.apache.cordova.file-transfer
 +
</pre>
 +
 +
New names for plugins:
 +
 +
<pre>
 +
biz_000@Colibri MINGW64 ~/Desktop/cordova-app (master)
 +
$ cordova -v
 +
6.4.0
 +
 +
biz_000@Colibri MINGW64 ~/Desktop/cordova-app (master)
 +
$ cordova plugins
 +
cordova-plugin-barcodescanner 0.7.0 "BarcodeScanner"
 +
cordova-plugin-camera 2.3.0 "Camera"
 +
cordova-plugin-compat 1.0.0 "Compat"
 +
cordova-plugin-file 4.3.0 "File"
 +
cordova-plugin-file-transfer 1.6.0 "File Transfer"
 +
cordova-plugin-whitelist 1.3.0 "Whitelist"
 +
 +
</pre>
 +
 +
=== Barcode scanning plugin ===
 +
You may also have to install Apache Cordova plugin for barcode scanning.
 +
<pre>
 +
cordova plugin add com.phonegap.plugins.barcodescanner
 +
</pre>
   −
=== Install Moodstocks ===
+
=== Moodstocks ===
 +
==== Install Moodstocks ====
    
* https://moodstocks.com/docs/phonegap/using-the-moodstocks-sdk-in-your-phonegap-application/
 
* https://moodstocks.com/docs/phonegap/using-the-moodstocks-sdk-in-your-phonegap-application/
   −
Instructions pas à jour pour cordova 3.6 on dirait, par contre il y a un autre example :
+
Instructions not up to date for Cordova 3.6. This might be an up to date example :
    
* https://github.com/Moodstocks/moodstocks-phonegap-plugin/blob/master/src/android/Demo.java
 
* https://github.com/Moodstocks/moodstocks-phonegap-plugin/blob/master/src/android/Demo.java
Line 86: Line 140:  
</pre>
 
</pre>
   −
== Cordova plugins ==
+
==== Moodstocks Bugs ====
 +
 
 +
The following pops up on the 2nd scan with Moodstocks:
 +
<pre>
 +
java.lang.RuntimeException : Unable to start activity ComponentInfo ... The specified child already has a parent. You must call removeView() on the child's parent first.
 +
</pre>
 +
-> Problem with jQuerymobile not "exiting" properly from scan when clicking on "Back" ?
   −
* http://plugins.cordova.io/#/package/com.phonegap.plugins.barcodescanner
+
==== Moodstocks plugin tutorial ====
 
* https://moodstocks.com/docs/phonegap/using-the-moodstocks-sdk-in-your-phonegap-application/
 
* https://moodstocks.com/docs/phonegap/using-the-moodstocks-sdk-in-your-phonegap-application/
 +
== Firefox OS ==
 +
[https://openfoodfacts.slack.com/messages/firefoxos See #firefoxos on Slack]
 +
<br>
 +
A port of the app was initiated on Firefox OS. The main issues were with the barcode scanner and the lack of Cordova feature parity for the platform.
   −
=== Bugs ===
+
=== Notes from the Hackathon ===
 +
[[File:Porting Open Food Facts on Firefox OS.011.jpeg|thumbnail]]
 +
[[File:Porting_Open_Food_Facts_on_Firefox_OS.010.jpeg|thumbnail]]
 +
* Hackpad: https://lite5.framapad.org/p/hack@moz
 +
* PDF presentation: [[File:Porting OFF on Firefox OS.pdf]]
 +
* https://github.com/gasolin/qrcode_scanner/
 +
* https://github.com/SunboX/QR-Reader
   −
2ème scan avec Moodstocks:
+
=== How to hack it / install it ===
 +
==== Get the source code ====
 +
Clone the Open Food Facts Firefox OS Cordova repository
 +
<pre>git clone https://github.com/openfoodfacts/openfoodfacts-ffos.git</pre>
 +
Github repo with the app debugged during the Hackathon
   −
java.lang.RuntimeException : Unable to start activity ComponentInfo ... The specified child already has a parent. You must call removeView() on the child's parent first.
+
==== Install the App Manager ====
 +
* https://developer.mozilla.org/en-US/Firefox_OS/Using_the_App_Manager
   −
-> pb de jquerymobile qui "sort" pas proprement du scan lorsqu'on clique sur "back" ?
+
==== Install it on your device ====
   −
=== Import sur Google Play ===
+
== Windows Phone ==
 +
See [https://openfoodfacts.slack.com/messages/windowsphone #windowsphone on Slack]
 +
* [http://www.windowsphone.com/fr-fr/store/app/openfoodfacts/5d7cf939-cfd9-4ac0-86d7-91b946f4df34 Listing on the Windows Phone store]
   −
* "Vous avez importé un fichier APK qui n'est pas aligné au format zip. Veuillez exécuter un utilitaire d'alignement zipalign sur votre fichier APK, puis le réimporter."
+
== Ubuntu OS ==
 +
Separate application and codebase. See [https://openfoodfacts.slack.com/messages/ubuntu #ubuntu on Slack]
   −
=== Camera, File, File transfer plugins ===
+
== Publishing on App Stores ==
 
+
* See [[Mobile App/AppStores]]
cordova plugin add org.apache.cordova.camera
  −
cordova plugin add org.apache.cordova.file
  −
cordova plugin add org.apache.cordova.file-transfer
  −
 
  −
== Firefox OS ==
  −
 
  −
* https://developer.mozilla.org/en-US/Firefox_OS/Using_the_App_Manager
  −
* https://github.com/gasolin/qrcode_scanner/
  −
* https://github.com/SunboX/QR-Reader
      
== May be of interest for future apps ==
 
== May be of interest for future apps ==
    
* http://ionicframework.com/
 
* http://ionicframework.com/
 +
 +
[[Category:Mobile]]
 +
[[Category:Development]]

Navigation menu