Friday 6 November 2015

Thursday 22 October 2015

Mulai Menggunakan Ionic Framework

Status : Draft

Instalasi

OS X

Menggunakan XCode 7.
Burhanuddin:~ BURHAN$ sudo npm install ionic -gPassword:
> spawn-sync@1.0.13 postinstall /usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/cross-spawn/node_modules/spawn-sync> node postinstall
npm ERR! tar.unpack untar error /tmp/npm-7037-734374a4/registry.npmjs.org/lodash/-/lodash-3.10.1.tgznpm ERR! tar.unpack untar error /tmp/npm-7037-734374a4/registry.npmjs.org/qs/-/qs-0.5.6.tgznpm ERR! tar.unpack untar error /tmp/npm-7037-734374a4/registry.npmjs.org/tough-cookie/-/tough-cookie-2.2.0.tgznpm ERR! Darwin 14.5.0npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "ionic" "-g"npm ERR! node v4.2.1npm ERR! npm  v2.12.1npm ERR! code ECONNRESETnpm ERR! errno ECONNRESETnpm ERR! syscall read
npm ERR! network read ECONNRESETnpm ERR! network This is most likely not a problem with npm itselfnpm ERR! network and is related to network connectivity.npm ERR! network In most cases you are behind a proxy or have bad network settings.npm ERR! network npm ERR! network If you are behind a proxy, please make sure that thenpm ERR! network 'proxy' config is set properly.  See: 'npm help config'\> node-sass@3.3.3 install /usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/node-sass
> node scripts/install.jsBinary downloaded and installed at /usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/node-sass/vendor/darwin-x64-46/binding.node
> node-sass@3.3.3 postinstall /usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/node-sass> node scripts/build.js
` /usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/node-sass/vendor/darwin-x64-46/binding.node ` exists.  testing binary.Binary is fine; exiting.

Jika sudah dicoba berkali-kali masih mendapatkan error yang sama, coba gunakan koneksi internet yang lain, misal dari jaringan mobile lain (saya mencoba dengan jaringan XL), Alhamdulillah, proses instalasi ionic berhasil. 

Ketika mengupload dengan Xcode 7, yang sebelumnya menggunakan Xcode 6, gagal, berikut response nya : 



Solusinya bisa dilihat di [3]

Referensi

  1. Downloads for Apple Developers, https://developer.apple.com/downloads/
  2. npm not working - “read ECONNRESET”, http://stackoverflow.com/questions/18419144/npm-not-working-read-econnreset
  3. How to disable iOS9 multitasking through Ionic/Cordova?, http://forum.ionicframework.com/t/how-to-disable-ios9-multitasking-through-ionic-cordova/33242
  4.  Preparing for iOS 9, http://blog.ionic.io/preparing-for-ios-9/

Wednesday 7 October 2015

Mendapatkan unique device id - UUID

Kita dapat menggunakan ngCordova dan cordova Device plugin [1]

Install plugin :
cordova plugin add org.apache.cordova.device
Cara menggunakannya :

module.controller('MyCtrl', function($scope, $cordovaDevice) {
  var uuid = $cordovaDevice.getUUID();
});

Referensi

  1. $cordovaDevice, http://ngcordova.com/docs/plugins/device/

Mendebug Aplikasi Ionic di Genymotion

Status : Draft

Todo : Membuat Video Tutorial nya

Referensi

  1. Genymotion how to debug with Chrome Dev Tools, http://stackoverflow.com/questions/21627328/genymotion-how-to-debug-with-chrome-dev-tools
  2. Accessing a localhost server from the Genymotion Android emulator, http://bbowden.tumblr.com/post/58650831283/accessing-a-localhost-server-from-the-genymotion
  3. How do I check or change the DNS settings on an Android phone?, https://support.myrepublic.com.sg/hc/en-us/articles/202899734-How-do-I-check-or-change-the-DNS-settings-on-an-Android-phone-

Monday 5 October 2015

Directive : ion-slide-box

Bagaimana menentukan kalau slide terpilih adalah slide terakhir ?

Dapat menggunakan variable $last , seperti pada contoh berikut :

        <ion-slide-box show-pager="false" on-slide-changed="onSlideChanged(index)" active-slide="currentIndex">
          <ion-slide ng-repeat="item_pertanyaan in polling.pertanyaans">
            <div class="box">
               {{item_pertanyaan.pertanyaan}}
               <ion-radio ng-repeat="(key, value)  in item_pertanyaan.pilihan_jawaban" name='pilihan_jawaban_{{item_pertanyaan.id}}' ng-model='data.pilihan_jawaban[item_pertanyaan.id]' ng-value="'{{key}}'">{{value}}</ion-radio>
             </div>
             <div ng-if="$last">
             <button type="submit" name="submit" class="button button-block button-balanced">Simpan</button>
             </div>
          </ion-slide>

Referensi

  1. ion-slide-box, http://ionicframework.com/docs/api/directive/ionSlideBox/
  2. Ionic Example: ion-slide-box, http://www.raymondcamden.com/2015/09/16/ionic-example-ion-slide-box

Troubleshooting : No 'Access-Control-Allow-Origin'

Pada file .htaccess di aplikasi web (webservices) yang digunakan tambahkan konfigurasi berikut :

SetEnvIfNoCase ORIGIN (.*) ORIGIN=$1
Header always set Access-Control-Allow-Methods "POST, GET, PUT, OPTIONS, PATCH, DELETE"
Header always set Access-Control-Allow-Origin "%{ORIGIN}e"
Header always set Access-Control-Allow-Credentials "true"
Header always set Access-Control-Allow-Headers "X-Accept-Charset,X-Accept,Content-Type"

Referensi


  1. Universal .htaccess CORS Support, http://blog.revolunet.com/blog/2013/10/03/universal-CORS-htaccess/

Wednesday 26 August 2015

Mendapatkan Nomor IMEI

Status : Draft
Panduan Pertanyaan: 

  1. Apa itu IMEI ?
  2. Bagaimana cara mendapatkan nomor IMEI ? 
Menurut [2], di iOS sekarang kita tidak dapat mengakses IMEI lagi.

Referensi

  1. IMEI Plugin, Get The Real IMEI Number on Device, https://www.npmjs.com/package/imeiplugin
  2.  How can I get IMEI in IOS?, http://forum.ionicframework.com/t/how-can-i-get-imei-in-ios/8516