This is default featured slide 1 title

Easy to customize it, from your blogger dashboard, not needed to know the codes etc. Video tutorial is available, also a support forum which will help to install template correctly. By DeluxeTemplates.net

This is default featured slide 2 title

Easy to customize it, from your blogger dashboard, not needed to know the codes etc. Video tutorial is available, also a support forum which will help to install template correctly. By DeluxeTemplates.net

This is default featured slide 3 title

Easy to customize it, from your blogger dashboard, not needed to know the codes etc. Video tutorial is available, also a support forum which will help to install template correctly. By DeluxeTemplates.net

This is default featured slide 4 title

Easy to customize it, from your blogger dashboard, not needed to know the codes etc. Video tutorial is available, also a support forum which will help to install template correctly. By DeluxeTemplates.net

This is default featured slide 5 title

Easy to customize it, from your blogger dashboard, not needed to know the codes etc. Video tutorial is available, also a support forum which will help to install template correctly. By DeluxeTemplates.net

Review aplikasi PhoneGap

Persiapkan aplikasi yang akan digunakan yaitu Elipse 3.4+

1. Install SDK + Phonegap
Download & Install Eclipse Classic
Download & Install Android SDK
Download & Install ADT Plugin
Download PhoneGap

2. Buat Projek Baru di Eclipse
Jalankan Eclipsenya, lalu buat Android Project (File --> New --> Android Project)



Di dalam direktori nya buat dua direktori baru :
/libs
/assets/www
Copy phonegap.js dari folder PhoneGap yang telah kalian download tadi ke folder www (/assets/www)
Copy phonegap.jar dari folder PhoneGap yang telah kalian download tadi ke folder libs (/libs)
Copy xml folder dari folder PhoneGap yang telah kalian download tadi ke folder res (/res)
Buat beberapa perubahan pada file javanya, bisa di lihat di gambar berikut :
Ubah class yang sudah ada dari Activity menjadi DroidGap 
Ubah baris setContentView() dengan super.loadUrl("file:///android_asset/www/index.html");
Tambah import com.phonegap.*; 
Hapus import android.app.Activity; 



Pasti ada beberapa yang error, itu dikarenakan phonegap.jar nya belum berada di project tersebut. Untuk mengatasinya buka lagi folder libs (/libs) disana ada phonegap.jar, klik kanan dan pilih pilihan Build Path lalu pilih Configure Build Path, lalu tambahkan phonegap.jar itu ke project tersebut, lalu refresh (F5)

Klik kanan AndroidManifest.xml dan pilih open with -> Text Editor dan paste code berikut :
<supports-screensandroid:largeScreens="true"android:normalScreens="true"android:smallScreens="true"android:resizeable="true"android:anyDensity="true"/><uses-permission android:name="android.permission.CAMERA" /><uses-permission android:name="android.permission.VIBRATE" /><uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /><uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /><uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /><uses-permission android:name="android.permission.READ_PHONE_STATE" /><uses-permission android:name="android.permission.INTERNET" /><uses-permission android:name="android.permission.RECEIVE_SMS" /><uses-permission android:name="android.permission.RECORD_AUDIO" /><uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /><uses-permission android:name="android.permission.READ_CONTACTS" /><uses-permission android:name="android.permission.WRITE_CONTACTS" /><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" /> 
Dan juga tambah code android:configChanges="orientation|keyboardHidden" ke dalam tag activity di AndroidManifest.xml, untuk jelasnya bisa di lihat di code berikut :
<activity android:name="com.phonegap.DroidGap" android:label="@string/app_name" android:configChanges="orientation|keyboardHidden"> <intent-filter> </intent-filter> </activity>

3. Membuat Hello World
Sekarang buat dan buka file baru dengan nama index.html pada direktori /assets/www . Paste Code berikut :
<!DOCTYPE HTML><html><head><title>Hello World</title><script type="text/javascript" charset="utf-8" src="phonegap.js"></script></head><body><h1>Hello World</h1></body>
</html> 
*phonegap.js di ganti dengan phonegap.<phonegap versi> .js

4. Jalankan Aplikasi Menggunakan Emulator
Klik kanan pada project dan langsung ke Run As dan pilih Android Application
Nanti akan ada kolom dialog untuk memilih emulator, jika belum buatlah emulatornya di android AVD.

Tidak ada komentar:

Posting Komentar

 

Advertise

FOLLOW ME

NISCALINDO