September 08, 2010

Menggunakan Media Query Untuk Desain Web yang Mobile Friendly

Desain web yang mobile-friendly menjadi tuntutan supaya web-surfer yang mengakses melalui mobile-device bisa merasakan experience yang tidak kalah baiknya dibanding dengan akses melalui komputer. Dengan banyaknya pengguna smart-phone saat ini, maka mobile-friendly design menjadi hal yang wajib hukumnya.

September 05, 2010

Android Telephony Manager dan Cell Location Info Simple Program

Android SDK memiliki Telephony Manager yang menyediakan fungsi-fungsi yang berkaitan dengan telefoni, salah satunya adalah network cell-info.

Sore ini saya berhasil membuat program tool sederhana untuk melakukan probe posisi saya di jaringan GSM. Dengan memanfaatkan Telephony Manager, saya bisa tau cell-id yang meng-cover posisi saya sekarang… Lumayan, kalo pengen komplain GPRS lambat bisa langsung tau kena masalahnya nya pas lagi di cell yang mana, sehingga membantu proses troubleshot.
Provides access to information about the telephony services on the device. Applications can use the methods in this class to determine telephony services and states, as well as to access some types of subscriber information. Applications can also register a listener to receive notification of telephony state changes.
Ada 2 fungsi yang menarik perhatian saya, yaitu getCellLocation() dan getNeighboringCellInfo(). Menurut dokumentasi, fungsi-fungsi tersebut bisa digunakan untuk mengetaui posisi kita di dalam jaringan seluler.

Let's get our hand dirty :) Langsung aja buat program HelloAndroid yang gampang dan pasti bisa jalan :)

ardhy@zangetsu:/tmp$ mkdir HelloAndroid
ardhy@zangetsu:/tmp$ cd HelloAndroid/ 
ardhy@zangetsu:/tmp/HelloAndroid$ android create project -t 2 -p . -k com.android.helloandroid -a HelloAndroid

Setelah itu, barulah di-permak rame-rame file HelloAndroid.java-nya

ardhy@zangetsu:/tmp/HelloAndroid$ vim src/com/android/helloandroid/HelloAndroid.java

Lalu, tinggal copy paste aja kode dibawah ini…

package com.android.helloandroid;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import android.telephony.TelephonyManager;
import android.content.Context;

public class HelloAndroid extends Activity
{
/** Called when the activity is first created. */
@Override public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
TelephonyManager tm = (TelephonyManager) 
getSystemService(Context.TELEPHONY_SERVICE);
TextView tv = new TextView(this);
tv.setText("## Simple GSM Info ##\n\n
Cell location:\n"+tm.getCellLocation()+"\n\n
Neighboring cells:\n"+tm.getNeighboringCellInfo());
setContentView(tv);
} }

Selanjutnya, gunakan ant untuk membangun aplikasi secara otomatis dan langsung pasang (install, red) di HP. Dijamin kaga ada error pas kompilasi :)

ardhy@zangetsu:/tmp/HelloAndroid$ ant install

Dicoba lagi… Jyaaaahh… Sorry?!

Hello Android Application Permission Error

Manifest Permission

Usut punya usut, ternyata si aplikasi ini harus diberi permission untuk mengakses coarse — saya tidak tahu, apa ini. Menurut petunjuk dari SDK (file:///home/ardhy/Desktop/SRC/android app/android-sdk-linux_x86-1.5_r2/docs/reference/android/Manifest.permission.html)
String ACCESS_COARSE_LOCATION Allows an application to access coarse (e.g., Cell-ID, WiFi) location
Jadi permission ini harus ditambah supaya aplikasi mendapatkan grant untuk mengakses informasi yang dimaksud.

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Maka saya define permission tersebut di file AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.android.helloandroid" android:versionCode="1" android:versionName="1.0">
<application android:label="@string/app_name">
<activity android:name=".HelloAndroid" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
</manifest>  

Trus, lakukan uninstall HelloAndroid dan lakukan ant install lagi.

Taadaa!

September 03, 2010

Simple Design Is Difficult

XL Open Source Community Web Flyer
Four hours of code to get this simple design
This is 4 hours of code. Starts from 10:00 ends at 14:00 without break. I was designed a web-flyer for XL open source community @ XL employee club exhibition. It was blank… no idea how to start this web-flyer, I don't know how the layout would be, and so on. The one in my mind is: This thing must be put in PC so it can attract peoples to visit our booth immediately. And I want it very simple.

I was thinking about middle-aligned block. Contents were stacked, started from header; intro; sections; and footer. Each section was divided into 2 columns, left for figure, right for paragraph.

The content is about Windows application replacement for Linux. It is grouped into: Office; Multimedia; Internet; Game; Graphic applications. It was clear that stacked-layout will be used.

The tones is about balance between warm & cool colors. Here I picked light-orange as warm color, and light-green as cool color. Content tones is standard 80% black over white background.

Four hours… long enough to get this kind of design. Yeah, simple is difficult.