2011年11月5日 星期六

Installing XMPP Server on Ubuntu Linux

Instant messaging is a popular application in our life ,  most of today's smartphone IM apps are build upon a protocol named XMPP like google talk , Whatsapp , skype ,etc., It it useful to learn how to setup your own XMPP server when we consider to make our app user can chat with some other users on the move (for example: mobile chat room or a mobile MMORPG ) or the real-time server push function (like the Google's C2DM with app engine).

To apply XMPP functionalities to our app , we need to have a server side for handling the account management and message forwarding first.


Here are the steps to install an XMPP server (on Ubuntu Linux):

    and extract :
         #tar -xzvf openfire_3_0_0.tar.gz
           #mv openfire /opt
2. Start Installation Process
    
    a.  #bin/Openfire start
    b.  Insert http://localhost:9090 in your browser to start the web-based wizard
    c.  You will need to have a database system (ex: mysql) on your server that can be accessed by Openfire. Create a table for Openfire when or before you are in the database setup step.   
    d. Now you can access your own XMPP backend server through http://your-domain:9090

We will have our XMPP client in Android platform in the next post !! Have fun !





2011年4月19日 星期二

在 GAE Java application 中使用 Jackson Json 進行 Java object - Json object 轉換

Json 格式一直都算是主流的資料交換格式之一 , 以下分享一下自己在操作 Json - Java 轉換用到的 package 以及相關程式碼的撰寫

下載 Java app engine datastore 上的 data 回 desktop

這篇主要紀錄 Java GAE application 開發者如何將 GAE datastore 裡的資料下載回本地端 ,
並且儲存成易讀的格式 (ex: 可以用 excel 開啓的 .csv 格式)的方法


2011年4月16日 星期六

Android application 中 global 的 data 的處理

開發 Android applications 時我該如何儲存 global 的 data ? 使用平常在開發 Java 時的 singleton pattern 好嗎? 我的 activity 須要跟背景的 service 要資料來更新 UI , 該怎麼作?

2011年4月15日 星期五

2011年4月11日 星期一

Location acquisition on Android

Location / Context Aware Computing 自90年代開始被廣泛的討論與研究
在 Android 的平台中 , google 提供了兩種獲取 location 資訊的管道
第一個是大家平常較為熟知的 GPS , 然而這裡要分享的則是透過 Wifi 的
Network Location Provider

動作摘要
1. 取得 LocationManager 的 instance
2. 撰寫聽取相關事件的 Listener
3. 註冊事件

// Acquire a reference to the system Location Manager
LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);

// Define a listener that responds to location updates
LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
// Called when a new location is found by the network location provider.
makeUseOfNewLocation(location);
}

public void onStatusChanged(String provider, int status, Bundle extras) {}

public void onProviderEnabled(String provider) {}

public void onProviderDisabled(String provider) {}
};

// Register the listener with the Location Manager to receive location updates ,
// 第2,3個參數用來控制update的頻率
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);

另外必須獲取權限如下:
  1. <manifest ... >
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    ...
    manifest>


2011年3月18日 星期五

存取 android market 資料的方法 (一)

由於論文可能會需要一些關於手機應用程式的相關統計資訊
因此官方的 android market 自然是最直覺想到的對象啦