Difference between revisions of "Mobile App/Cordova Development Notes"

From Open Food Facts wiki
Jump to navigation Jump to search
Line 56: Line 56:
  
 
Run SDK Manager, install Android build tools.
 
Run SDK Manager, install Android build tools.
 +
 +
 +
=== Install Moodstocks ===
 +
 +
* 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 :
 +
 +
* https://github.com/Moodstocks/moodstocks-phonegap-plugin/blob/master/src/android/Demo.java
 +
 +
<pre>
 +
public class Demo extends CordovaActivity {
 +
 +
  private boolean scanActivityStarted = false;
 +
 +
  @Override
 +
  public void onCreate(Bundle savedInstanceState) {
 +
    super.onCreate(savedInstanceState);
 +
    this.init();
 +
    // Set by <content src="index.html" /> in config.xml
 +
    super.loadUrl(Config.getStartUrl());
 +
    //super.loadUrl("file:///android_asset/www/index.html")
 +
  }
 +
 +
</pre>
  
 
== Cordova plugins ==
 
== Cordova plugins ==
Line 61: Line 86:
 
* http://plugins.cordova.io/#/package/com.phonegap.plugins.barcodescanner
 
* http://plugins.cordova.io/#/package/com.phonegap.plugins.barcodescanner
 
* 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/
 +
 +
=== Bugs ===
 +
 +
2ème scan avec Moodstocks:
 +
 +
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.
  
 
== Firefox OS ==
 
== Firefox OS ==

Revision as of 11:47, 12 October 2014

This page contains notes regarding the development of the Open Food Facts mobile apps.

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

Following notes are for the Windows Platform, but most of it probably applies for Mac or Linux.

Install Node.js

Install git client

Install Cordova

in git-bash client:

  • npm install -g cordova

cordova -v : 3.6.3-0.2.13

  • "error android_home is not set and android command not in your path" when doing "cordova platform add android"

"error failed to run javac -version make sure"

Java JDK

ANT

"Error: Failed to run "java -version"

which java --> un vieux java dans C:\Windows\System32 était la cause du problème.. :-(

http://stackoverflow.com/questions/24493693/cordova-android-revision-to-low

Run SDK Manager, install Android build tools.


Install Moodstocks

Instructions pas à jour pour cordova 3.6 on dirait, par contre il y a un autre example :

public class Demo extends CordovaActivity {

  private boolean scanActivityStarted = false;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.init();
    // Set by <content src="index.html" /> in config.xml
    super.loadUrl(Config.getStartUrl());
    //super.loadUrl("file:///android_asset/www/index.html")
  }

Cordova plugins

Bugs

2ème scan avec Moodstocks:

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.

Firefox OS

May be of interest for future apps