rhodes 2.2.6 → 2.3.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +20 -0
- data/README.md +46 -0
- data/Rakefile +85 -80
- data/bin/rhodes +2 -2
- data/bin/rhogen +1 -1
- data/doc/application.txt +277 -0
- data/doc/bb-css.txt +209 -0
- data/doc/build.txt +785 -0
- data/doc/configuration.txt +236 -0
- data/doc/connect-to-web-services.txt +282 -0
- data/doc/contributing.txt +64 -0
- data/doc/css-framework.txt +144 -0
- data/doc/device-caps.txt +1152 -0
- data/doc/extensions.txt +528 -0
- data/doc/files.txt +4 -0
- data/doc/generator.txt +141 -0
- data/doc/install.txt +35 -0
- data/doc/introduction.txt +88 -0
- data/doc/rhom.txt +826 -0
- data/doc/standard-css.txt +392 -0
- data/doc/synchronization.txt +542 -0
- data/doc/test-log-debug.txt +148 -0
- data/doc/tutorial.txt +136 -0
- data/doc/ui.txt +766 -0
- data/installer/EnvVarUpdate.nsh +328 -0
- data/installer/README.html +81 -0
- data/installer/RHOSYNC-LICENSE.txt +675 -0
- data/installer/icon.ico +0 -0
- data/installer/instant-rhodes.nsi +427 -0
- data/lib/build/jake.rb +15 -1
- data/lib/extensions/barcode/ext/barcode/platform/android/jni/src/imageprovider.cpp +1 -1
- data/lib/extensions/barcode/ext/barcode/platform/bb/Barcode6.files +45 -0
- data/lib/extensions/barcode/ext/barcode/platform/bb/Rakefile +6 -0
- data/lib/extensions/barcode/ext/barcode/platform/bb/barcode6.jdp +92 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Barcode.xcodeproj/project.pbxproj +7 -4
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Rakefile +2 -1
- data/lib/extensions/barcode/ext/barcode/platform/wm/src/wm_imageprovider.cpp +1 -1
- data/lib/extensions/digest-sha1/ext/build.bat +1 -0
- data/lib/extensions/digest-sha1/ext/digest-sha1.vcproj +335 -0
- data/lib/extensions/esri/ext/build +17 -0
- data/lib/extensions/esri/ext/build.bat +29 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewFactory.h +7 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewFactory.mm +58 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewFactoryRegister.mm +22 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewManager.h +21 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewManager.mm +32 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/InitESRI.c +5 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/MapViewControllerESRI.h +143 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/MapViewControllerESRI.m +919 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/ESRI.xcodeproj/project.pbxproj +320 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/ESRI_Prefix.pch +7 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Rakefile +76 -0
- data/lib/extensions/esri/ext.yml +3 -0
- data/lib/extensions/net-http/monitor.rb +265 -0
- data/lib/extensions/net-http/net/ftp.rb +981 -0
- data/lib/extensions/net-http/thread.rb +367 -0
- data/lib/extensions/rhocgi/cgi.rb +16 -0
- data/lib/extensions/rhospec/rhospec.rb +118 -0
- data/lib/framework/base64.rb +91 -0
- data/lib/framework/builtinME.rb +13 -10
- data/lib/framework/ostruct.rb +145 -0
- data/lib/framework/res/back_btn.wm.png +0 -0
- data/lib/framework/res/blue_pushpin.wm.png +0 -0
- data/lib/framework/res/blue_pushpin_small.wm.png +0 -0
- data/lib/framework/res/callout.wm.png +0 -0
- data/lib/framework/res/callout_link.wm.png +0 -0
- data/lib/framework/res/forward_btn.wm.png +0 -0
- data/lib/framework/res/home_btn.wm.png +0 -0
- data/lib/framework/res/options_btn.wm.png +0 -0
- data/lib/framework/res/refresh_btn.wm.png +0 -0
- data/lib/framework/rho/render.rb +5 -2
- data/lib/framework/rho/rho.rb +320 -50
- data/lib/framework/rho/rhoapplication.rb +48 -10
- data/lib/framework/rho/rhonativeviewmanager.rb +73 -0
- data/lib/framework/rho/rhosupport.rb +15 -1
- data/lib/framework/rho/rhotabbar.rb +29 -0
- data/lib/framework/rho/rhotoolbar.rb +17 -0
- data/lib/framework/rho/rhoutils.rb +22 -6
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rholang/rhomsg_de.rb +4 -3
- data/lib/framework/rholang/rhomsg_en.rb +1 -0
- data/lib/framework/rholang/rhomsg_es.rb +1 -0
- data/lib/framework/rholang/rhomsg_it.rb +1 -0
- data/lib/framework/rhom/rhom.rb +31 -10
- data/lib/framework/rhom/rhom_db_adapter.rb +33 -23
- data/lib/framework/rhom/rhom_object_factory.rb +465 -249
- data/lib/framework/rhom/rhom_source.rb +22 -7
- data/lib/framework/version.rb +1 -1
- data/lib/rhodes.rb +1 -1
- data/platform/android/Rhodes/AndroidManifest.xml +83 -20
- data/platform/android/Rhodes/gen/com/rhomobile/rhodes/R.java +5 -0
- data/platform/android/Rhodes/jni/include/rhodes/RhoClassFactory.h +2 -0
- data/platform/android/Rhodes/jni/include/rhodes/details/rhojava.inc +9 -5
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesAppOptions.h +53 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesService.h +46 -56
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_SplashScreen.h +10 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_mapview_MapView.h +93 -0
- data/platform/android/Rhodes/jni/include/rhodes/rhocryptimpl.h +38 -0
- data/platform/android/Rhodes/jni/include/rhodes.h +64 -8
- data/platform/android/Rhodes/jni/src/RhoClassFactory.cpp +6 -0
- data/platform/android/Rhodes/jni/src/alert.cpp +5 -11
- data/platform/android/Rhodes/jni/src/bluetooth.cpp +66 -29
- data/platform/android/Rhodes/jni/src/callbacks.cpp +24 -21
- data/platform/android/Rhodes/jni/src/camera.cpp +2 -6
- data/platform/android/Rhodes/jni/src/datetimepicker.cpp +13 -11
- data/platform/android/Rhodes/jni/src/event.cpp +9 -15
- data/platform/android/Rhodes/jni/src/fileapi.cpp +13 -27
- data/platform/android/Rhodes/jni/src/logconf.cpp +3 -3
- data/platform/android/Rhodes/jni/src/mapview.cpp +696 -16
- data/platform/android/Rhodes/jni/src/menu.cpp +3 -3
- data/platform/android/Rhodes/jni/src/nativebar.cpp +55 -4
- data/platform/android/Rhodes/jni/src/nativeview.cpp +33 -0
- data/platform/android/Rhodes/jni/src/phonebook.cpp +6 -11
- data/platform/android/Rhodes/jni/src/rhoconf.cpp +4 -4
- data/platform/android/Rhodes/jni/src/rhocryptimpl.cpp +87 -0
- data/platform/android/Rhodes/jni/src/rhodes.cpp +55 -34
- data/platform/android/Rhodes/jni/src/ringtones.cpp +2 -3
- data/platform/android/Rhodes/jni/src/signature.cpp +3 -5
- data/platform/android/Rhodes/jni/src/splashscreen.cpp +7 -0
- data/platform/android/Rhodes/jni/src/sslimpl.cpp +17 -20
- data/platform/android/Rhodes/jni/src/webview.cpp +13 -12
- data/platform/android/Rhodes/res/drawable/callout.png +0 -0
- data/platform/android/Rhodes/res/drawable/callout_link.png +0 -0
- data/platform/android/Rhodes/res/drawable/signature_cancel.png +0 -0
- data/platform/android/Rhodes/res/drawable/signature_clear.png +0 -0
- data/platform/android/Rhodes/res/drawable/signature_ok.png +0 -0
- data/platform/android/Rhodes/res/layout/datetime.xml +4 -0
- data/platform/android/Rhodes/res/layout/signature.xml +24 -17
- data/platform/android/Rhodes/res/layout/status_bar_ongoing_event_progress_bar.xml +102 -0
- data/platform/android/Rhodes/res/values/strings.xml +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/AndroidR.java +6 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Base64.java +575 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +83 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeBar.java +21 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +23 -15
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushService.java +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoCryptImpl.java +151 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoMenu.java +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +372 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesAppOptions.java +11 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +58 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +705 -523
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RingtoneManager.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +167 -85
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Utils.java +36 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +4 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +33 -20
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/IRhoBluetoothManager.java +2 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManager.java +2 -24
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerNew.java +106 -36
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerOld.java +15 -58
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothSession.java +0 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/Camera.java +6 -4
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/FileList.java +4 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +91 -27
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/datetime/DateTimePicker.java +6 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/datetime/DateTimePickerScreen.java +275 -42
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/file/RhoFileApi.java +1 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/MainView.java +1 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +120 -43
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +518 -28
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/AnnotationsOverlay.java +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/GoogleMapView.java +434 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapTouch.java +20 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapView.java +296 -336
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MultiTouchHandler.java +111 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/OneTouchHandler.java +77 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/TouchHandler.java +10 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoNativeViewManager.java +0 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Contact.java +5 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorNew.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorOld.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/ImageCapture.java +6 -11
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/Signature.java +6 -4
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureView.java +0 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/ui/LogViewDialog.java +9 -4
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/PerformOnUiThread.java +8 -8
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientNew.java +5 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientOld.java +11 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettingsNew.java +3 -5
- data/platform/android/build/RhodesSRC_build.files +32 -23
- data/platform/android/build/android.rake +28 -11
- data/platform/android/build/androidcommon.rb +2 -0
- data/platform/android/build/librhocommon_build.files +9 -5
- data/platform/android/build/librhodes_build.files +1 -0
- data/platform/android/build/libruby_build.files +1 -0
- data/platform/bb/Hsqldb/Hsqldb.jdp +0 -2
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBResult.java +10 -2
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +37 -5
- data/platform/bb/Hsqldb/src/org/hsqldb/Column.java +5 -5
- data/platform/bb/Hsqldb/src/org/hsqldb/Expression.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Function.java +73 -78
- data/platform/bb/Hsqldb/src/org/hsqldb/Library.java +288 -8
- data/platform/bb/RubyVM/RubyVM.jdp +3 -0
- data/platform/bb/RubyVM/src/com/rho/FilePath.java +13 -1
- data/platform/bb/RubyVM/src/com/rho/IRhoRubyHelper.java +2 -2
- data/platform/bb/RubyVM/src/com/rho/RhoAppAdapter.java +12 -0
- data/platform/bb/RubyVM/src/com/rho/RhoClassFactory.java +18 -1
- data/platform/bb/RubyVM/src/com/rho/RhoConf.java +128 -108
- data/platform/bb/RubyVM/src/com/rho/RhoLogConf.java +9 -10
- data/platform/bb/RubyVM/src/com/rho/RhoLogger.java +16 -1
- data/platform/bb/RubyVM/src/com/rho/RhoProfiler.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/RhoRuby.java +20 -0
- data/platform/bb/RubyVM/src/com/rho/RhodesApp.java +5 -2
- data/platform/bb/RubyVM/src/com/rho/ThreadQueue.java +65 -46
- data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +192 -50
- data/platform/bb/RubyVM/src/com/rho/db/DBAttrManager.java +8 -114
- data/platform/bb/RubyVM/src/com/rho/db/DBException.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/db/IDBCallback.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/db/IDBResult.java +5 -3
- data/platform/bb/RubyVM/src/com/rho/db/IDBStorage.java +5 -1
- data/platform/bb/RubyVM/src/com/rho/file/FileAccessBB.java +109 -0
- data/platform/bb/RubyVM/src/com/rho/file/RhoFile.java +85 -0
- data/platform/bb/RubyVM/src/com/rho/net/NetRequest.java +12 -4
- data/platform/bb/RubyVM/src/com/rho/net/NetResponse.java +5 -0
- data/platform/bb/RubyVM/src/com/rho/net/RhoConnection.java +37 -23
- data/platform/bb/RubyVM/src/com/rho/net/URI.java +84 -0
- data/platform/bb/RubyVM/src/com/rho/sync/ClientRegister.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +119 -61
- data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +61 -24
- data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +108 -54
- data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +121 -163
- data/platform/bb/RubyVM/src/com/xruby/GeneratedMethods/RubyString_Methods.java +23 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyMutex.java +1 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyRange.java +3 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyRegexp.java +3 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyString.java +208 -25
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyTime.java +3 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RhoSupport.java +5 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyAPI.java +12 -5
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyID.java +1 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyKernelModule.java +16 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyKernelModule_Methods.java +5 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyValue.java +1 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/stdlib/RubyStringIO.java +4 -1
- data/platform/bb/{Hsqldb → RubyVM}/src/j2me/math/Number.java +33 -0
- data/platform/bb/build/RubyVM_build.files +3 -0
- data/platform/bb/build/bb.rake +140 -62
- data/platform/bb/build/hsqldb_build.files +0 -2
- data/platform/bb/build/rhodes_build.files +5 -0
- data/platform/bb/rhodes/platform/4.7/com/rho/RhoMainScreen.java +43 -7
- data/platform/bb/rhodes/platform/5.0/com/rho/BrowserAdapter5.java +23 -2
- data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +5 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteCopyResult.java +143 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteResult.java +269 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteStorage.java +446 -0
- data/platform/bb/rhodes/platform/common/com/rho/BrowserAdapter5.java +3 -0
- data/platform/bb/rhodes/platform/common/com/rho/RhoMainScreen.java +12 -2
- data/platform/bb/rhodes/platform/common/com/rho/db/SqliteCopyResult.java +2 -0
- data/platform/bb/rhodes/platform/common/com/rho/db/SqliteResult.java +2 -0
- data/platform/bb/rhodes/platform/common/com/rho/db/SqliteStorage.java +2 -0
- data/platform/bb/rhodes/resources/mappin.png +0 -0
- data/platform/bb/rhodes/rhodes.jdp +3 -0
- data/platform/bb/rhodes/src/com/rho/BrowserAdapter.java +21 -18
- data/platform/bb/rhodes/src/com/rho/BrowserAdapter5.java +150 -0
- data/platform/bb/rhodes/src/com/rho/IBrowserAdapter.java +1 -0
- data/platform/bb/rhodes/src/com/rho/RhoMainScreen.java +63 -4
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +6 -5
- data/platform/bb/rhodes/src/com/rho/RhodesApplicationPlatform.java +242 -2
- data/platform/bb/rhodes/src/com/rho/db/SqliteCopyResult.java +143 -0
- data/platform/bb/rhodes/src/com/rho/db/SqliteResult.java +269 -0
- data/platform/bb/rhodes/src/com/rho/db/SqliteStorage.java +446 -0
- data/platform/bb/rhodes/src/com/rho/file/Jsr75File.java +1 -1
- data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +71 -14
- data/platform/bb/rhodes/src/com/rho/net/bb/BBHttpConnection.java +4 -2
- data/platform/bb/rhodes/src/com/rho/rubyext/Alert.java +28 -12
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +100 -4
- data/platform/bb/rhodes/src/com/rho/rubyext/WebView.java +3 -2
- data/platform/bb/rhodes/src/com/rho/rubyext/XMLParser.java +1 -1
- data/platform/bb/rhodes/src/rhomobile/NativeBar.java +32 -0
- data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +9 -2
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +174 -41
- data/platform/bb/rhodes/src/rhomobile/datetime/DateTimePicker.java +52 -3
- data/platform/bb/rhodes/src/rhomobile/datetime/DateTimeScreen.java +33 -1
- data/platform/bb/rhodes/src/rhomobile/mapview/Annotation.java +2 -14
- data/platform/bb/rhodes/src/rhomobile/mapview/ESRIMapField.java +686 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/ESRIMapProvider.java +14 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/GeoCoding.java +13 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/GoogleGeoCoding.java +174 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/GoogleMapField.java +104 -330
- data/platform/bb/rhodes/src/rhomobile/mapview/MapTools.java +79 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/MapView.java +35 -12
- data/platform/bb/rhodes/src/rhomobile/mapview/MapViewParent.java +2 -1
- data/platform/bb/rhodes/src/rhomobile/mapview/MapViewScreen.java +336 -44
- data/platform/bb/rhodes/src/rhomobile/mapview/RhoMapField.java +3 -6
- data/platform/iphone/Classes/AppManager/AppManager.m +19 -4
- data/platform/iphone/Classes/DateTime.h +4 -0
- data/platform/iphone/Classes/DateTime.m +1 -1
- data/platform/iphone/Classes/DateTimePicker.m +8 -1
- data/platform/iphone/Classes/DateTimePickerDelegate.m +7 -1
- data/platform/iphone/Classes/Event/Event.m +2 -2
- data/platform/iphone/Classes/MapView/MapViewController.h +4 -1
- data/platform/iphone/Classes/MapView/MapViewController.m +6 -46
- data/platform/iphone/Classes/MapView/MapViewManager.h +26 -0
- data/platform/iphone/Classes/MapView/MapViewManager.m +172 -0
- data/platform/iphone/Classes/NativeBar.h +34 -0
- data/platform/iphone/Classes/NativeBar.m +131 -26
- data/platform/iphone/Classes/NativeView/NVDelegate.h +26 -0
- data/platform/iphone/Classes/NativeView/NVDelegate.m +40 -0
- data/platform/iphone/Classes/NativeView/NVViewController.h +24 -0
- data/platform/iphone/Classes/NativeView/NVViewController.m +90 -0
- data/platform/iphone/Classes/NativeView/RhoNativeViewManager.mm +449 -0
- data/platform/iphone/Classes/{RhoNativeViewManagerOC.h → NativeView/RhoNativeViewManagerOC.h} +15 -0
- data/platform/iphone/Classes/RhoAlert.m +3 -3
- data/platform/iphone/Classes/RhoMainView.h +3 -0
- data/platform/iphone/Classes/Rhodes.h +6 -2
- data/platform/iphone/Classes/Rhodes.m +47 -79
- data/platform/iphone/Classes/Signature/SignatureViewController.m +1 -0
- data/platform/iphone/Classes/SimpleMainView.h +18 -1
- data/platform/iphone/Classes/SimpleMainView.m +180 -35
- data/platform/iphone/Classes/SplitView/LeftViewController.h +1 -1
- data/platform/iphone/Classes/SplitView/LeftViewController.m +13 -7
- data/platform/iphone/Classes/SplitView/RightViewController.h +1 -1
- data/platform/iphone/Classes/SplitView/RightViewController.m +26 -11
- data/platform/iphone/Classes/SplitView/SplittedMainView.h +1 -6
- data/platform/iphone/Classes/SplitView/SplittedMainView.m +14 -52
- data/platform/iphone/Classes/TabbedMainView.h +25 -3
- data/platform/iphone/Classes/TabbedMainView.m +340 -14
- data/platform/iphone/ESRI/BluePushpin.png +0 -0
- data/platform/iphone/ESRI/BluePushpin@2x.png +0 -0
- data/platform/iphone/ESRI/esri.png +0 -0
- data/platform/iphone/ESRI/esri@2x.png +0 -0
- data/platform/iphone/Info.plist +1 -1
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +26 -3
- data/platform/iphone/rbuild/iphone.rake +100 -4
- data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +12 -0
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +116 -12
- data/platform/shared/SyncClient/SyncClient.cpp +29 -3
- data/platform/shared/SyncClient/SyncClient.h +2 -1
- data/platform/shared/common/IRhoClassFactory.h +3 -0
- data/platform/shared/common/IRhoCrypt.h +16 -0
- data/platform/shared/common/IRhoThreadImpl.h +1 -0
- data/platform/shared/common/RhoAppAdapter.h +2 -0
- data/platform/shared/common/RhoConf.cpp +97 -46
- data/platform/shared/common/RhoConf.h +14 -13
- data/platform/shared/common/RhoFile.cpp +10 -0
- data/platform/shared/common/RhoFile.h +1 -0
- data/platform/shared/common/RhoMath.cpp +43 -0
- data/platform/shared/common/RhoMath.h +27 -0
- data/platform/shared/common/RhoNativeViewManager.h +27 -1
- data/platform/shared/common/RhoPort.h +11 -0
- data/platform/shared/common/RhoStd.h +5 -0
- data/platform/shared/common/RhoThread.cpp +1 -1
- data/platform/shared/common/RhoThread.h +1 -1
- data/platform/shared/common/RhodesApp.cpp +381 -139
- data/platform/shared/common/RhodesApp.h +24 -10
- data/platform/shared/common/RhodesAppBase.cpp +72 -1
- data/platform/shared/common/RhodesAppBase.h +5 -1
- data/platform/shared/common/SplashScreen.h +4 -4
- data/platform/shared/common/ThreadQueue.cpp +44 -17
- data/platform/shared/common/ThreadQueue.h +4 -0
- data/platform/shared/common/app_build_configs.c +0 -1
- data/platform/shared/common/iphone/RhoClassfactory.h +6 -0
- data/platform/shared/common/iphone/RhoCryptImpl.h +47 -0
- data/platform/shared/common/iphone/RhoCryptImpl.mm +286 -0
- data/platform/shared/common/map/ESRIMapEngine.cpp +921 -0
- data/platform/shared/common/map/ESRIMapEngine.h +255 -0
- data/platform/shared/common/map/GoogleMapEngine.cpp +160 -0
- data/platform/shared/common/map/GoogleMapEngine.h +52 -0
- data/platform/shared/common/map/MapEngine.cpp +304 -0
- data/platform/shared/common/map/MapEngine.h +214 -0
- data/platform/shared/db/DBAdapter.cpp +147 -18
- data/platform/shared/db/DBAdapter.h +38 -12
- data/platform/shared/db/DBAttrManager.cpp +4 -3
- data/platform/shared/db/DBAttrManager.h +7 -7
- data/platform/shared/db/res/db/syncdb.triggers +0 -5
- data/platform/shared/db/res/db/syncdb_java.triggers +21 -0
- data/platform/shared/json/JSONIterator.cpp +11 -1
- data/platform/shared/json/JSONIterator.h +1 -0
- data/platform/shared/logging/RhoLogConf.cpp +29 -12
- data/platform/shared/net/CURLNetRequest.cpp +80 -25
- data/platform/shared/net/CURLNetRequest.h +6 -2
- data/platform/shared/net/HttpServer.cpp +12 -6
- data/platform/shared/net/HttpServer.h +2 -1
- data/platform/shared/net/INetRequest.h +1 -0
- data/platform/shared/ruby/ext/alert/alert.i +5 -0
- data/platform/shared/ruby/ext/alert/alert_wrap.c +439 -108
- data/platform/shared/ruby/ext/datetimepicker/datetimepicker.i +42 -0
- data/platform/shared/ruby/ext/datetimepicker/datetimepicker_wrap.c +521 -120
- data/platform/shared/ruby/ext/nativebar/nativebar.i +16 -0
- data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +623 -128
- data/platform/shared/ruby/ext/nativeviewmanager/nativeviewmanager.i +18 -0
- data/platform/shared/ruby/ext/nativeviewmanager/nativeviewmanager_wrap.c +2321 -0
- data/platform/shared/ruby/ext/rho/extensions.c +0 -1
- data/platform/shared/ruby/ext/rho/rhoruby.c +53 -0
- data/platform/shared/ruby/ext/rho/rhoruby.h +6 -0
- data/platform/shared/ruby/ext/sqlite3_api/sqlite3_api_wrap.c +6 -3
- data/platform/shared/ruby/ext/syncengine/syncengine.i +9 -1
- data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +61 -0
- data/platform/shared/ruby/ext/system/system.i +4 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +33 -5
- data/platform/shared/rubyext/RhoAppAdapter.cpp +11 -1
- data/platform/shared/rubyext/System.cpp +9 -0
- data/platform/shared/rubyext/WebView.h +1 -0
- data/platform/shared/sqlite/crypto.c +907 -0
- data/platform/shared/sqlite/sqlite3.c +6 -0
- data/platform/shared/sync/SyncEngine.cpp +49 -19
- data/platform/shared/sync/SyncEngine.h +0 -1
- data/platform/shared/sync/SyncNotify.cpp +14 -5
- data/platform/shared/sync/SyncNotify.h +2 -2
- data/platform/shared/sync/SyncSource.cpp +79 -33
- data/platform/shared/sync/SyncSource.h +1 -0
- data/platform/shared/sync/SyncThread.cpp +26 -11
- data/platform/shared/xruby/src/com/xruby/compiler/codedom/StringExpression.java +4 -2
- data/platform/wm/RhoLib/RhoLib.vcproj +108 -72
- data/platform/wm/build/wm.rake +6 -0
- data/platform/wm/rhodes/Alert.cpp +4 -3
- data/platform/wm/rhodes/Alert.h +1 -1
- data/platform/wm/rhodes/DateTimePicker.cpp +30 -3
- data/platform/wm/rhodes/DateTimePicker.h +9 -1
- data/platform/wm/rhodes/MainWindow.cpp +121 -61
- data/platform/wm/rhodes/MainWindow.h +29 -4
- data/platform/wm/rhodes/MapView/Graphics.cpp +547 -0
- data/platform/wm/rhodes/MapView/Graphics.h +136 -0
- data/platform/wm/rhodes/MapView/MapViewManager.cpp +391 -0
- data/platform/wm/rhodes/MapView/MapViewManager.h +158 -0
- data/platform/wm/rhodes/RhoCryptImpl.cpp +248 -0
- data/platform/wm/rhodes/RhoCryptImpl.h +51 -0
- data/platform/wm/rhodes/RhoNativeViewManager.cpp +208 -0
- data/platform/wm/rhodes/Rhodes.cpp +94 -102
- data/platform/wm/rhodes/Rhodes.rc +27 -0
- data/platform/wm/rhodes/SyncStatusDlg.cpp +1 -0
- data/platform/wm/rhodes/SyncStatusDlg.h +2 -1
- data/platform/wm/rhodes/bluetooth/Bluetooth.cpp +7 -4
- data/platform/wm/rhodes/camera/Camera.cpp +36 -15
- data/platform/wm/rhodes/camera/Camera.h +0 -4
- data/platform/wm/rhodes/resource.h +10 -2
- data/platform/wm/rhodes/rho/common/RhoClassFactory.cpp +7 -0
- data/platform/wm/rhodes/rho/common/RhoClassFactory.h +1 -0
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +10 -2
- data/platform/wm/rhodes/rho/net/NetRequestImpl.h +10 -0
- data/platform/wm/rhodes/rho/rubyext/NativeToolbar.cpp +513 -0
- data/platform/wm/rhodes/rho/rubyext/NativeToolbar.h +74 -0
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +22 -10
- data/platform/wm/rhodes/rho/rubyext/WebView.cpp +5 -0
- data/platform/wm/rhodes/rhodes.vcproj +38 -2
- data/platform/wm/rhodes/stdafx.h +2 -1
- data/platform/wm/rubylib/rubylib.vcproj +12 -0
- data/rakefile.rb +85 -80
- data/res/build-tools/iphonesim/Source/iPhoneSimulator.m +14 -3
- data/res/build-tools/iphonesim/build/Release/iphonesim +0 -0
- data/res/build-tools/iphonesim/iphonesim.xcodeproj/project.pbxproj +2 -0
- data/res/build-tools/xruby-0.3.3.jar +0 -0
- data/res/generators/templates/application/app/application.rb +2 -2
- data/res/generators/templates/application/app/helpers/application_helper.rb +1 -1
- data/res/generators/templates/application/public/css/android.css +1 -0
- data/res/generators/templates/application/public/jqtouch/jquery.1.3.2.min.js +1 -1
- data/res/generators/templates/application/rhoconfig.txt +66 -14
- data/rhodes.gemspec +3 -3
- data/spec/framework_spec/app/spec/core/file/expand_path_spec.rb +7 -3
- data/spec/framework_spec/build.yml +1 -1
- data/spec/phone_spec/Rakefile +1 -0
- data/spec/phone_spec/app/Account/account.rb +2 -0
- data/spec/phone_spec/app/Account_s/account_s.rb +7 -0
- data/spec/phone_spec/app/spec/{fixtures → array/fixtures}/classes.rb +0 -0
- data/spec/phone_spec/app/spec/{array_pack_spec.rb → array/pack_spec.rb} +2 -1
- data/spec/phone_spec/app/spec/bulksync_spec.rb +1 -0
- data/spec/phone_spec/app/spec/contacts_spec.rb +2 -0
- data/spec/phone_spec/app/spec/rho_spec.rb +34 -233
- data/spec/phone_spec/app/spec/rhom_object_spec.rb +396 -87
- data/spec/phone_spec/app/spec/string/element_set_spec.rb +251 -0
- data/spec/phone_spec/app/spec/string/end_with_spec.rb +49 -0
- data/spec/phone_spec/app/spec/string/fixtures/classes.rb +27 -0
- data/spec/phone_spec/app/spec/{lstrip_spec.rb → string/lstrip_spec.rb} +0 -0
- data/spec/phone_spec/app/spec/string/replace_spec.rb +52 -0
- data/spec/phone_spec/app/spec/{rstrip_spec.rb → string/rstrip_spec.rb} +0 -0
- data/spec/phone_spec/app/spec/string/slice_spec.rb +473 -0
- data/spec/phone_spec/app/spec/string/split_spec.rb +302 -0
- data/spec/phone_spec/app/spec/string/start_with_spec.rb +48 -0
- data/spec/phone_spec/app/spec/{strip_spec.rb → string/strip_spec.rb} +0 -0
- data/spec/phone_spec/app/spec/syncengine_spec.rb +30 -1
- data/spec/phone_spec/app/spec_runner.rb +15 -7
- data/spec/phone_spec/build.yml +2 -2
- metadata +154 -25
- data/README.textile +0 -45
- data/platform/android/Rhodes/AndroidManifest.full.xml +0 -62
- data/platform/android/Rhodes/gen/com/rhomobile/rhodes/Manifest.java +0 -14
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoActivity.java +0 -20
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +0 -193
- data/platform/bb/Hsqldb/src/com/rho/file/FileAccessBB.java +0 -25
- data/platform/bb/RubyVM/src/com/rho/AppBuildConfig.java +0 -22
- data/platform/bb/RubyVM/src/com/rho/Capabilities.java +0 -6
- data/platform/bb/RubyVM/src/com/rho/Extensions.java +0 -11
- data/platform/iphone/Classes/RhoNativeViewManager.mm +0 -226
data/doc/device-caps.txt
ADDED
@@ -0,0 +1,1152 @@
|
|
1
|
+
# Device Capabilities
|
2
|
+
|
3
|
+
## Introduction
|
4
|
+
|
5
|
+
Rhodes provide access to device specific capabilities such as GPS, PIM, camera, SMS, video player, accelerometer, proximity detector and [native UI elements](ui). Below is the device support matrix showing what release supports what device capabilities on a per device operating system basis.
|
6
|
+
|
7
|
+
<table class="device-caps">
|
8
|
+
<tr>
|
9
|
+
<th>Capability</th>
|
10
|
+
<th>iPhone</th>
|
11
|
+
<th>Windows Mobile</th>
|
12
|
+
<th>BlackBerry</th>
|
13
|
+
<th>Android</th>
|
14
|
+
</tr>
|
15
|
+
<tr><td class='cap'>GeoLocation</td><td>0.3</td><td>0.3</td><td>0.3</td><td>1.0</td></tr>
|
16
|
+
<tr><td class='cap'>PIM Contacts</td><td>0.3</td><td>0.3</td><td>0.3</td><td>1.0</td></tr>
|
17
|
+
<tr><td class='cap'>PIM Calendar</td><td>2.2</td><td>2.2</td><td>2.2</td><td>2.2</td><tr>
|
18
|
+
<tr><td class='cap'>Camera</td><td>1.0</td><td>1.0</td><td>1.0</td><td>1.0</td></tr>
|
19
|
+
<tr><td class='cap'>Barcode</td><td>2.1</td><td>2.1</td><td>2.1</td><td>2.1</td></tr>
|
20
|
+
<tr><td class='cap'>Date/Time picker</td><td>1.2.2</td><td>2.0</td><td>1.2</td><td>1.2</td></tr>
|
21
|
+
<tr><td class='cap'>Menu</td><td>1.2.2</td><td>2.0</td><td>1.2</td><td>1.5</td><tr>
|
22
|
+
<tr><td class='cap'>Toolbar</td><td>1.2.2</td><td>2.3</td><td class='tbd'>n/a</td><td>1.5</td><tr>
|
23
|
+
<tr><td class='cap'>Tab Bar</td><td>1.2.2</td><td class='tbd'>2.5</td><td class='tbd'>n/a</td><td>1.5</td><tr>
|
24
|
+
<tr><td class='cap'>Nav Bar</td><td>2.0</td><td class='tbd'>2.5</td><td class='tbd'>n/a</td><td>2.0</td><tr>
|
25
|
+
<tr><td class='cap'>Signature Capture</td><td>2.1</td><td class='tbd'>2.5</td><td class='tbd'>2.5</td><td>2.1</td><tr>
|
26
|
+
<tr class='tbd'><td class='cap'>Audio/Video capture</td><td>3.0</td><td>3.0</td><td>3.0</td><td>3.0</td><tr>
|
27
|
+
<tr><td class='cap'>Bluetooth</td><td>2.2</td><td>2.2</td><td>2.2</td><td>2.2</td><tr>
|
28
|
+
<tr><td class='cap'>Push</td><td>1.2</td><td class='tbd'>3.0</td><td>1.2</td><td>2.2</td><tr>
|
29
|
+
<tr><td class='cap'>Screen rotation</td><td>2.1</td><td class='tbd'>2.5</td><td>2.0</td><td>2.1</td><tr>
|
30
|
+
<tr><td class='cap'>Native Maps</td><td>1.4</td><td class='tbd'>2.5</td><td>1.4</td><td>1.5</td><tr>
|
31
|
+
<tr><td class='cap'>Alerts/Audio File Playback</td><td>1.2</td><td>1.5</td><td>1.2</td><td>1.2</td><tr>
|
32
|
+
<tr><td class='cap'>Ringtones</td><td>2.5</td><td>1.5</td><td>1.5</td><td>1.5</td><tr>
|
33
|
+
</table>
|
34
|
+
|
35
|
+
## System class
|
36
|
+
The System Ruby class provides access to the system specific information.
|
37
|
+
|
38
|
+
To get value of a named system property:
|
39
|
+
:::ruby
|
40
|
+
System.get_property(property)
|
41
|
+
|
42
|
+
Properties:
|
43
|
+
|
44
|
+
* platform - APPLE, Blackberry, WINDOWS, ANDROID, SYMBIAN
|
45
|
+
* has_camera - is camera available on the device
|
46
|
+
* screen_width - screen width in pixels
|
47
|
+
* screen_height - screen height in pixels
|
48
|
+
* ppi_x - horizontal PPI (Pixels Per Inch)
|
49
|
+
* ppi_y - vertical PPI (Pixels Per Inch)
|
50
|
+
* has_network - is device connected to the network
|
51
|
+
* phone_number - device phone number
|
52
|
+
* device_id - returns device ID which may be used to receive push messages. This is not phone device id, this is PUSH device id - you should register you phone for PUSH before get this parameter. Read [Push Notification documentation](device-caps#push-notifications) about it. On iPhone it may be empty right after application started while Rhodes registers to receive PUSH notifications; you should wait till it become non-empty.
|
53
|
+
* full_browser - is full browser in the WebView control on Blackberry (see [here](#blackberry-browser-support) for more details)
|
54
|
+
* device_name - name of device application running on. Examples: '9000' (BB), 'iPhone', 'dream' (Android)
|
55
|
+
* os_version - version of OS of device. Examples: '4.6.0.192' (BB), '3.0' (iPhone), '1.6' (Android)
|
56
|
+
* locale - current language like 'en', 'ru' etc.
|
57
|
+
* country - country abbreviation
|
58
|
+
* is_emulator - return true if application is running on emulator
|
59
|
+
* has_calendar - return true if calendar support is available
|
60
|
+
|
61
|
+
Get notifications on screen rotation:
|
62
|
+
:::ruby
|
63
|
+
System.set_screen_rotation_notification(callback_url, params)
|
64
|
+
* callback_url will be called when screen rotate; callback parameters will contain params you passed while setting up notification as well as `width`, `height`, and `degrees`
|
65
|
+
|
66
|
+
Exit application
|
67
|
+
:::ruby
|
68
|
+
System.exit
|
69
|
+
|
70
|
+
Enable\disable phone sleep by timeout, return previous state
|
71
|
+
:::ruby
|
72
|
+
System.set_sleeping
|
73
|
+
|
74
|
+
Open application associated with url; behavior may be different on different platforms and depend on installed software
|
75
|
+
:::ruby
|
76
|
+
System.open_url(url)
|
77
|
+
|
78
|
+
Run specified application. Note: appname is platform dependent
|
79
|
+
:::ruby
|
80
|
+
System.run_app(appname, params)
|
81
|
+
|
82
|
+
Install application from specified url
|
83
|
+
:::ruby
|
84
|
+
System.app_install(url)
|
85
|
+
|
86
|
+
Is specified application installed on device?
|
87
|
+
:::ruby
|
88
|
+
System.app_installed?(appname)
|
89
|
+
|
90
|
+
Uninstall specified application
|
91
|
+
:::ruby
|
92
|
+
System.app_uninstall(appname)
|
93
|
+
|
94
|
+
Unzip file to the same folder where zip file is
|
95
|
+
:::ruby
|
96
|
+
System.unzip_file(local_path_to_zip)
|
97
|
+
|
98
|
+
Return command line parameters as a string
|
99
|
+
:::ruby
|
100
|
+
System.get_start_params()
|
101
|
+
|
102
|
+
### Sample
|
103
|
+
See layout.erb of [System API Sample application](http://github.com/rhomobile/rhodes-system-api-samples/tree/master/app/layout.erb) for some of the examples of how to use System class. There is also [system test](http://github.com/rhomobile/rhodes-system-api-samples/tree/master/app/SystemTest/controller.rb) which demonstrate System class usage.
|
104
|
+
|
105
|
+
## Geolocation
|
106
|
+
|
107
|
+
Geolocation information is available in two ways: as an asynchronous service through Ajax calls to a predefined local URL, or in a controller using Ruby calls to the GeoLocation class.
|
108
|
+
|
109
|
+
You need to enable the GPS capability to use GeoLocaiton. This is done by adding the following lines to build.yml:
|
110
|
+
|
111
|
+
:::yaml
|
112
|
+
capabilities:
|
113
|
+
- gps
|
114
|
+
|
115
|
+
See the [Configuration](configuration#build-time-configuration) section for more details.
|
116
|
+
|
117
|
+
The GPS receiver consumes a significant amount of energy, and should be switched off most of the time in order to preserve the device's battery life. Any call to get location information will power up the GPS receiver. Also note that it usually takes a while to acquire the device's current position; in some cases, it may take several minutes and may not work at all indoors.
|
118
|
+
|
119
|
+
### Asynchronous Ajax calls
|
120
|
+
|
121
|
+
The Rhodes framework provides a simple HTML tag for accessing Geolocation information. To use it, include the appropriate javascript library on your page:
|
122
|
+
|
123
|
+
* For iPhone, Android: `/public/js/jquery-1.2.6.min.js` and `/public/js/rhogeolocation.js`
|
124
|
+
* For Windows Mobile: `/public/js/rhogeolocation-wm.js`
|
125
|
+
* For BlackBerry: Unsupported. The BlackBerry webview control doesn't support Ajax.
|
126
|
+
|
127
|
+
Then add one of the following tags in the appropriate location in your HTML: <geolocation/>, <geolatitude/> or <geolongitude/>. The included javascript will query a predefined URL and fill these tags with location information.
|
128
|
+
|
129
|
+
`<geolocation/>` - returns a string in the form `[formatted position];[latitude];[longitude]`.
|
130
|
+
|
131
|
+
For example: 37.3317° North, 122.0307° West;37.331689;-122.030731
|
132
|
+
|
133
|
+
`<geolatitude/>` - returns just the latitude <br/>
|
134
|
+
`<geolongitude/>` - returns just the longitude
|
135
|
+
|
136
|
+
### GeoLocation Ruby class
|
137
|
+
|
138
|
+
Get current latitude:
|
139
|
+
:::ruby
|
140
|
+
GeoLocation.latitude
|
141
|
+
|
142
|
+
Get current longitude:
|
143
|
+
:::ruby
|
144
|
+
GeoLocation.longitude
|
145
|
+
|
146
|
+
Test if the location system is up and acquired position:
|
147
|
+
:::ruby
|
148
|
+
GeoLocation.known_position?
|
149
|
+
|
150
|
+
Set callback to track location changes.
|
151
|
+
|
152
|
+
:::ruby
|
153
|
+
GeoLocation.set_notification(
|
154
|
+
callback, callback_params="", ping_gpssystem_timeout=0)
|
155
|
+
|
156
|
+
* callback - callback url; it will be called only once, to have it called again, you need to call set_notification again.
|
157
|
+
* ping_gpssystem_timeout - optional, if 0 system timeout used, use to redefine timeout in sec for gps system reading
|
158
|
+
* callback params: known_position, latitude, longitude, available, status('error', 'ok'), error_code(from RhoError)
|
159
|
+
|
160
|
+
Get the distance between two points in miles
|
161
|
+
:::ruby
|
162
|
+
GeoLocation.haversine_distance(
|
163
|
+
latitude1, longitude1, latitude2, longitude2)
|
164
|
+
|
165
|
+
#### Testing GeoLocation
|
166
|
+
|
167
|
+
While developing your application on Windows Mobile emulator, you may find [FakeGPS](http://msdn.microsoft.com/en-us/library/bb158722.aspx) utility useful.
|
168
|
+
|
169
|
+
Before testing on BB simulator select menu Simulate/GPS Location and set your position.
|
170
|
+
|
171
|
+
To provide Mock Location Data on Android see [here](http://developer.android.com/guide/topics/location/index.html)
|
172
|
+
|
173
|
+
#### Samples
|
174
|
+
|
175
|
+
##### Tracking location all the time
|
176
|
+
You may decide to keep track of your position right after application starts. To do that, add following to your application.rb:
|
177
|
+
|
178
|
+
:::ruby
|
179
|
+
class AppApplication < Rho::RhoApplication
|
180
|
+
def on_activate_app
|
181
|
+
#start geolocation
|
182
|
+
GeoLocation.set_notification("/app/Settings/geo_callback", "")
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
Callback points to the `geo_callback` in the Settings controller.rb:
|
187
|
+
|
188
|
+
:::ruby
|
189
|
+
class SettingsController < Rho::RhoController
|
190
|
+
def geo_callback
|
191
|
+
puts "geo_callback : #{@params}"
|
192
|
+
# do something on position changes
|
193
|
+
#...
|
194
|
+
# Reset callback
|
195
|
+
GeoLocation.set_notification("/app/Settings/geo_callback", "")
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
|
200
|
+
##### Requiring location only on a specific view
|
201
|
+
|
202
|
+
:::ruby
|
203
|
+
def show_location
|
204
|
+
# check if we know our position
|
205
|
+
if !GeoLocation.known_position?
|
206
|
+
# wait till GPS receiver acquire position
|
207
|
+
GeoLocation.set_notification( url_for(:action => :geo_callback), "")
|
208
|
+
redirect wait
|
209
|
+
else
|
210
|
+
# show position
|
211
|
+
render
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
def geo_callback
|
216
|
+
# navigate to `show_location` page if GPS receiver acquire position
|
217
|
+
if @params['known_position'].to_i != 0 && @params['status'] =='ok'
|
218
|
+
WebView.navigate url_for(:action => :show_location)
|
219
|
+
end
|
220
|
+
# show error if timeout expired and GPS receiver didn't acquire position
|
221
|
+
if @params['available'].to_i == 0 || @params['status'] !='ok'
|
222
|
+
WebView.navigate url_for(:action => :show_location_error)
|
223
|
+
end
|
224
|
+
# do nothing, still wait for location
|
225
|
+
end
|
226
|
+
|
227
|
+
#### Code Sample
|
228
|
+
|
229
|
+
See controller and view in the /app/GeoLocation folder of the [ System API Samples application](http://github.com/rhomobile/rhodes-system-api-samples/tree/master/app/GeoLocation/controller.rb) for more information
|
230
|
+
|
231
|
+
## PIM Contacts
|
232
|
+
|
233
|
+
Rhodes provides access to the device's local phone book and stored contacts via the Ruby class RhoContact.
|
234
|
+
|
235
|
+
The following methods are available in the RhoContact class:
|
236
|
+
|
237
|
+
Return hash of hashes of all contacts stored in the phonebook (index):
|
238
|
+
:::ruby
|
239
|
+
Rho::RhoContact.find(:all)
|
240
|
+
|
241
|
+
Return hash of all properties of the contact identified by the provided id (show):
|
242
|
+
:::ruby
|
243
|
+
Rho::RhoContact.find(@params['id'])
|
244
|
+
|
245
|
+
Create new contact in the phonebook, set properties of the contact passed as parameter hash, and save created phonebook record (create).
|
246
|
+
:::ruby
|
247
|
+
Rho::RhoContact.create!(@params['contact'])
|
248
|
+
|
249
|
+
Find contact record in the phonebook, update record properties from the has passed as parameter and save updated record. Contact id passed in the hash (update):
|
250
|
+
:::ruby
|
251
|
+
Rho::RhoContact.update_attributes(@params['contact'])
|
252
|
+
|
253
|
+
Remove contact identified by the provided id from the phonebook. (delete)
|
254
|
+
:::ruby
|
255
|
+
Rho::RhoContact.destroy(@params['id'])
|
256
|
+
|
257
|
+
On all devices, properties currently supported are: "id","first_name","last_name","mobile_number","home_number","business_number","email_address","company_name"
|
258
|
+
|
259
|
+
On iPhone, additional contact properties are supported.
|
260
|
+
|
261
|
+
General:
|
262
|
+
"prefix", "first_name", "middle_name", "last_name", "suffix", "nickname",
|
263
|
+
"birthday", "anniversary", "created", "updated",
|
264
|
+
"company_name", "job_title", "assistant_name", "assistant_number",
|
265
|
+
"spouse_name", "person_note"
|
266
|
+
|
267
|
+
**NOTE: "birthday", "anniversary", "created", "updated" properties expect a date formatted as YYYY-MM-DD**
|
268
|
+
|
269
|
+
Addresses:
|
270
|
+
"street_address_1", "city_1", "state_1", "zip_1", "country_1"
|
271
|
+
"street_address_2", "city_2", "state_2", "zip_2", "country_2"
|
272
|
+
"street_address_3", "city_3", "state_3", "zip_3", "country_3"
|
273
|
+
|
274
|
+
**NOTE: Address 1 is mapped to "work," 2 is to "home," 3 is to "other."**
|
275
|
+
|
276
|
+
Email addresses:
|
277
|
+
"email_address", "home_email_address", "other_email_address"
|
278
|
+
**NOTE: "email_address" is mapped to "work" **
|
279
|
+
|
280
|
+
Phone numbers:
|
281
|
+
"business_number", "home_number", "mobile_number", "main_number", "pager_number", "home_fax", "work_fax"
|
282
|
+
|
283
|
+
Home pages:
|
284
|
+
"home_page"
|
285
|
+
|
286
|
+
### Sample
|
287
|
+
For examples on how to use the API provided by this class, see the view and controller in the /app/Contacts folder in the [System API Samples application](http://github.com/rhomobile/rhodes-system-api-samples/tree/master/app/Contacts/controller.rb).
|
288
|
+
|
289
|
+
## PIM Calendar/Events
|
290
|
+
Rhodes provides access to the device's local calendar and stored events via the Ruby class RhoEvent.
|
291
|
+
|
292
|
+
Check if the device has a calendar:
|
293
|
+
:::ruby
|
294
|
+
System::get_property('has_calendar')
|
295
|
+
|
296
|
+
The following methods are available in the RhoContact class:
|
297
|
+
|
298
|
+
Return hash of hashes of all events stored in the calendar (index):
|
299
|
+
:::ruby
|
300
|
+
Rho::RhoEvent.find(:all)
|
301
|
+
|
302
|
+
Return hash of all properties of the event identified by the provided id (show):
|
303
|
+
:::ruby
|
304
|
+
Rho::RhoEvent.find(@params['id'])
|
305
|
+
|
306
|
+
Return hash of all properties of the events found by specified parameters (index):
|
307
|
+
:::ruby
|
308
|
+
Rho::RhoEvent.find(:all, :start_date=>start,
|
309
|
+
:end_date => endtime, :find_type=>'starting', :include_repeating => true )
|
310
|
+
|
311
|
+
* start_date, end_date - define range where at least one of the Event's occurrences falls, inclusive.
|
312
|
+
* find_type - determines the criteria for matching an event occurrence;
|
313
|
+
* 'starting' searches for events starting between start_date and end_date,
|
314
|
+
* 'ending' searches for events ending between start_date and end_date,
|
315
|
+
* 'occurring' searches for events that have any part of the event occurring during the period specified by start_date and end_date.
|
316
|
+
* include_repeating - if false then only search based on an Event's START and END values and do not calculate repeating occurrences of the event; if true then repeating occurrences of an Event are included during the search.
|
317
|
+
|
318
|
+
Create new event in the calendar, set properties of the event from passed as parameter hash, and save created calendar event (create):
|
319
|
+
:::ruby
|
320
|
+
Rho::RhoEvent.create!(@params['event'])
|
321
|
+
|
322
|
+
Find event in the calendar, update record properties from the has passed as parameter and save updated event. Event id passed in the hash (update):
|
323
|
+
:::ruby
|
324
|
+
Rho::RhoEvent.update_attributes(@params['event'])
|
325
|
+
|
326
|
+
Rho::RhoEvent.destroy(@params['id']) #=> remove event identified by the provided id from the calendar. (delete)
|
327
|
+
</source>
|
328
|
+
|
329
|
+
On all devices, properties currently supported are: "id","title","location","notes","start_date","end_date"
|
330
|
+
|
331
|
+
On Blackberry and Windows mobile additional contact properties are supported. These are:
|
332
|
+
"reminder"(in minutes), "privacy"('public', 'private', 'confidential')
|
333
|
+
|
334
|
+
Recurrence properties:
|
335
|
+
"recurrence", "frequency"('daily', 'weekly', 'monthly', 'yearly'), "interval", "end_date" , "days"(array of 7 items, 1 - means event is triggered - Mon-Sun), "months" ( array of 12 items, Jan-Dec), "weeks"(array of 5 items, first-fifth ), "count"(how many occurrences),
|
336
|
+
"day_of_month"(1..31)
|
337
|
+
|
338
|
+
On iPhone and Android additional event properties are supported. These are:
|
339
|
+
"canceled", "organizer", "attendees", "last_modified",
|
340
|
+
|
341
|
+
Recurrence properties:
|
342
|
+
"recurrence", "frequency"('daily', 'weekly', 'monthly', 'yearly'), "interval"
|
343
|
+
|
344
|
+
### Sample
|
345
|
+
For examples on how to use the API provided by this class, see the view and controller in the /app/Calendar folder in the [System API Samples application](http://github.com/rhomobile/rhodes-system-api-samples/tree/master/app/Calendar/controller.rb).
|
346
|
+
|
347
|
+
## Camera
|
348
|
+
|
349
|
+
Check if the device has a camera:
|
350
|
+
:::ruby
|
351
|
+
System::get_property('has_camera')
|
352
|
+
|
353
|
+
The Camera API provides the following functionality:
|
354
|
+
|
355
|
+
Take a picture:
|
356
|
+
:::ruby
|
357
|
+
Camera::take_picture('/app/model/camera_callback')
|
358
|
+
|
359
|
+
Choose a picture from an album:
|
360
|
+
:::ruby
|
361
|
+
Camera::choose_picture('/app/model/camera_callback')
|
362
|
+
|
363
|
+
Once the user has taken/chosen a picture, the callback URL you specified will be called. The callback is a POST message; the body of the message contains the return status and image_uri.
|
364
|
+
|
365
|
+
* Status is 'ok', 'cancel', or 'error'
|
366
|
+
* image_uri points to the taken/chosen image stored in the /public/db-files folder; the image file will have auto-generated name.
|
367
|
+
|
368
|
+
### Sample
|
369
|
+
See controller and view in the /app/Image folder of the [ System API Samples application](http://github.com/rhomobile/rhodes-system-api-samples/tree/master/app/Image/controller.rb) for more information.
|
370
|
+
|
371
|
+
## Barcode
|
372
|
+
|
373
|
+
The Barcode API allows to try recognize barcode on an image:
|
374
|
+
:::ruby
|
375
|
+
Barcode.barcode_recognize(image_file_full_path)
|
376
|
+
|
377
|
+
Barcode recognition functionality realized as Rhode Native extension. You should add "Barcode" to extension list in build.yml located in your application folder. `Barcode.barcode_recognize(image_file_full_path)` return string with recognized code or emty string if not any recognized barcodes on the image. You can combine Camera for get picture with Barcode recognition for process barcode data - see sample below.
|
378
|
+
|
379
|
+
For barcode recognition we use Zbar library (iPhone, Android and Windows Mobile platforms) and ZXing library (BlackBerry platform). In this case we support next barcode types :
|
380
|
+
|
381
|
+
* iPhone, Android and WM platforms: UPC-A, UPC-E, EAN-8, EAN-13, Code 39, Code 128, .
|
382
|
+
* BlackBerry platform: UPC-A, UPC-E, EAN-8, EAN-13, Code 39, Code 128, Code 93, QR Code, ITF, Codabar
|
383
|
+
|
384
|
+
### Sample
|
385
|
+
See controller and view in the /app/BarcodeRecognizer folder of the [System API Samples application](http://github.com/rhomobile/rhodes-system-api-samples/tree/master/app/BarcodeRecognizer/controller.rb) for more information.
|
386
|
+
|
387
|
+
## Signature Capture
|
388
|
+
|
389
|
+
The Signature Capture API allow take a signature and save it as an image:
|
390
|
+
:::ruby
|
391
|
+
SignatureTool::take_signature(callback_url, image_format)
|
392
|
+
|
393
|
+
Signature Capture open window for hand writing, where user draw his signature. Signature saved to an image file. You can choice 'jpg' or 'png' format for image.
|
394
|
+
|
395
|
+
After user entered signature (or canceled) provided callback url will be called. Callback parameters will be:
|
396
|
+
* status - 'ok' or 'cancel'
|
397
|
+
* signature_uri - path to the image with signature
|
398
|
+
|
399
|
+
### Sample
|
400
|
+
See controller and view in the /app/SignatureUtil folder of the [System API Samples application](http://github.com/rhomobile/rhodes-system-api-samples/tree/master/app/SignatureUtil/controller.rb) for more information.
|
401
|
+
|
402
|
+
## Bluetooth
|
403
|
+
|
404
|
+
Bluetooth API provide access to Bluetooth serial port connection between phone and another phone, phone and PC, phone and external Bluetooth device (for example external Bluetooth GPS device).
|
405
|
+
|
406
|
+
Currently Bluetooth support have following limitations:
|
407
|
+
|
408
|
+
* on Apple device (iPhone, iPad etc.) you can connect only to another Apple device
|
409
|
+
* on Blackberry if you want to make client connection to any device, you should pair devices only when on another device running server service, because it need for add paired device to list of devices with support serial port profile - only that devices you can see in the list of devices to connect
|
410
|
+
* on any platform, except iPhone, you should pair you devices before make connection
|
411
|
+
* you can change local device name for display on another device only on iOS and Android platform - for WM and BB use system settings for change local device name
|
412
|
+
* you can not see another device name, when you using server connection on BlackBerry
|
413
|
+
* only one connection session can created and using on any device in this time. You should close current session before make another session.
|
414
|
+
* one-to-few peers connection scheme is unsupported now.
|
415
|
+
|
416
|
+
Do not forget add special "bluetooth" capability into your application's build.yml config - it critical for Android.
|
417
|
+
|
418
|
+
There are two steps to make connection and start using of Bluetooth :
|
419
|
+
|
420
|
+
* Make connection session: execute `Rho::BluetoothManager.create_session` and setup callback where you receive result of connection. That callback will get events related to making connection(connect ok, canceled by user, error). Connection provided by platform specific UI.
|
421
|
+
* After receiving successful result and name of connected device in create_session_callback you should setup session_callback by `Rho::BluetoothSession.set_callback` to process incoming session events from connected device (data received) or event related to this session connection(disconnect, errors).
|
422
|
+
|
423
|
+
### Bluetooth API
|
424
|
+
|
425
|
+
#### BluetoothManager
|
426
|
+
|
427
|
+
Get availability of Bluetooth on the device. Return true/false:
|
428
|
+
:::ruby
|
429
|
+
Rho::BluetoothManager.is_bluetooth_available
|
430
|
+
|
431
|
+
Switch Bluetooth off:
|
432
|
+
:::ruby
|
433
|
+
Rho::BluetoothManager.off_bluetooth
|
434
|
+
|
435
|
+
|
436
|
+
Change local device name:
|
437
|
+
:::ruby
|
438
|
+
Rho::BluetoothManager.set_device_name(name)
|
439
|
+
|
440
|
+
Get local device name for current device (this name displayed on another device)
|
441
|
+
:::ruby
|
442
|
+
Rho::BluetoothManager.get_device_name
|
443
|
+
|
444
|
+
Get last error. Returns OK/ERROR/CANCEL
|
445
|
+
:::ruby
|
446
|
+
Rho::BluetoothManager.get_last_error
|
447
|
+
|
448
|
+
|
449
|
+
Creates Bluetooth session. Return OK/ERROR:
|
450
|
+
:::ruby
|
451
|
+
Rho::BluetoothManager.create_session(role, callback_url)
|
452
|
+
|
453
|
+
* role - may be ROLE_SERVER or ROLE_CLIENT
|
454
|
+
* callback_url - this url will be called after session was created or canceled. Parameters received in the callback:
|
455
|
+
* status - OK / ERROR / CANCEL
|
456
|
+
* connected_device_name - name of the connected device
|
457
|
+
|
458
|
+
|
459
|
+
#### BluetoothSession
|
460
|
+
|
461
|
+
Set Bluetooth session callback
|
462
|
+
:::ruby
|
463
|
+
Rho::BluetoothSession.set_callback(
|
464
|
+
connected_device_name, session_callback_url)
|
465
|
+
* connected_device_name - name of the connected device
|
466
|
+
* return OK/ERROR
|
467
|
+
* parameters in callback:
|
468
|
+
* 'connected_device_name' - name of connected device
|
469
|
+
* 'event_type' - SESSION_INPUT_DATA_RECEIVED / ERROR / SESSION_DISCONNECT
|
470
|
+
|
471
|
+
Disconnect from the device
|
472
|
+
:::ruby
|
473
|
+
Rho::BluetoothSession.disconnect(connected_device_name)
|
474
|
+
* connected_device_name - name of the connected device
|
475
|
+
* return OK/ERROR
|
476
|
+
|
477
|
+
Get session status
|
478
|
+
:::ruby
|
479
|
+
Rho::BluetoothSession.get_status(connected_device_name)
|
480
|
+
* return received but not read data size; -1 if error, 0 if empty(not actually received data)
|
481
|
+
|
482
|
+
Read data
|
483
|
+
:::ruby
|
484
|
+
Rho::BluetoothSession.read(connected_device_name)
|
485
|
+
* connected_device_name - name of the connected device
|
486
|
+
* return array of bytes
|
487
|
+
|
488
|
+
Write data
|
489
|
+
:::ruby
|
490
|
+
Rho::BluetoothSession.write(connected_device_name, data)
|
491
|
+
* connected_device_name - name of the connected device
|
492
|
+
* data must be array of byte/fixnum
|
493
|
+
|
494
|
+
Read string
|
495
|
+
:::ruby
|
496
|
+
Rho::BluetoothSession.read_string(connected_device_name)
|
497
|
+
* connected_device_name - name of the connected device
|
498
|
+
* return string
|
499
|
+
|
500
|
+
Write string
|
501
|
+
:::ruby
|
502
|
+
Rho::BluetoothSession.write_string(connected_device_name, data)
|
503
|
+
* connected_device_name - name of the connected device
|
504
|
+
* data must be a string
|
505
|
+
* return OK/ERROR
|
506
|
+
|
507
|
+
|
508
|
+
### Example of Controller with using Bluetooth API
|
509
|
+
|
510
|
+
It is not complete example (link to complete example see below). This code just show how you can make connection and send/receive strings.
|
511
|
+
:::ruby
|
512
|
+
require 'rho/rhocontroller'
|
513
|
+
require 'rho/rhobluetooth'
|
514
|
+
|
515
|
+
class BluetoothController < Rho::RhoController
|
516
|
+
@layout = :simplelayout
|
517
|
+
$connected_device = nil
|
518
|
+
|
519
|
+
def index
|
520
|
+
render
|
521
|
+
end
|
522
|
+
|
523
|
+
def start_bluetooth
|
524
|
+
if Rho::BluetoothManager.is_bluetooth_available()
|
525
|
+
Rho::BluetoothManager.create_session(Rho::BluetoothManager::ROLE_CLIENT, url_for( :action => :connection_callback))
|
526
|
+
end
|
527
|
+
end
|
528
|
+
|
529
|
+
def send_string(str)
|
530
|
+
Rho::BluetoothSession.write_string($connected_device, str)
|
531
|
+
end
|
532
|
+
|
533
|
+
def connection_callback
|
534
|
+
if @params['status'] == Rho::BluetoothManager::OK
|
535
|
+
$connected_device = @params['connected_device_name']
|
536
|
+
Rho::BluetoothSession.set_callback($connected_device, url_for( :action => :session_callback))
|
537
|
+
send_string('Hello friend !')
|
538
|
+
end
|
539
|
+
end
|
540
|
+
|
541
|
+
def session_callback
|
542
|
+
if @params['event_type'] == Rho::BluetoothSession::SESSION_INPUT_DATA_RECEIVED
|
543
|
+
while Rho::BluetoothSession.get_status($connected_device) > 0
|
544
|
+
str = Rho::BluetoothSession.read_string($connected_device)
|
545
|
+
|
546
|
+
# use received string
|
547
|
+
|
548
|
+
end
|
549
|
+
end
|
550
|
+
end
|
551
|
+
|
552
|
+
def close_all
|
553
|
+
Rho::BluetoothSession.disconnect($connected_device)
|
554
|
+
Rho::BluetoothManager.off_bluetooth()
|
555
|
+
end
|
556
|
+
|
557
|
+
end
|
558
|
+
|
559
|
+
### Example of chat application using Bluetooth connection
|
560
|
+
|
561
|
+
You can find complete example of using Bluetooth API in [Rhodes-System-Api-Samples](http://github.com/rhomobile/rhodes-system-api-samples). See Bluetooth Chat Demo page - [BluetoothChat](http://github.com/rhomobile/rhodes-system-api-samples/tree/master/app/BluetoothChat/). In this example you can see how to exchange text messages between two different devices. You also can use this example for connect to external Bluetooth device (external GPS device for example) or PC or Mac (use terminal to see and send messages).
|
562
|
+
|
563
|
+
## Ringtone manager
|
564
|
+
|
565
|
+
The Ringtone manager API provides access to view/play the user's installed ringtones.
|
566
|
+
|
567
|
+
Get all available ringtones
|
568
|
+
:::ruby
|
569
|
+
@ringtones = RingtoneManager::get_all_ringtones
|
570
|
+
* The variable returned by get_all_ringtones will be a hash containing key/value pairs, where the key is the user-friendly name of ringtone, and the value is its full file name.
|
571
|
+
|
572
|
+
Play a given ringtone
|
573
|
+
:::ruby
|
574
|
+
RingtoneManager::play @ringtones['My Ringtone']
|
575
|
+
NOTE: that if 'play' is called while another ringtone is playing, it will stop the old ringtone and start the new one.
|
576
|
+
|
577
|
+
Halt playing of a ringtone
|
578
|
+
:::ruby
|
579
|
+
RingtoneManager::stop
|
580
|
+
* Can safely be called even if no ringtone is playing
|
581
|
+
|
582
|
+
NOTE: Currently implemented for Android, Blackberry and Windows mobile. On Blackberry, only the user installed ringtones are accessible. System preinstalled ringtones are not accessible due to Blackberry limitations.
|
583
|
+
|
584
|
+
### Sample
|
585
|
+
See controller and view in the /app/Ringtones folder of the [System API Samples application](http://github.com/rhomobile/rhodes-system-api-samples/tree/master/app/Ringtones/controller.rb) for more information.
|
586
|
+
|
587
|
+
## PUSH Notifications
|
588
|
+
Push notification support is currently available for Android, Blackberry and iPhone.
|
589
|
+
|
590
|
+
Testing push is a little more involved than some other features because it requires additional setup on both the RhoSync application and Rhodes application. Please refer to [RhoSync Device Push](/rhosync/push) for more information.
|
591
|
+
|
592
|
+
### Setup
|
593
|
+
|
594
|
+
First, enable push in your rhodes application in build.yml:
|
595
|
+
|
596
|
+
:::yaml
|
597
|
+
capabilities:
|
598
|
+
- push
|
599
|
+
- vibrate #=> if you want to enable vibrate in your push messages
|
600
|
+
|
601
|
+
Next, your RhoSync application should be running on a network that is accessible to your device. For example, you might have your RhoSync application running on a LAN with IP 192.168.1.10, PORT 9292. Then make sure your device is connected to the same LAN and setup your application [rhoconfig.txt](configuration#run-time-configuration) syncserver as follows:
|
602
|
+
|
603
|
+
syncserver = 'http://192.168.1.10:9292/application'
|
604
|
+
|
605
|
+
Now your Rhodes application is configured to receive push messages.
|
606
|
+
|
607
|
+
### iPhone
|
608
|
+
iPhone PUSH support uses the Apple Push Notification Service (APNS) introduced in iPhone SDK 3.0. In order to use the service, you will need to obtain a push-enabled provisioning profile and a server-side push certificate used for encrypting RhoSync->APNS traffic.
|
609
|
+
|
610
|
+
NOTE: For testing push, you will need to build and deploy your application to a physical iPhone (or iPad) device. Apple does not support testing push on simulators.
|
611
|
+
|
612
|
+
#### Setup Push Certificate
|
613
|
+
The first step to setting up your environment is to create an APNS push certificate. To create the SSL certificate, follow the "Creating the SSL Certificate and Keys" section on the
|
614
|
+
[developer site](https://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ProvisioningDevelopment/ProvisioningDevelopment.html#//apple_ref/doc/uid/TP40008194-CH104-SW4).
|
615
|
+
|
616
|
+
Once you have the certificate, you will need to export it to a .pem format using [these instructions](https://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ProvisioningDevelopment/ProvisioningDevelopment.html#//apple_ref/doc/uid/TP40008194-CH104-SW6). Make sure to name the output file 'apple_push_cert.pem' file from these instructions, since this is what we configured in our RhoSync application.
|
617
|
+
|
618
|
+
Once you have this file, copy it to your RhoSync application directory under the settings folder:
|
619
|
+
|
620
|
+
:::term
|
621
|
+
$ cd myrhosyncapp
|
622
|
+
$ cp /path/to/apple_push_cert.pem settings/apple_push_cert.pem
|
623
|
+
|
624
|
+
Now your RhoSync application is ready to send APNS messages.
|
625
|
+
|
626
|
+
#### Setup Provisioning Profile
|
627
|
+
Next, you can setup your Apple Push Provisioning Profile using Apple's [developer site instructions](https://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ProvisioningDevelopment/ProvisioningDevelopment.html#//apple_ref/doc/uid/TP40008194-CH104-SW5). Once you have the profile installed in XCode and on your test device, you are ready to test push.
|
628
|
+
|
629
|
+
#### Setup iPhone Device
|
630
|
+
Setting up the device is the same process as [building any normal Rhodes application](build#build-for-iphoneipad). When you start the application, make sure to also open the console window (cmd-shift-R). When the application starts, you should see some output in the console that shows the device token (towards the top):
|
631
|
+
|
632
|
+
2010-08-19 10:14:22.627 rhorunner[1486:307] Device token is <10fd92ab fa8ee481 55d9af6e 73290863 22b323fd 0d18fdbd 19e92d03 c0fef7c8>
|
633
|
+
|
634
|
+
This confirms that your application is running with push enabled. Once you login to the RhoSync application and sync, you will see the device registered on the RhoSync console under the user id you used to login. Now you are ready to [test push from your RhoSync application](/rhosync/push#testing-push-in-the-web-console).
|
635
|
+
|
636
|
+
### Android
|
637
|
+
Android PUSH support uses the Android Cloud to Device Messaging (AC2DM) system introduced in Android 2.2 (Froyo). In order to use the service, you will need to register your role-based google account (or use existing one) and then register this account in [Google C2DM program](http://code.google.com/android/c2dm/signup.html).
|
638
|
+
|
639
|
+
Here are some guidelines for developing and testing an Android application that uses the C2DM feature:
|
640
|
+
|
641
|
+
* To develop and test your C2DM applications, you need to run and debug the applications on an Android 2.2 system image that includes the necessary underlying Google services.
|
642
|
+
* To develop and debug on an actual device, you need a device running an Android 2.2 system image that includes the Market application.
|
643
|
+
* To develop and test on the Android Emulator, you need to download the Android 2.2 version of the Google APIs Add-On into your SDK using the Android SDK and AVD Manager. Specifically, you need to download the component named "Google APIs by Google Inc, Android API 8". Then, you need to set up an AVD that uses that system image.
|
644
|
+
* Android C2DM system uses an existing connection for Google services. This requires users to set up their Google account on their mobile devices (and on emulator!).
|
645
|
+
|
646
|
+
#### Setup application
|
647
|
+
As first step, register role-based google account for your application. Here for example it will be referred as push-app@gmail.com.
|
648
|
+
|
649
|
+
Then modify your application's build.yml and specify there google account used to send PUSH messages:
|
650
|
+
|
651
|
+
:::yaml
|
652
|
+
android:
|
653
|
+
push:
|
654
|
+
sender: push-app@gmail.com
|
655
|
+
|
656
|
+
This is the same address used by RhoSync to retrieve authtoken. See [here](/rhosync/push#android) for more information.
|
657
|
+
|
658
|
+
NOTE: **WARNING** This e-mail address MUST NOT be the same as origin of google account on phone! This mean that google account registered on your phone/emulator MUST NOT be push-app@gmail.com; it MUST be another one. This is known bug in Android C2DM implementation - if sender and receiver are the same, underlying android service crash and lose message. More details [here](http://groups.google.com/group/android-c2dm/browse_thread/thread/128790789c4e9d6a/67aca1e1764724d4).
|
659
|
+
|
660
|
+
### BlackBerry
|
661
|
+
Notifications to BlackBerry are sent using PAP 2.0 message through a BES/MDS server.
|
662
|
+
|
663
|
+
On the simulator, this is done via the MDS simulator tool (which you've probably already seen in the form of a console window everytime you do 'rake run:bb'). On the device, this is done through the BES/MDS server that the phone is configured to use.
|
664
|
+
|
665
|
+
These instructions assume you are familiar with BES/MDS concepts (for more information please see [here](http://na.blackberry.com/eng/services/business/server/full/)).
|
666
|
+
|
667
|
+
#### Setup MDS Simulator
|
668
|
+
<i>Make sure you close the BlackBerry simulator and MDS simulator before continuing for your changes to take effect!</i>
|
669
|
+
|
670
|
+
To enable the push port in your MDS simulator, edit the following file:
|
671
|
+
|
672
|
+
C:\Program Files\Research In Motion\BlackBerry JDE <VERSION YOU ARE BUILDING>\MDS\config\rimpublic.property
|
673
|
+
|
674
|
+
Uncomment the last line of the file, which should be 'push.application.reliable.ports=100':
|
675
|
+
|
676
|
+
push.application.reliable.ports=100
|
677
|
+
|
678
|
+
#### Setup BlackBerry Simulator
|
679
|
+
To listen for incoming messages on BlackBerry, the Rhodes application will start when device powers on and will run a listener thread in the background. You will use the "push_port" option in the [rhoconfig.txt](configuration#run-time-configuration) to specify the listening port for incoming push messages. If "push_port" is not specified, default will be 100 as shown in the previous section.
|
680
|
+
|
681
|
+
NOTE: For testing push, the BlackBerry simulator requires a 'kickstart' process. When the simulator starts, open the web browser on the simulator and navigate to any web page (i.e. http://m.google.com/). Now your simulator is ready to receive push messages.
|
682
|
+
|
683
|
+
Now you are ready to [testing Push in the RhoSync Web Console](/rhosync/push#testing-push-in-the-web-console).
|
684
|
+
|
685
|
+
#### Setup BlackBerry Device
|
686
|
+
To test push on a BlackBerry device, you will need to use a device that is configured with a BES server. Then, all you need to do is [build your Rhodes application for the device](build#build-for-blackberry).
|
687
|
+
|
688
|
+
#### BlackBerry 5.0 Push service
|
689
|
+
Rhodes 2.2 and higher support new [Blackberry Push Service](http://na.blackberry.com/eng/developers/javaappdev/pushapi.jsp)
|
690
|
+
|
691
|
+
Define in [rhoconfig.txt](configuration#run-time-configuration) which push to use (if empty or missed only MDS push is supported).
|
692
|
+
|
693
|
+
push_options = 'mds;push_service'
|
694
|
+
|
695
|
+
These parameters from [PushApplicationDescriptor](http://www.blackberry.com/developers/docs/5.0.0api/net/rim/blackberry/api/push/PushApplicationDescriptor.html). Set them in [rhoconfig.txt](configuration#run-time-configuration):
|
696
|
+
|
697
|
+
push_service_url = 'https://pushapi.eval.blackberry.com/'
|
698
|
+
push_service_port = 20558
|
699
|
+
push_service_appname = 'RhoTest'
|
700
|
+
push_service_type = 'BPAS'
|
701
|
+
|
702
|
+
### Push Callback
|
703
|
+
Rhodes applications can also handle PUSH notifications that didn't come from a RhoSync application.
|
704
|
+
|
705
|
+
In this example, we will get the device ID so we can register the device with some push server:
|
706
|
+
:::ruby
|
707
|
+
System.get_property('device_id')
|
708
|
+
|
709
|
+
Application can set push callback to process any commands from server:
|
710
|
+
:::ruby
|
711
|
+
System.set_push_notification("/app/Settings/push_notify", '')
|
712
|
+
|
713
|
+
Callback parameters:
|
714
|
+
|
715
|
+
* since Rhodes 2.0.4 : contain push message parameters as hash
|
716
|
+
* rhodes < 2.0.4 : message - contain server push message body
|
717
|
+
|
718
|
+
Callback return:
|
719
|
+
|
720
|
+
* empty string - do not run Rhodes push command processing
|
721
|
+
* "rho_push" - to run rhodes push command processing (for alerts, sounds, etc...)
|
722
|
+
|
723
|
+
Example:
|
724
|
+
:::ruby
|
725
|
+
def push_notify
|
726
|
+
puts 'push_notify: ' + @params.inspect
|
727
|
+
"rho_push"
|
728
|
+
end
|
729
|
+
|
730
|
+
### Push Payload
|
731
|
+
The Rhodes push payload allows more than one operation in a single message.
|
732
|
+
|
733
|
+
There are no required operations. There are default operations - if operation is not specified, no default operation will be performed.
|
734
|
+
|
735
|
+
In case of Blackberry if application in background, alert operation will bring application upfront; other operations will not.
|
736
|
+
In case of iPhone, regardless of operation, user will be presented with option to activate application if it is not running.
|
737
|
+
|
738
|
+
Payload may include following operations which client will perform when it receives the PUSH message:
|
739
|
+
|
740
|
+
do_sync - do sync on spec specified sync source; use "all" to sync all sources
|
741
|
+
:::ruby
|
742
|
+
# one or more sources, or "all" can be specified
|
743
|
+
do_sync = "Product,Customer"
|
744
|
+
|
745
|
+
alert - bring app upfront and show specified message
|
746
|
+
:::ruby
|
747
|
+
alert = "Some message"
|
748
|
+
|
749
|
+
vibrate - vibrate for the specified number of milliseconds, up to 25500; if 0 or no duration is specified, it will vibrate for 2500 millisecond.
|
750
|
+
:::ruby
|
751
|
+
vibrate = 2000 #=> duration in milliseconds
|
752
|
+
|
753
|
+
sound - play specified file if media type supported by the phone. iPhone will ignore media-type parameter.
|
754
|
+
:::ruby
|
755
|
+
sound = "hello.mp3"
|
756
|
+
|
757
|
+
File should be included to the application bundle in `/public/alerts` folder
|
758
|
+
|
759
|
+
In case of Blackberry, if file is in public folder, file name will be `/apps/public/alerts/test-file.mp3` Media type should be either specified explicitly or may be recognized from file extension. Known file extensions are: .mp3 - audio/mpeg; .wav - audio/x-wav
|
760
|
+
|
761
|
+
In case of iPhone, audio files should be placed in the `/public/alerts` folder and build script will copy them into root of the application main bundle (iPhone wouldn't play file from any other place).
|
762
|
+
|
763
|
+
## Alerts
|
764
|
+
|
765
|
+
In your controller, you may call on system alert methods to show popup, vibrate, or play audio file.
|
766
|
+
|
767
|
+
** show_popup ** - bring app upfront and show specified message
|
768
|
+
:::ruby
|
769
|
+
Alert.show_popup "Some message"
|
770
|
+
|
771
|
+
You can also customize popup window's title, icon, buttons and specify callback to be called on button click:
|
772
|
+
:::ruby
|
773
|
+
Alert.show_popup {
|
774
|
+
:message => 'Some message',
|
775
|
+
:title => 'Custom title',
|
776
|
+
:icon => '/public/images/icon.png',
|
777
|
+
:buttons => ["Yes", "No",
|
778
|
+
{:id => 'cancel', :title => 'Cancel all'}],
|
779
|
+
:callback => url_for(:action => :on_dissmiss_popup) }
|
780
|
+
|
781
|
+
Popup window always close after clicking on any button.
|
782
|
+
|
783
|
+
* :message - text to be displayed in popup window
|
784
|
+
* :title - title of the popup window
|
785
|
+
* :icon - image to be displayed in popup window. It's value can be one of predefined values or path to image file. Predefined values:
|
786
|
+
* :alert - '!' icon
|
787
|
+
* :question - '?' icon
|
788
|
+
* :info - informational icon
|
789
|
+
* :buttons - array of buttons for popup window. Each button defined by its id and title. Button can be specified by Hash with :id and :title keys or just String - in this case both id and title will be set to this value.
|
790
|
+
* :callback - url to be called when any of the button will be clicked. This callback will be called with @params hash containing three keys: :button_id, :button_title and :button_index.
|
791
|
+
|
792
|
+
Example:
|
793
|
+
:::ruby
|
794
|
+
def on_dismiss_popup
|
795
|
+
id = @params[:button_id]
|
796
|
+
title = @params[:button_title]
|
797
|
+
index = @params[:button_index]
|
798
|
+
if id == 'Yes'
|
799
|
+
# Handle 'Yes' button
|
800
|
+
elsif id == 'No'
|
801
|
+
# Handle 'No' button
|
802
|
+
elsif id == 'cancel'
|
803
|
+
# Handle 'Cancel all' button
|
804
|
+
end
|
805
|
+
end
|
806
|
+
|
807
|
+
|
808
|
+
** hide_popup ** - close current opened popup
|
809
|
+
:::ruby
|
810
|
+
Alert.hide_popup
|
811
|
+
|
812
|
+
** vibrate ** - vibrate for the specified number of milliseconds, up to 25500; if 0 or no duration is specified, it will vibrate for 2500 millisecond.
|
813
|
+
:::ruby
|
814
|
+
Alert.vibrate(duration_in_milliseconds)
|
815
|
+
|
816
|
+
|
817
|
+
** play_file ** - play specified file if media type supported by the phone. File should be included to the application. For example, if file is in public folder, file name will be `/apps/public/test-file.mp3` Media type should be either specified explicitly or may be recognized from file extension. Known file extensions are: .mp3 - audio/mpeg; .wav - audio/x-wav
|
818
|
+
:::ruby
|
819
|
+
Alert.play_file(file_name.ext, media_type)
|
820
|
+
|
821
|
+
** show_status ** - show status messages
|
822
|
+
:::ruby
|
823
|
+
Alert.show_status(title, status_text, hide_button_label)
|
824
|
+
|
825
|
+
Status window will close after clicking on hide button.
|
826
|
+
|
827
|
+
* status_text - text to be displayed in status window
|
828
|
+
* hide_button_label - label of hide button
|
829
|
+
|
830
|
+
For example you can use Alert.show_status in sync notification callback:
|
831
|
+
:::ruby
|
832
|
+
def sync_notify
|
833
|
+
status = @params['status'] ? @params['status'] : ""
|
834
|
+
Alert.show_status(
|
835
|
+
"Status",
|
836
|
+
"#{@params['source_name']} : #{status}",
|
837
|
+
Rho::RhoMessages.get_message('hide'))
|
838
|
+
end
|
839
|
+
|
840
|
+
## Screen rotation
|
841
|
+
When user rotate device, Rhodes update view corresponding to new orientation. To get notification about rotation use callback:
|
842
|
+
:::ruby
|
843
|
+
System.set_screen_rotation_notification(callback, params)
|
844
|
+
|
845
|
+
Callback will be called when screen rotate (available since Rhodes 2.0). Callback parameters will be: width, height, degrees
|
846
|
+
|
847
|
+
### Sample
|
848
|
+
See controller and view in the /app/ScreenRotation folder of the [System API Samples application](http://github.com/rhomobile/rhodes-system-api-samples/tree/master/app/ScreenRotation/controller.rb) for more information.
|
849
|
+
|
850
|
+
## Run external application
|
851
|
+
Use System.open_url : you can provide any url with any schema(http, file etc), depending of platform will be run associated application to handle this url
|
852
|
+
:::ruby
|
853
|
+
System.open_url('http://www.rhomobile.com')
|
854
|
+
|
855
|
+
Use rho_open_target=_blank in html link. Note that jqtouch or other javascript library may disable this attribute.
|
856
|
+
:::html
|
857
|
+
<a href="http://www.google.com/?rho_open_target=_blank">Open Google in external browser</a>
|
858
|
+
|
859
|
+
### Sample
|
860
|
+
See CustomUri of [system API sample application](http://github.com/rhomobile/rhodes-system-api-samples/tree/master/app/CustomUri/controller.rb) for example.
|
861
|
+
|
862
|
+
## MapView
|
863
|
+
MapView class provides an embeddable map interface, similar to the one provided by the Maps application. The following code would go into your controller and the map appears on a whole page.
|
864
|
+
|
865
|
+
NOTE: in order to use it on Android, you need to install Google Add-on API and retrieve Google Map API key as described [here](build#build-for-android).
|
866
|
+
|
867
|
+
:::ruby
|
868
|
+
map_params = {
|
869
|
+
:settings => {:map_type => "hybrid",:region => [@params['latitude'], @params['longitude'], 0.2, 0.2],
|
870
|
+
:zoom_enabled => true,:scroll_enabled => true,:shows_user_location => false,
|
871
|
+
:api_key => 'Google Maps API Key'},
|
872
|
+
:annotations => [{:latitude => @params['latitude'], :longitude => @params['longitude'], :title => "Current location", :subtitle => ""},
|
873
|
+
{:street_address => "Cupertino, CA 95014", :title => "Cupertino", :subtitle => "zip: 95014",
|
874
|
+
:url => "/app/GeoLocation/show?city=Cupertino"},
|
875
|
+
{:street_address => "Santa Clara, CA 95051", :title => "Santa Clara", :subtitle => "zip: 95051",
|
876
|
+
:url => "/app/GeoLocation/show?city=Santa%20Clara"}]
|
877
|
+
}
|
878
|
+
MapView.create map_params
|
879
|
+
|
880
|
+
Map settings:
|
881
|
+
|
882
|
+
* map_type - widget may display maps of three types: standard, satellite, and hybrid
|
883
|
+
* region - two types allowed:
|
884
|
+
* [latitude,longitude,latitudeDelta,longitudeDelta]. The area currently displayed by the map view. The region encompasses both the latitude and longitude point on which the map is centered and the span of coordinates to display. The span values provide an implicit zoom value for the map. The larger the displayed area, the lower the amount of zoom. Similarly, the smaller the displayed area, the greater the amount of zoom.
|
885
|
+
* latitude,longitude - map coordinate of the region center
|
886
|
+
* latitudeDelta - the amount of north-to-south distance (measured in degrees) to display on the map. Unlike longitudinal distances, which vary based on the latitude, one degree of latitude is always approximately 111 kilometers (69 miles).
|
887
|
+
* longitudeDelta - the amount of east-to-west distance (measured in degrees) to display for the map region. The number of kilometers spanned by a longitude range varies based on the current latitude. For example, one degree of longitude spans a distance of approximately 111 kilometers (69 milies) at the equator but shrinks to 0 kilometers at the poles.
|
888
|
+
* {:center => center, :radius => radius}. Another way to define area displayed by the map view.
|
889
|
+
* center - string describing center of area. Can be any string allowed by google geocoding service. Examples: "1 infinite loop, cupertino, ca 95014", "California, USA", "37.365519,-121.982918"
|
890
|
+
* radius - radius of displayed area measured in degrees
|
891
|
+
* zoom_enabled - true if zoom of the map is enabled
|
892
|
+
* scroll_enabled - true if scrool of the map is enabled
|
893
|
+
* shows_user_location - true if current user location is displayed on the map
|
894
|
+
* api_key - Google Maps API Key (sign up for it here: http://code.google.com/apis/maps/signup.html). Note that this parameter is ignored on Android! For Android you should get another key and specify it in the app's build.yml as described [[Building_Rhodes_on_Supported_Platforms#Prerequisites_5|here]]
|
895
|
+
|
896
|
+
Annotations - array of map annotation objects (list of pins on the map). Annotation:
|
897
|
+
|
898
|
+
* latitude,longitude - map coordinate of the annotation
|
899
|
+
* street_address - if map coordinate is not specified, framework will attempt to obtain it using provided street address from google geo-coding service
|
900
|
+
* title - title of the annotation callout
|
901
|
+
* subtitle - subtitle of the annotation callout
|
902
|
+
* url - url to follow when user click on the callout button
|
903
|
+
|
904
|
+
### Sample
|
905
|
+
See GeoLocation/controller.rb of [system API sample application](http://github.com/rhomobile/rhodes-system-api-samples/tree/master/app/GeoLocation/controller.rb) for some of the examples of how to use MapView class.
|
906
|
+
|
907
|
+
## File system access
|
908
|
+
|
909
|
+
### Rhodes client file system structure
|
910
|
+
<rhodes root> #system-dependent path
|
911
|
+
apps #Rho::RhoApplication::get_base_app_path
|
912
|
+
app #Rho::RhoApplication::get_app_path('app') - contain models
|
913
|
+
model1 #Rho::RhoApplication::get_model_path('app','model1')
|
914
|
+
public #contains files from application public folder
|
915
|
+
db #contains schema and data files
|
916
|
+
db-files #contains files stored in database(blobs)
|
917
|
+
# for file paths from camera callback etc: Rho::RhoApplication::get_blob_path(relative_file_path);
|
918
|
+
# to create file path for blob: Rho::RhoApplication::get_blob_folder()
|
919
|
+
lib #contains rho framework library files. Blackberry does not has this folder, library files are stored in jar
|
920
|
+
RhoLog.txt #application log
|
921
|
+
|
922
|
+
### Read\write file example
|
923
|
+
:::ruby
|
924
|
+
fileName = File.join(Rho::RhoApplication::get_base_app_path(), 'myfile.txt')
|
925
|
+
File.open(fileName).each do |line|
|
926
|
+
end
|
927
|
+
|
928
|
+
fileNameW = File.join(Rho::RhoApplication::get_base_app_path(), 'tempfile.txt')
|
929
|
+
f = File.new(fileNameW)
|
930
|
+
f.write('test')
|
931
|
+
f.close
|
932
|
+
|
933
|
+
#binary file read\write
|
934
|
+
#to read file from blob attribute use Rho::RhoApplication::get_blob_path(image.image_uri) method
|
935
|
+
|
936
|
+
file_testname = File.join(Rho::RhoApplication::get_model_path('app','Data'), 'test.png')
|
937
|
+
test_content = File.binread(file_testname)
|
938
|
+
|
939
|
+
file_name = File.join(Rho::RhoApplication::get_base_app_path(), 'temp.png')
|
940
|
+
f = File.new(file_name, "wb")
|
941
|
+
f.write(test_content)
|
942
|
+
f.close
|
943
|
+
|
944
|
+
### Platform notes
|
945
|
+
|
946
|
+
#### Blackberry
|
947
|
+
Only read from files are supported as of 1.4 release
|
948
|
+
|
949
|
+
Simulator files folder (4.6 and bigger) - `<sdk root>/components/simulator/sdcard/rho/<appname>`
|
950
|
+
|
951
|
+
Device files folder can be found using Media/Explore.
|
952
|
+
|
953
|
+
#### iPhone
|
954
|
+
Simulator files folder - run search for RhoLog.txt from the drive root. Files are placed inside simulator folder.
|
955
|
+
|
956
|
+
Application can creates folders and files under apps and db roots.
|
957
|
+
|
958
|
+
#### Windows Mobile
|
959
|
+
Device/simulator files folder root - Program Files/<app name>/rho
|
960
|
+
|
961
|
+
#### Desktop win32 simulator
|
962
|
+
To use client with the HTTP proxy you should pass its URL as the first command line argument `-http_proxy_url=http://<login>:<passwod>@<host>:<port>` or add it to rhoconfig.txt.
|
963
|
+
|
964
|
+
## Shutdown hook
|
965
|
+
Like any application written in Ruby, rhodes can register a shutdown hook. Shutdown hook is routine registered for execution when the program exits. It usefull for cleanup on exit, saving program states, etc. To create you own shutdown hook you should add at_exit block to the file application.rb.
|
966
|
+
For example:
|
967
|
+
:::ruby
|
968
|
+
at_exit do
|
969
|
+
#delete all temporary files
|
970
|
+
...
|
971
|
+
...
|
972
|
+
end
|
973
|
+
|
974
|
+
## Media Support
|
975
|
+
Rhodes can play video/audio files in native Internet Browser. So application developer can just add link to online or local audio/video file:
|
976
|
+
:::html
|
977
|
+
<a href="http://videos3.netprofesseur.com/1/videos/130/BRICOLAGE_Changer_un_joints.mp4">Play mp4 online video</a>
|
978
|
+
|
979
|
+
Application can download file to file system using [AsyncHttp.download_file](call-web-services) and than put link [to this file](#file-system-access) to view.
|
980
|
+
|
981
|
+
### Sample
|
982
|
+
See app\Media of [System API Sample application](http://github.com/rhomobile/rhodes-system-api-samples/tree/master/app/Media/controller.rb) as an example.
|
983
|
+
|
984
|
+
## Using Hyperlinks for Email, Phone Dialing, SMS and others
|
985
|
+
|
986
|
+
You can allow your users to send email messages, call phone numbers and send SMS messages using the hyperlink (`<a href="...">`) syntax. Please note not all of these examples could work on simulators! Use real devices for test. Examples are shown below.
|
987
|
+
|
988
|
+
**mailto**
|
989
|
+
:::html
|
990
|
+
<a href="mailto:test@host.com?subject=testing123">Mailto</a>
|
991
|
+
Note, even for an empty address, you must add the @ symbol: <a href="mailto:@?subject=testing123">Mailto</a>
|
992
|
+
|
993
|
+
Blackberry: if you need cc, bcc feilds, use rhomailto scheme:
|
994
|
+
:::html
|
995
|
+
<a href="rhomailto:test@host.com?cc=geny@mail.ru&bcc=vasy@gmail.com&body=testMessage&subject=sub1">Send e-mail to test@host.com</a>
|
996
|
+
|
997
|
+
**tel**
|
998
|
+
:::html
|
999
|
+
<a href="tel:1-555-531-3255!8335033#!#!9582#">Tel</a>
|
1000
|
+
<a href="wtai://wp/mc;5195551212" title="Call">Work Tel</a>
|
1001
|
+
<a href="wtai://wp/mc;5195551213" title="Call">Home Tel</a>
|
1002
|
+
Note, the WML tel description can be found [ here](http://na.blackberry.com/eng/devjournals/resources/journals/oct_2004/wml_101.jsp).
|
1003
|
+
|
1004
|
+
**sms:**
|
1005
|
+
:::html
|
1006
|
+
<a href="sms:+3581234567">Send SMS to us </a>
|
1007
|
+
|
1008
|
+
Open link in external application (browser for http:// links):
|
1009
|
+
:::html
|
1010
|
+
<a href="http://www.google.com/?rho_open_target=_blank">Open Google in external browser</a>
|
1011
|
+
|
1012
|
+
Open appstore on iphone: [http://wiki.akosma.com/IPhone_URL_Schemes#App_Store](http://wiki.akosma.com/IPhone_URL_Schemes#App_Store)
|
1013
|
+
|
1014
|
+
|
1015
|
+
## BlackBerry network connection
|
1016
|
+
Rhodes may use any Blackberry network connection available on the device. What particular network connection will be selected depends on the url suffix used to connect. Here is the algorithm:
|
1017
|
+
|
1018
|
+
1. Rhodes enumerate device Service Books at application start to identify Wifi, BES (has priority over BIS-B) and BIS-B transport:
|
1019
|
+
|
1020
|
+
* if WIFI exist we set wifi_postfix = ";interface=wifi"
|
1021
|
+
* if BES exist we set url_postfix = ""
|
1022
|
+
* If BIS-B exist and NO BES: url_postfix = ";deviceside=false;ConnectionType=mds-public"
|
1023
|
+
* If no BES or BES exist or in simulator mode : url_postfix = ";deviceside=true"
|
1024
|
+
|
1025
|
+
2. When application make network call, Rhodes create network connection:
|
1026
|
+
|
1027
|
+
* if wifi_postfix is not empty and WIFI network available: add wifi_postfix to url
|
1028
|
+
* add url_postfix
|
1029
|
+
* make network connection
|
1030
|
+
|
1031
|
+
3. If connection creation failed, Rhodes try to connect without wifi_postfix(if exists) and then without url_postfix (if exists)
|
1032
|
+
|
1033
|
+
4. There are several [rhoconfig.txt](configuration#run-time-configuration) parameters which can modify this process (mostly for the testing purposes):
|
1034
|
+
|
1035
|
+
Do not use `;deviceside=true` suffix:
|
1036
|
+
|
1037
|
+
no_deviceside_postfix = 0
|
1038
|
+
|
1039
|
+
Set `url_postfix` to specific value, without enumerating Service Books records
|
1040
|
+
|
1041
|
+
bb_connection_postfix = ''
|
1042
|
+
|
1043
|
+
## BlackBerry Browser Support
|
1044
|
+
|
1045
|
+
Capabilities of BlackBerry WebView control differ quite significantly form other OS-es as well as from one version of BB OS to another. And even with the single BB OS you may have different capabilities depending on what WebView do you use (see full browser capability described below).
|
1046
|
+
|
1047
|
+
Check out the [BlackBerry Browser Version 4.2 Content Developer Guide](http://docs.blackberry.com/eng/deliverables//1143/browser_devguide.pdf) to see what HTML, CSS and JavaScript supported on BlackBerry.
|
1048
|
+
|
1049
|
+
One of the limitation is that simple submit element in the form does not work (this issue was fixed in Rhodes > 2.2.4):
|
1050
|
+
|
1051
|
+
:::html
|
1052
|
+
<form id="user_edit_form"
|
1053
|
+
method="POST"
|
1054
|
+
action="<%=url_for(:action => 'do_login')%>" selected="true">
|
1055
|
+
<input type="submit" value="Login"/>
|
1056
|
+
</form>
|
1057
|
+
|
1058
|
+
Solution:
|
1059
|
+
|
1060
|
+
:::html
|
1061
|
+
<form id="user_edit_form"
|
1062
|
+
method="POST"
|
1063
|
+
action="<%=url_for(:action => 'do_login')%>" selected="true">
|
1064
|
+
</form>
|
1065
|
+
<a href="#" onclick="document.forms[0].submit(); return false;">
|
1066
|
+
<img src="/public/images/button_next.png" />
|
1067
|
+
</a>
|
1068
|
+
|
1069
|
+
### Blackberry Touch screen (4.7, 5.x )
|
1070
|
+
|
1071
|
+
There are some issues Rhodes developers encountered developing for Blackberry Touch screen 4.7 and 5.x.
|
1072
|
+
|
1073
|
+
Links with aligned images are not clickable:
|
1074
|
+
:::html
|
1075
|
+
<a href="/app/WelcomeScreen/do_info">
|
1076
|
+
<img src="/public/images/bb_info_btn.png" align="left" />
|
1077
|
+
</a>
|
1078
|
+
Solution: remove alignment or add text to link
|
1079
|
+
|
1080
|
+
Links with div inside issue:
|
1081
|
+
:::html
|
1082
|
+
<a href="/app/Login"><div style="height:10px"></div>Login</a>
|
1083
|
+
Solution: move dive out of `<a>`:
|
1084
|
+
:::html
|
1085
|
+
<div style="height:10px"></div><a href="/app/Login">Login</a>
|
1086
|
+
|
1087
|
+
Links with style display:block:
|
1088
|
+
:::html
|
1089
|
+
<a href="/app/Login"
|
1090
|
+
style="display:block;background: url('test.png') no-repeat 97% 50%;">
|
1091
|
+
Login
|
1092
|
+
</a>
|
1093
|
+
<a href="/app/Login"
|
1094
|
+
style="display:block;border-Top: 1px solid #bbb;">
|
1095
|
+
Login
|
1096
|
+
</a>
|
1097
|
+
Solution: remove display:block from a element
|
1098
|
+
|
1099
|
+
### Blackberry 5.0 full browser
|
1100
|
+
|
1101
|
+
Blackberry 5.0 has new BrowserField class, which support javascript, ajax and extended css. To use it set in [rhoconfig.txt](configuration#run-time-configuration):
|
1102
|
+
|
1103
|
+
# use full browser only on BB 5.0 and above
|
1104
|
+
use_bb_full_browser=5
|
1105
|
+
|
1106
|
+
# use full browser only on touch devices including 5.0
|
1107
|
+
use_bb_full_browser=touch
|
1108
|
+
|
1109
|
+
NOTE: on Blackberry 5.0 non-touch device full browser has problems with fields navigation - it does not move from one focus field to another like usual browser field does, it just move from one symbol to another. This issue make full browser usable only on touch screen devices.
|
1110
|
+
|
1111
|
+
### Blackberry full browser
|
1112
|
+
|
1113
|
+
Available for Blackberry 4.6 and above
|
1114
|
+
|
1115
|
+
Support AJAX and better support of CSS
|
1116
|
+
|
1117
|
+
On non-touch screen looks like usual browser app, so not very useful because it uses pointer cursor. On Touch screen devices no visual difference between full browser and browser field (default mode).
|
1118
|
+
|
1119
|
+
To enable on all devices - add to [rhoconfig.txt](configuration#run-time-configuration):
|
1120
|
+
|
1121
|
+
use_bb_full_browser=1
|
1122
|
+
|
1123
|
+
To enable on Touch screen devices - add to [rhoconfig.txt](configuration#run-time-configuration):
|
1124
|
+
|
1125
|
+
use_bb_full_browser='touch'
|
1126
|
+
|
1127
|
+
Submit form issue:
|
1128
|
+
:::html
|
1129
|
+
<head>
|
1130
|
+
<script type="text/javascript">
|
1131
|
+
function submitform()
|
1132
|
+
{
|
1133
|
+
document.forms["login"].submit();
|
1134
|
+
}
|
1135
|
+
</script>
|
1136
|
+
</head>
|
1137
|
+
<form id="user_edit_form"
|
1138
|
+
method="POST"
|
1139
|
+
action="<%=url_for(:action => 'do_login')%>" selected="true">
|
1140
|
+
<a href="javascript: submitform()">Login</a>
|
1141
|
+
</form>
|
1142
|
+
|
1143
|
+
Solution:
|
1144
|
+
:::html
|
1145
|
+
<form id="user_edit_form"
|
1146
|
+
method="POST"
|
1147
|
+
action="<%=url_for(:action => 'do_login')%>" selected="true">
|
1148
|
+
<a href="#" onclick="document.forms[0].submit(); return false;">
|
1149
|
+
<img src="/public/images/bb_logon_btn1.png" />
|
1150
|
+
</a>
|
1151
|
+
</form>
|
1152
|
+
|