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

2015年12月5日 星期六

[Review] AlarmMap 犯罪熱點地圖

犯罪熱點地圖是我最近開發的一個 Android App。 開發動機 :


  1. 最近在寫 Go 怕 Android 忘記
  2. 看到 WoFOSS 在做類似的開發, 想加入,但那是一次性的 hackthon project, 所以殘念
  3. 去聽女人迷瑋軒演講,受到想做的事就去做的激勵 
  4. 我還蠻喜歡寫 Map Application 的


目前功能開發已到一個階段, 整個 Framework 已經差多, 達成我第一階段預設

  1. 將犯罪熱點顯示在地圖
  2. 使用者 進入犯罪熱點警示範圍時候顯示警訊 
  3. 使用者沒把 App 開前景時, 也會在背景運作
  4. 回報機制 
  5. 顯示犯罪熱點的描述
  6. 連結到 Google Map 導航
  7. 使用 Cluster 粗略顯示犯罪熱點密度

現在就來介紹這一支 APP 吧! 


  點進 AlarmMap  Icon 進入 App












2015年9月26日 星期六

[Review]禮物 - Tapin 具象化的雲端回憶

    最近在床邊的是兩本松浦彌太郎的書,因此好好的被他既是日式的細膩又是西式的熱情所影響。 剛剛讀到禮物,他說收到禮物時,要向對方好好說明收到禮物的感想,這是答謝的方法。剛看完,就在中秋假期的前夕,收到一份禮物。 

    第一個感想是還蠻開心的,畢竟在分享會萍水相逢,隔兩天就收到了一份禮物。分享會當天跟我們解說完後,還寄了實品給我們, 這是跟兩位美女一起參加活動的好福利 (笑)。不過收到禮物後,我感受到的是老闆對產品的熱情! (正解)

    這個禮物拿到手上時,溫度的感覺一直持續著。不管包裝或是產品的設計上,都是溫暖的。


2015年9月24日 星期四

[Golang]Build go library for Android using gomobile step by step

Build go library for Android using gomobile step by step

1. Supposed  \src\gobindtemp  is my go lib source file

2. Build arr file

gomobile bind [directory under gopath]
ie.  gomobile bind -target=android gobindtemp

generate an aar file  ie. gobindtemp.aar

I suggest go to the project directory use 

gomobile bind -target=android

this will generate .aar file in the project directory

otherwise , .aar is generate in the same directory with /src

2015年9月21日 星期一

[Golang]GoMobile的安裝與建置 (Android)

有個風傳是如無法支援 Mobile ,那麼這個語言的前景有限。 Go 一直有被這風傳掃到,雖然之前還是有方法可給 mobile 使用,不過 Go 開發Team的人自己吐槽說很難用,搞了半天心都死了。 可喜可賀的是,Go  在 1.5 正是支援了 跨平台的到 Mobile 的工具叫 gomobile! 這消息並沒有在 google io 發佈,所以好像也沒有啥麼 Big Deal。但我覺得這是Go 即將要崛起的一個重要序曲。 Go 不但能寫後端 還可以跨到 Mobile , 甚至可以獨立完全開發 Android APK 真是太棒! 當然很多語言都可以,但很多語言就沒 Go 這麼簡單美麗而強大呀呀呀!

GoMobile Installation and Building

Command gomobile
gomobile 是用來build & run 用go 寫的 app 。 Go 語言版本需要 1.5 以上。

Go Mobile GitHub
gomobile 的 github 有比較詳盡的介紹

GoDoc for gomobile
gomobile package 的文件

Go Mobile ReadMe Note:  

根據 Gomobile github 上 ReadMe 的筆記跟做心得

Go Mobile Tool:
Go Mobile 提供兩個方法,一個是全部用 Go build 的 App , 一個是 build 成 SDK給 Java/Android/ios 使用

2015年9月11日 星期五

Google Play 上架準備

Android Developer 上的說明
http://developer.android.com/tools/publishing/publishing_overview.html

讓我簡單的整理一下 check- list
1. versionCode and versionName
2. 把 log 關掉 , 把 Manifest 上的 android:debuggable 去除
3. 把目錄清乾淨
4. Signed apk file (等等詳加介紹)
5. 把 signed apk build 出來然後測試
6. 把 server 上的 resource 準備好
7. 準備好 remote server 跟你需要的 service

Sign Your APK  --

1. 首先要有  簽章檔的存在 , 如沒有產生一個
keytool -genkey -v -keystore C:\Users\yourname\.android\androidrelease.keystore -alias androidrelease -keyalg RSA -keysize 2048 -validity 10000
執行時會需要填入一些資料以及最重要的密碼 

2. 查看簽章
keytool -list -v -keystore  "C:\Users\yourname\.android\androidrelease.keystore"
這邊我是使用絕對路徑 如使用相對路徑要注意一下 keystore 放在哪

3. Google Api Key setting
將察看簽章顯示的SHA1 copy 在 Google Api Console 裡

4.  使用下列方式取得 Hash Value 然後放在 Facebook Release Hash 裡
keytool -exportcert -alias androidrelease -keystore  "C:\Users\yourname\.android\androidrelease.keystore"  | openssl sha1 -binary | openssl base64

5. 如果測試 APK 都有過, 則表示簽章的 APK 做好了

==== 上架 ===
 http://developer.android.com/distribute/tools/launch-checklist.html






2014年1月7日 星期二

[Android] Eclipse NDK porting

Note for my porting steps!
安裝參考這篇很多 -
Reference 2:
http://blog.xuite.net/grimmslaw/78/62743658-Android+NDK+%E5%AE%89%E8%A3%9D


1. 假設 Eclipse 與 ADT 等等都有了, 只是要加裝 NDK 。 那麼只需要加裝 CYGWIN 跟 Android 所提供的 NDK
2. CYGWIN => 我裝在 C:\cygwin64  。安裝時很多選項,devel 裡的 gcc 最為重要, 但基本上我 devel都有安裝。
 PS: 但使用 CYGWIN有點問題就是 Project 的路徑啥麼的都不能有空白。這讓我有很多 project 不能使用

2. 安裝 NDK , 我按照 上面那篇 blog 安裝在 C:\cygwin64\android-ndk-r9, 然後照上篇blog這改成這樣

  • 然後到C:\cygwin\home\"使用者名稱" 目錄下,用windows編輯器編輯.bash_profile :
  • 在最後一行後加入下面四行,然後存檔:
  • PATH=/android-ndk-r9:${PATH}
  • NDK_ROOT=/ android-ndk-r9
  • NDK_Sample=/ android-ndk-r9/samples
  • export PATH NDK_ROOT NDK_Sample
3. 在 Eclipse 上裝 CDT , 這個很順, 也不多說


2013年7月18日 星期四

[Android][Facebook][中文化] Facebook SDK for Android Tutorial - Personalize

2 - Personalize


這個教學列出使用 Facebook SDK for android 如何個人化你的app 經驗的大綱。個人化則藉由顯示使用者的 profile 裡的照片與名子來達成。
  • 使用 Request,   來建構一個使用Facebook API calls 的單一要求 。 需要被授權的使用者的一個request, 它必須在一個 open Session 被傳遞。Request 也可以是匿名的, 這是說它們並不一定需要一個使用者來授權。 在這個例子裡, 沒有  Session 需要被定義出來。當一個Request 被完成時, 假如有需要的話 , Facebook SDK 將在background 裡延展 access token 。 
  • Response 封裝了來自Facebook API call 的 response
  • ProfilePictureView 是一個顯示profile 照片的客製化 view 
  • GraphUse 是一個 提供一個強烈樣式表現的介面


你將會使用這些class 跟 interface 來獲取使用者的基本資訊以用來個人化你的 app。 你將使用一個 屬於 Request class 叫做 newMeRequest() 的靜態的方法呼叫程序。 這個方法會回傳使用者的資料。 當設定好 request , 你將定義一個 callback 來處理回復。這個回復是一個 GraphUser 種類的物件。你也將處理被傳回的使用者物件, 然後使用ProfilePictureView 顯示出使用者 profile 的照片,使用 TextView 顯示使用者的名子。

這個教學帶領你走過
  • 步驟 1 : 設定使用者介面
  • 步驟 2 : 展示使用者資訊
  • 下一步
  • 相關範例
注意: 在你開始這個個人化的 app 前, 確認你已經設定好授權了。

步驟 1 : 設定使用者介面


2013年7月16日 星期二

[Android][Facebook][中文化] Facebook SDK for Android Tutorial - Authenticate with Facebook Login 中文化

Authenticate with Facebook Login

前言: 

標題連結是 fackbook 官方的教學, 十分詳細。 我在邊練習範例的過程中將其中文化, 如有翻譯上的問題,還望指教。練習這個範例前, 別忘記 facebook 的 APP 註冊以及Project 相關的設定。 以下為Project 設定簡述:

1. 在 strings.xml,  加入app_id <string name="app_id">xxxxxxxxxxxxxxxxx</string>
2. 在 AndroidManifest.xml 加入 use permission , meta-data 與一個 facebook 的 activity
     *android.permission.INTERNET
     *加入  'Meta Data'  其 Name :  com.facebook.sdk.ApplicationId, 其 value : @string/app_id
     *加入 'Activity' 其 Name:  com.facebook.LoginActivity
可以參考我上篇文 :  Facebook SDK 安裝以及使用

[Android] Facebook SDK 安裝以及使用


主要參考 Facebook 的教學  Getting Started with the Facebook SDK for Android

因為我已經裝了 Eclipse 與 ADT, 就從下列步驟開始 -

1. 下載 facebook sdk 並請 import 到 project 裡

按 Getting Started with the Facebook SDK for Android Step 2 的 download Link 會自動開啟下載連結

2. 安裝 FBAndroid  APK 再裝置裡

我是到 Android 安裝目錄下的 plateform-tool 打 adb install  檔案路徑(FBAndroid-2.1.apk )


3. 獲取 sha1 key


2013年6月18日 星期二

[Android] Android ADT 22 升級後舊 project 無法執行

這一兩天突然的幾乎所有在 workspace 的 projects 都出現了問題, 出現問題的癥狀還不止一種, trace 個別問題讓人好頭大. 從新安裝了好幾次, 都沒有用。2 天的產值就報銷了 TAT ... 本來以為是自己為了讓 Google play 商店在 emulator 上 run 搞壞了系統。 2 天後才發現原來應該是 ADT 22 的問題。 (哭~ )

收集一下相關資訊等等解決 -
*1.  Official 公告
*2 .  簡易版本
*3. 中文版好用板
-------------------------------------------------------
雖然最後終於成功了!  我這個 Project 使用到 google play service  與 support v4, 因為這樣多了點波折。

有幾個關鍵點寫出來 :
1. ADT 22 根據 (1) 所說, 第三方 的 lib 都會被 Eclipse 放置在 Private Libraries  下,而 Referencing Library 則會放置在  Dependencies 裡。如果沒有使用到第三方 Library 的, ADT 22 造成的問題 , 網友們大部分只check private libraries 就行了。 之後當然要 clean & rebuild


注意: 之前有手動加的 lib 要手動去除 . 我之前手動加 google play service 與 support v4 的 lib , 所以把這兩個去掉了。 但是這兩個其實是存在的, 在 Private Libraries 下。

2. Google Play Service 事實上這次也升級了, 所以在 project 裡也要升級。就是使用 eclipse 將整個 project 從 workspace 刪掉,再重新 import 進來。

3. Clean 有時會出問題 , 如果有這樣的問題將 bin 整個殺掉, rebuild 。 bin 裡面去看有 gms 的 class

4. Properties => Android 裡還是如同以前一樣要加 google-play-service lib

5. google-ply-service lib 記得也要 check private libraries 跟 rebuild




--------------------------------------------------------------------------
Error Msg
Unable to start activity ComponentInfo
ClassNotFoundException
。。。。






-----------------------------------------------------------
等等, 怎麼出了個  Android Studio IDE 呀~
原來Eclipse 要被丟棄了呀。。。



2013年6月17日 星期一

[Android] Facebook apk crash at login in android emulator

Facebook 在 emulator 上異常終止
為了使用 Facebook 分享功能, 於是需再 android emulator 上安裝 facebook. 不過一到 login 就異常終止。  追蹤的原因的過程有點長, 就不詳述。  關鍵是我emulator 上有安裝 Google play service 。這個 apk (com.android.vending) 導致 facebook 一直 crash。 查了一下網路, 看到一篇 Church Tech 的文章, 說是,不從 google play 下載的 apk, googleplay 會讓他 crash 掉 >.<
Google Crashes Facebook Home’s Easy Updating Party, Now Requires All Play Apps To Be Updated Through The Play Store

我覺得這個蠻有可能的是原因的。

2013年5月15日 星期三

[Android Map] Change Location of Emulator

See the Article
http://developer.android.com/guide/topics/location/strategies.html#MockData

HighLight


Using the "geo" command in the emulator console



Step1: 執行 cmd 
    執行 cmd ,  cd 到 Android SDK 下的 tools   ie:  C:\Android\tools


Step2: 連上 emulator
     telent localhost 5554 
     5554 是 emulator 的 port , 通常會顯是在 emulator 後面。 
    可用 help 看一下 commands
   

2013年5月13日 星期一

[Android] MyTracks Notes (1)


AbstractMyTracksActivity

*public abstract class AbstractMyTracksActivity extends FragmentActivity 

*onCreate()
         1.  SpeechEngine 的 setup
               setVolumeControlStream(TextToSpeech.Engine.DEFAULT_STREAM);
         2. 一個個不同api 版本的不同設置 actionbar 與 home 鑑
             * ApiAdapterFactory.getApiAdapter().hideTitle(this)
             * ApiAdapterFactory.getApiAdapter().configureActionBarHomeAsUp(this);
         
         3. setContentView

2013年5月8日 星期三

[Android] Use Google Map API v2 (3) - Work on emulator


此篇為 [Android] Use Google Map API v2 - Create a map project 續篇


在 emulator 上 run google map 會出現下圖 -

發現此狀況時需要在 emulator 上安裝 2 個  apk . 
com.google.android.gms(-xxx).apk
com.android.vending(-xxx).apk
這個部份說一下, Google 說地圖無法再 emulator 上使用。 搜尋會看到很多這麼說。
不要放棄,應該是可以的。 但看起來每個人成功的方法不太一樣。我僅提供我的。

[Android] Use Google Map API v2 - Create a map project


此篇為續 [Android] Use Google Map API v2 - Get API Key


Step 3. Create a Map project

3.1 一如往常的 Create 一個 Android APP。
3.2 修改 Manifest.xml
*在 <application> Tag 裡加入
<meta-data    android:name="com.google.android.maps.v2.API_KEY"    android:value="AIzaSyBdVl-cTICSwYKrZ95SuvNw7dbMuDt1KG0"/>裡面的 android:value 裡填 Step2 最後獲取40characters 的 APIKEY

2013年5月7日 星期二

[Android] Use Google Map API v2 - Get API Key


Google Developer :Google Maps Android API v2

說明 :

Step 1. Download Google Map API 
在 Eclipse 裡, 使用 Android SDK Manager, 找到 Extra , 看看 Google Play Service 是否有 installed 。

Step 2. Apply for Google Map Key 
使用Google Map 的 Service 需要有簽證\證書。 證書分為兩種 Debug 與 Release。 Debug 不可以用來 Release 。 首先我們先申請Debug。Realease 方法以後再加補。

獲取的方法如下
Debug:
1. 在 cmd 下打此指令

keytool -list -v -keystore "C:\Users\your_user_name\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

*your_user_name => 你的使用者名稱。
我的 Android SDK 並不是裝在 Default Directory,但這個目錄仍是在 User\(One's User name) 底下。
* 如果 cmd 下輸入指令沒有 keytool 這個指令的話,可能是 Java 環境變數沒設。 
參考: 設定Java 環境變數

成功了會跑出下列輸出

SHA1 後面就是 fingerprint
(長這樣 SHA1: BB:0D:AC:74:D3:21:E1:43:07:71:9B:62:90:AF:A1:66:6E:44:5D:75) 


2013年5月5日 星期日

[Android] Screen Size Notes






  • xlarge screens are at least 960dp x 720dp
  • large screens are at least 640dp x 480dp
  • normal screens are at least 470dp x 320dp
  • small screens are at least 426dp x 320dp
Screen characteristic Qualifier Description
Size small Resources for small size screens.
normal Resources for normal size screens. (This is the baseline size.)
large Resources for large size screens.
xlarge Resources for extra large size screens.
Density ldpi Resources for low-density (ldpi) screens (~120dpi).
mdpi Resources for medium-density (mdpi) screens (~160dpi). (This is the baseline density.)
hdpi Resources for high-density (hdpi) screens (~240dpi).
xhdpi Resources for extra high-density (xhdpi) screens (~320dpi).
nodpi Resources for all densities. These are density-independent resources. The system does not scale resources tagged with this qualifier, regardless of the current screen's density.
tvdpi Resources for screens somewhere between mdpi and hdpi; approximately 213dpi. This is not considered a "primary" density group. It is mostly intended for televisions and most apps shouldn't need it—providing mdpi and hdpi resources is sufficient for most apps and the system will scale them as appropriate. If you find it necessary to provide tvdpi resources, you should size them at a factor of 1.33*mdpi. For example, a 100px x 100px image for mdpi screens should be 133px x 133px for tvdpi.
Orientation land Resources for screens in the landscape orientation (wide aspect ratio).
port Resources for screens in the portrait orientation (tall aspect ratio).
Aspect ratio long Resources for screens that have a significantly taller or wider aspect ratio (when in portrait or landscape orientation, respectively) than the baseline screen configuration.
notlong Resources for use screens that have an aspect ratio that is similar to the baseline screen configuration.





Screen Resolution Names


http://tekeye.biz/2012/screen-resolution-names

2013年4月29日 星期一

[Android]Google I/O Memory Leak 筆記 2 - Tools


此篇為 Google I/O Memory Leak 筆記 1 - 觀念 的續篇

HighLight
1. 初步的的 Memory Leak 偵測是看你的 LogCat
紅色圈起來的地方是 System Alive Object , 看起來隨著時間不斷的加大, 並且沒有減少的跡象, 因此判定有 Memory Leak

2. 所以就要把 Memory Heap dump 下來使用 Eclipse Memory Analyzer Tool (MAT) 進行下一步分析。
     到 DMMS 中 進行 Dump 。 (參考下圖 的icon)
 

2013年4月27日 星期六

[Android] Google I/O Memory Leak 筆記 1 - 觀念

從 C/C++ 到 Android/Java Destructor 不見了! 但是對 Memory Leak 的擔憂並沒有消失, 反而是為 Android 時不時的 GC 而擔憂。 找了下面這 Google I/O Memory Leak 的演講, 看完可以建立很不錯的觀念。


Google I/O 2011: Memory management for Android Apps





===================================================
From Below My Own Notes
===================================================

2013年4月26日 星期五

[Android] Android Installation

紀錄一下 Android 的安裝, 讓以後重灌時更方便

1. 主要程式的下載
    1.1  Java
            http://www.oracle.com/technetwork/java/javase/downloads/index.html
    1.2. Eclipse
           http://www.eclipse.org/downloads/
           很多的次版本 , Android developer site 是連結到  Eclipse for Mobile Developer
           安裝完畢會問你的 workspace。 看你的 projects 要放哪裡, 就給個 directory
    1.3 Eclipse Android ADT
           http://developer.android.com/sdk/installing/installing-adt.html#Download
           安裝方法, 到 Help -> Install New Software -> 將下列網址輸入, eclipse 自動會抓取
           http://adt-addons.googlecode.com/svn/trunk/installer/com.android.ide.eclipse.installer.update/