tips:cordova

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tips:cordova [2015/02/13 15:49] scipiotips:cordova [2015/02/19 17:10] (current) – [Cordova] scipio
Line 23: Line 23:
 </code> </code>
  
-=== Update ===+===== Update =====
  
  
Line 30: Line 30:
 </code> </code>
  
-=== Install Android SDK ===+===== Install Android SDK =====
  
 Create /etc/etc/profile.d/android.sh or add in .bash_profile Create /etc/etc/profile.d/android.sh or add in .bash_profile
Line 39: Line 39:
  
  
-=== Project ===+===== Project =====
  
-== Create project ==+==== Create project ====
  
 <code> <code>
Line 66: Line 66:
 </code> </code>
  
-== Crosswalk ==+==== Crosswalk ====
  
 Optionally it is possible to use crosswalk instead of android webview Optionally it is possible to use crosswalk instead of android webview
Line 94: Line 94:
 cd platforms/android/CordovaLib/ cd platforms/android/CordovaLib/
 android update project --subprojects --path . --target "android-19" android update project --subprojects --path . --target "android-19"
-ant debug+ant clean debug
  
 cd .. # platforms/android/ cd .. # platforms/android/
Line 103: Line 103:
 </code> </code>
  
-== Manage project ==+==== Manage project ====
  
 View project detail View project detail
Line 128: Line 128:
 </code> </code>
  
-== Test project ==+==== Test project ====
  
 <code> <code>
Line 134: Line 134:
 </code> </code>
  
-== Release ==+==== Release ====
  
 <code> <code>
Line 141: Line 141:
  
 [http://developer.android.com/tools/publishing/app-signing.html sign and align] [http://developer.android.com/tools/publishing/app-signing.html sign and align]
-== Tips == 
  
-=== GPIO ===+ 
 +===== Video autoplay ===== 
 + 
 +Con ionic-crosswalk i video partono da soli con il set di src via javascript 
 +<code javascript> 
 +if (! $('#video1')[0].src) { 
 +  $('#video1')[0].src = "http://..."; 
 +  } 
 +$("#video1")[0].currentTime = 0; // rewind 
 +$("#video1")[0].play(); 
 +</code> 
 + 
 +==== Cordova ==== 
 + 
 +CordovaApp.java 
 +<code> 
 +super.init(); 
 +super.appView.getSettings().setMediaPlaybackRequiresUserGesture(false); 
 +</code> 
 + 
 +==== Cordova Crosswalk ==== 
 + 
 +<code> 
 +    ... 
 +    super.init(); 
 +    getSettings(super.appView).setMediaPlaybackRequiresUserGesture(false); 
 +    ... 
 + 
 +    /* rende plubblica la API mascherata dalle nuove release di crosswalk */ 
 +    private XWalkSettings getSettings(XWalkView webView) 
 +    { 
 +        try 
 +        { 
 +            Method ___getBridge = XWalkView.class.getDeclaredMethod("getBridge"); 
 +            ___getBridge.setAccessible(true); 
 +            XWalkViewBridge xWalkViewBridge = null; 
 +            xWalkViewBridge = (XWalkViewBridge)___getBridge.invoke(webView); 
 +            XWalkSettings xWalkSettings = xWalkViewBridge.getSettings(); 
 +            return xWalkSettings; 
 +        } 
 +        catch (Exception e) 
 +        { 
 +            e.printStackTrace(); 
 +        } 
 +        return null; 
 +    } 
 +</code> 
 + 
 +Posizionare un set di src dopo il device ready 
 +<code> 
 +$('#video1')[0].src = "http://192.168.2.125:8000/lib/exe/fetch.php?media=contrade:pergari:pergari_int.webm"; 
 +</code> 
 + 
 +===== GPIO =====
  
 jni contain NDK project jni contain NDK project
Line 337: Line 389:
  
  
-=== Video autoplay === 
- 
-CordovaApp.java 
-<code> 
-super.init(); 
-super.appView.getSettings().setMediaPlaybackRequiresUserGesture(false); 
-</code> 
- 
-Posizionare un set di src dopo il device ready 
-<code> 
-$('#video1')[0].src = "http://192.168.2.125:8000/lib/exe/fetch.php?media=contrade:pergari:pergari_int.webm"; 
-</code> 
  
  • tips/cordova.1423838995.txt.gz
  • Last modified: 2015/02/13 15:49
  • by scipio