顯示具有 Android 標籤的文章。 顯示所有文章
顯示具有 Android 標籤的文章。 顯示所有文章

星期五, 9月 11, 2009

Android中如何檢查第三方Package是否有安裝?

第一個方法:
public static boolean isIntentAvailable(Context context, String action) {
final PackageManager packageManager = context.getPackageManager();
final Intent intent = new Intent(action);
List<ResolveInfo> list =
packageManager.queryIntentActivities(intent,
PackageManager.MATCH_DEFAULT_ONLY);
return list.size() > 0;
}

第二個方法:

透過Intent.resolveActivity(),PackageManager.resolveActivity()這兩個API來作,作法都大同小異。


Reference: [1] [2]

星期日, 8月 23, 2009

ADC2的作品上傳時間接近尾聲,但是Submission Site竟然還沒出現?!

根據http://code.google.com/intl/zh-TW/android/adc/裡面提及的Timeline

Timeline

  • May 27 - Google I/O: ADC 2 announced
  • July 13: Full Terms and Conditions made available
  • Beginning in August: submission site opens, developers submit apps
  • August 31: submission site closes; ADC2 client/scoring app goes up on Market; users begin reviewing apps
  • October (estimated): first-round judging ends
  • November (estimated): final judging ends, winners announced
照理講submission site應該在8月初就要開啟,但是好像都沒有任何官方的消息與通知。

大家不禁要問問Has ADC submission site opened?

但從這個討論中可以看到,連Google的員工都不清楚啦。

這是準備要開天窗的意思嗎?

星期一, 7月 27, 2009

使用Repo在Windows平台下載Android原始碼

昨天花了一些時間才弄好,將步驟記錄起來

1. 安裝Cygwin [1],要安裝的packages如下:
  • Net -> curl
  • Devel -> git* (git, git-completion, git-gui, gitk)
  • Libs -> libreadline6, libiconv2
  • Editors -> vim
  • Python -> python
2. 啟動Cygwin之後,開始安裝Repo[2]
  • 先在使用者的家目錄新增bin目錄
    $ cd ~
    $ mkdir bin
  • 下載Repo到bin目錄裡
    $ curl http://android.git.kernel.org/repo >~/bin/repo
    $ chmod a+x ~/bin/repo
  • 設定Repo,並新增mydroid目錄準備放檔案
    $ cd ~
    $ mkdir mydroid
    $ cd mydroid
    $ ~/bin/repo init -u git://android.git.kernel.org/platform/manifest.git
    (需要輸入一個已申請Google account的email)

  • 開始抓取所有的Android原始檔
    $ repo sync
抓好後就可以用Windows的檔案總管去瀏覽檔案囉。

延伸閱讀:更多Repo用法[3]或如何使用Eclipse[4]

星期二, 7月 07, 2009

裝好Android SDK1.5新增第一個專案就出現錯誤

撐了很久, 一直懶得升級到Android SDK1.5, 沒想到一升級之後新增第一個專案就出現錯誤...

錯誤訊息如下
[2009-07-05 15:13:31 - APITest] no classfiles specified
[2009-07-05 15:13:31 - APITest] Conversion to Dalvik format failed with error 1

解決方法是點擊專案名稱, 按F5即可

星期六, 6月 27, 2009

Android Developers Blog: Introducing Android 1.5 NDK, Release 1

最近都在忙RoR Web的事情, 比較少注意Android, 沒想到NDK已經出來囉, 看來是配合Google Android Developer Challenge 2而釋放出來的. 有機會再找時間研究一下囉


Android Developers Blog: Introducing Android 1.5 NDK, Release 1

星期六, 5月 02, 2009

看來挺有搞頭的Google App Engine

今天忙著在GWT, Ext-GWT, ZK中奮鬥,想了解到底哪一個AJAX framework比較適合我們公司使用, 目前看來是使用GWT多少可以與Android上的開發經驗相結合.

但突然想到如何與視覺化介面設計師 (據說是高級系統美工的雅稱)配合的問題, 畢竟這是web系統開發通常最痛苦的地方所在, 在網路上瀏覽資料, 似乎有還不錯的解法, 不過這不是本篇的重點, 重點是突然發現Google App Engine (GAE)這個有趣的東西, GAE剛滿周歲不久 (一年後才發現, 哈哈), 更巧的是最近剛開始開放支援Java, 也可以支援cron (scheduled tasks). 資料儲存則可以用Java Data Objects (JDO) 和 Java Persistence API (JPA), 還有其他的服務如Memcache, Expand URL FetchURL Fetch, Expand Mail, Expand Images, Expand Google Accounts, 感覺功能相當完整, 以前蠻難找到可以作Java hosting的虛擬主機, 免費的更少, GAE看來提供一個很不錯的解決方案.

使用 Android + RESTful + Google Data API + GAE 組合出有價值的服務, 看來不是夢阿!

其實覺得自己的行為還蠻像internet spider的 XD

GeoAlarm Lite小小更新版放上Android Market遇到的問題

可能是因為SDK1.5釋放的關係, 今天要放上新版的GeoAlrm Lite時遇到一點小問題.

Market requires the minSdkVersion to be set in AndroidManifest.xml.

訊息很清楚, 解決方法看來也很簡單.

我先在 AndroidManifest.xml的manifest下面加上
<uses-sdk minsdkversion="1">
但是不work...好吧~ 那換
<uses-sdk minsdkversion="1"></uses-sdk>
看看...也不work @#$%@#$%...再試試看
<uses-sdk android: minSdkVersion="1"/>
...終於成功了~


新版的GeoAlrm Lite多了四種radius可以選擇囉... 應該有方便一點吧. 哈哈

一開始key有問題會一直force close所造成的評價傷害... 還真的要花很多時間來提升... 乾脆砍掉重練算了...

星期二, 4月 28, 2009

Google正式發佈Android 1.5 SDK, Release 1

下載網址在這
http://developer.android.com/sdk/1.5_r1/index.html

升級步驟如下:
  • Install the SDK
  • Update Your Eclipse ADT Plugin
  • Update Your Projects
  • Migrate Your Applications
http://developer.android.com/sdk/1.5_r1/upgrading.html

記得要先Uninstall先前的ADT plugin再裝新的, 否則會有錯誤.

星期一, 4月 20, 2009

使用ksoap2-android來呼叫WebServices的問題

最近開發中的軟體要跟server端溝通, 目前決定的架構要使用Web Services來當作溝通的通道. 我跟據以前的經驗, 請我們家的engineer去survey如何使用ksoap2-android這個library, 但是他跟我說新版的lib一直有問題, import進eclipse就會出錯...

上網查了一下, 在ksoap2-android的專案網站上就有提到相關的問題, 不過幸好有人找到問題點並提供解決方法了. 問題出於ksoap2-android-2.2-jar-with-dependencies.jar裡面有兩個.class檔重複了, 因此解決的方法也很簡單, 就是砍掉其中一個就可以囉!

星期五, 4月 17, 2009

Sixnology在 Android上的最新力作-VibrateMaster

隨著 GeoAlarm上線, 但是因為第一次放程式到Android Market上, 有蠻多事情與預期不同, 程式出了一些問題... 有點沮喪... 因此突發奇想寫了這個 VibrateMaster.

VibrateMaster是個很簡單的程式, 用到的其實是 GeoAlarm程式的一部分, 因此只花了很短的時間就完成了. 功能也很單純, 就是讓你玩手機的震動功能.

我的夥伴說一定要提醒大家一件事情, 那就是: 請記得你的手機不防水:P 至於為什麼要提醒這點, 那就請大家上討論區來問問他啦 :D

http://groups.google.com.tw/group/vibratemaster

GeoAlarm Lite放上 Android Market囉!















Want to have a nice sleep on the bus/train without passing your destination? Want to think about things freely without keeping checking where you are? GeoAlarm Lite is your savior! Just double click your destination on the map and create a GeoAlarm. Your GeoAlarm will be fired while you enter the area surrounding (500 meters) your GeoAlarm's location.

NOTICE:
- In Lite version, a GeoAlarm will expire after 5 hours and can only be fired once.
- GeoAlarm works well, even if it's not on the screen.

星期二, 4月 14, 2009

The first step to implement tap and hold on Android

I'd like to implement tap and hold.

The first step is to distinguish "Tap and hold" from other touch screen actions. I was trying to achieve that by overriding onTouchEvent of a certain view, but it's almost impossible to do that since there are only four common actions trigger that function (ACTION_CANCEL, ACTION_DOWN, ACTION_MOVE, ACTION_UP). Therefore, I turn to look for some other solutions.

Finally, here is a easy way to do that.

RelativeLayout relativeLayout = new RelativeLayout (this);
setContentView(relativeLayout);
relativeLayout.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
Log.d(this.getClass().getName(), "onLongClick()");
return true;
}
});

星期一, 4月 13, 2009

Can't make a toast from TimerTask while using Timer?

1lI can't find a way to make a toast from TimerTask while using Timer. I still don't know why.

Example:
Timer t = new Timer(false);
t.schedule(new TimerTask() {
@Override
public void run() {
Toast.makeText(getApplicationContext(), "msg", Toast.LENGTH_LONG).show();
}
}, 5000);

However, I did find out a solution. It works well.

final Context ctx = this;
Handler mHandler = new Handler();

Runnable
makeToast = new Runnable() {
public void run() {
Toast.makeText(ctx,
"msg", Toast.LENGTH_LONG).show();
}
};
mHandler.postDelayed(makeToast, 1000);

星期三, 4月 08, 2009

想開發Android Map程式? 先取得 Maps API Key再說!


最近又開始進行 Android applications的開發,雖知道一年前的 Android SDK版本早已過時,但進行 SDK的更新之後卻發現幾乎所有的程式碼都無法執行,頓時有種萬念俱灰的感覺...

經過一些小修改之後,想先測試開啟一個 MapView,開個地圖來讓自己獲得一點小成就感,但沒想到看到的竟是一片荒蕪(格線)~頓時大驚!才一年...我連開地圖都不會了嗎?!

趕緊上 Google找尋資訊之後發現,原來現在想要拿到地圖資訊,必須要先申請一個 Maps API Key才行。[參考網址]


看來這是 Android為了避免太多像我這種只想開開地圖來爽一爽的開發者浪費他們家的頻寬的一個設計,所以 Android入門者還是找點別的東西來玩玩吧... Android toturial是不錯的選擇喔~強力推薦!

星期一, 5月 05, 2008

Google Android Developer Challenge I 的前100名即將揭曉!

Google將比賽結果的公布時間往後延了一點,將原本的"5/2"改為"5/5的那個禮拜"。

對於參賽者而言,這真的是痛苦的煎熬,尤其是無法掌握比賽評審的進度更是讓所有參賽者焦慮不安,在ADC參賽者的論壇上更是人心惶惶,rumors滿天飛~

基本上我也是屬於不停check該forum的人之一 ><"