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

2017年1月9日 星期一

Google Play Store Feature Notes



1.      Android 裝置上的返回鍵,應該有正常作用,可以[返回上一頁]
 To maintain a consistent user experience, the Android Back button must:
• Have the same functionality as any on-screen back or close button
• Dismiss all dialog windows
Please refer the attached screenshot for more details.
For more info:
https://developer.android.com/distribute/essentials/quality/core.html#ux
https://developer.android.com/design/patterns/navigation.html
2.      遊戲中必須進行的流程(例如說新手任務),介面不應該讓用戶有取消的按鈕,造成任務中斷

3.      Android 裝置切換到英文語系的時候,遊戲APP的名稱應該是顯示對應的英文名稱(例如註冊的英文名稱),避免顯示亂碼、中文

4.      商店中一定要有隱私權宣告的連結
https://support.google.com/googleplay/android-developer/answer/2519872

5. TargetSDK Version 要設定為最新,而且要確保可以正確執行在最新Android版本上



6.      要有一張 Feature 的美術圖(Feature Graphic),要符合幾個 guideline
• The feature image should prominently display the app’s title/logo as this graphic may be displayed without the app icon during a promotion.
• Use large font sizes that are legible across multiple screen sizes.
• Try to vertically and horizontally center any logo/copy information in the frame to ensure visibility
For more info:
https://support.google.com/googleplay/android-developer/answer/1078870?

7.      商店上要有提供平板的美術宣傳圖
Please upload at least one unaltered, high-resolution (1280 x 800 minimum) screen capture to the tablet sections of the developer console, preferably in each supported orientation. For more info:
http://developer.android.com/distribute/googleplay/quality/tablet.html#google-play

8.      App Icon 要符合一些guideline
http://www.google.com/design/spec/style/icons.html#icons-product-icons
Consider using this icon generator as a starting point: http://goo.gl/14DrRi (Github)

9.      不要在用戶重複按會產生對話介面(Dialog)按鈕的時候,產生堆疊式的對話介面,而應該只顯示單一一個對話介面

2016年3月3日 星期四

Android Unique Identifiers

1. Android ID

androidId = Settings.Secure.getString(mContext.getContentResolver(), Settings.Secure.ANDROID_ID);

http://developer.android.com/intl/zh-tw/reference/android/provider/Settings.Secure.html#ANDROID_ID
  • A 64-bit number (as a hex string) that is randomly generated when the user first sets up the device and should remain constant for the lifetime of the user's device. The value may change if a factory reset is performed on the device.
  • Each android profile(on same device) has its own android id
    http://stackoverflow.com/questions/13408349/implications-of-android-multiple-user-support-new-in-4-2-for-server-side-data/13465373#13465373
  • Some devices before Android 2.2 have same android id : 9774d56d682e549c

2. UUID

uuid = UUID.randomUUID().toString();
http://developer.android.com/intl/zh-tw/reference/java/util/UUID.html

  • UUID is an immutable representation of a 128-bit universally unique identifier (UUID).
  • Generated by JAVA, each APP has their own UUID
  • UUID may change if execute "clean data" or uninstall APP

3. Device ID(UDID) (IMEI/MEID)

TelephonyManager tm = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);deviceId = tm.getDeviceId();

  • WIFI Version(no GSM) device has no IMEI
  • Need READ_PHONE_STATE privilege
  • Unique on each device

4. Advertise ID 

https://support.google.com/googleplay/android-developer/answer/6048248?hl=zh-Hant
public String getAdvertisingId () {
    if(mAdvertisingId != null) return mAdvertisingId;    AsyncTask, 
Void, String> task = new AsyncTask, Void, String>() {
@Override protected String doInBackground(Void... params) {
AdvertisingIdClient.Info idInfo = null; try {
idInfo = AdvertisingIdClient.getAdvertisingIdInfo(mContext.getApplicationContext()); Log.v(TAG, "get idInfo : " + idInfo.toString()); } catch (GooglePlayServicesNotAvailableException | GooglePlayServicesRepairableException | IOException e) {
e.printStackTrace(); }
String advertId = null; try{
advertId = idInfo.getId(); mAdvertisingId = advertId; Log.v(TAG, "do In background : " + mAdvertisingId); }catch (NullPointerException e){
e.printStackTrace(); }
return advertId; }
}; task.execute(); return mAdvertisingId;}
 
  • User can reset advertising id manually
  • Need Google Play Services SDK
  • https://www.safaribooksonline.com/blog/2014/01/16/advertising-id-android-kitkat/

5. Serial ID

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
    serialId = Build.SERIAL;} 
  • Unique on each device
  • Need API Level >= 2.3


6. Subscribe ID (like UDID)

TelephonyManager tm = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);subscriberId = tm.getSubscriberId();

  • Need READ_PHONE_STATE privilege
  • Unique on each device




Ref : http://blog.mosil.biz/2014/05/android-device-id-uuid/


2015年9月25日 星期五

Dump Android APK version info

Use Android SDK Tool  aapt.exe


"C:\Program Files\Android sdk\build-tools\22.0.1\aapt.exe" dump badging myTest.apk

2015年2月13日 星期五

GenyMotion Google Play and ARM(CPU_ABI_INCOMPATIBLE) Support

1.  Google Play

https://gist.github.com/wbroek/9321145

Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)
Google Apps for Android 4.2 (https://www.androidfilehost.com/?fid=23060877490000128 - gapps-jb-20130812-signed.zip)
Google Apps for Android 4.1 (https://www.androidfilehost.com/?fid=22979706399755082 - gapps-jb-20121011-signed.zip)
Google Apps for Android 2.3.7 (http://www.mediafire.com/download/bs063kb0m742o5l/gapps-gb-20131027-signed.zip - gapps-gb-20131027-signe.zip)


2. Install ARM
http://filetrip.net/dl?4SUOrdcMRv




Other Ref:

http://forum.xda-developers.com/showthread.php?t=2528952

2015年1月16日 星期五

Get Other App Status in Android

1. Before API Level 21 (Lolipop , 5.0 )


ref:
http://stackoverflow.com/questions/22500959/detect-when-other-application-opened-or-launched

http://developer.android.com/reference/android/app/ActivityManager.html

getRunningAppProcesses()
Returns a list of application processes that are running on the device.

getRunningTasks(int maxNum)
This method was deprecated in API level 21. As of LOLLIPOP, this method is no longer available to third party applications: the introduction of document-centric recents means it can leak person information to the caller. For backwards compatibility, it will still retu rn a small subset of its data: at least the caller's own tasks, and possibly some other tasks such as home that are known to not be sensitive.


A : Get Running Processes Lists

ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> runningAppProcessInfo = am.getRunningAppProcesses();

for (int i = 0; i < runningAppProcessInfo.size(); i++) {
  if(runningAppProcessInfo.get(i).processName.equals("com.the.app.you.are.looking.for") {
    // Do you stuff
  }
}

B: Get Top Task ( Foreground Tasks)

public static boolean isForeground(Context ctx, String myPackage){
    ActivityManager manager = (ActivityManager) ctx.getSystemService(ACTIVITY_SERVICE);
    List< ActivityManager.RunningTaskInfo > runningTaskInfo = manager.getRunningTasks(1); 

    ComponentName componentInfo = runningTaskInfo.get(0).topActivity;
    if(componentInfo.getPackageName().equals(myPackage)) {
        return true;
    }       
    return false;
}

2. After API Level 21 (Lolipop)


the getRunningTasks is deprecated


other approach :
getAppTasks 
http://developer.android.com/reference/android/app/ActivityManager.html#getAppTasks%28%29


http://www.intertech.com/Blog/android-5-api-changes-getapptasks/

2015年1月14日 星期三

WebView Size Problem in Andorid 4.4

1. the webpage will over screen size

ref :
https://developer.android.com/guide/webapps/migrating.html


add :
WebSettings settings = webView.getSettings();
settings.setUseWideViewPort(true);
settings.setLoadWithOverviewMode(true);





Other:
set webview background color

myWebView.setBackgroundResource(Color.TRANSPARENT);
myWebView.setBackgroundColor(Color.TRANSPARENT);

2015年1月7日 星期三

Disable TitleBar(ActionBar) in Android App

1. Activity shouldn't exntend ActionBarActivity

public class MainActivity extends ActionBarActivity {

public class MainActivity extends Activity {


2. in AndroidManifest.xml

            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >

Android WebView App Crash on Android 4.4 in GenyMotion

In LogCat

Some errors like

eglCodecCommon﹕ **** ERROR unknown type  (many)
GL ERROR :GL_INVALID_ENUM : glProduceTextureCHROMIUM: target was GL_TEXTURE_EXTERNAL_OES


temporary disable hardware accelerate

in AndroidManifest.xml

.
.
android:hardwareAccelerated="false"
.
.>


reference :
http://stackoverflow.com/questions/26836858/android-genymotion-vm-logcat-runs-into-infinite-loop



http://blog.csdn.net/lfdfhl/article/details/9139259

2014年9月30日 星期二

Android In App Billing Note


The Item that you were attempting to purchase could not be found, while download app from google play

1. check if the apk is uploaded and published aka 已發布 (even in Alpha stage)
    in Developer Console, the Apk , right up corner
2. check the SKU name
3. IAB need to test in REAL device (not virutal device like AVD)
4. the google account of the test device can not same as the Developer Console's account
5. the test apk should use same version number and same key to signed as the uploaded apk


Android Developer Tools 23.0 Export APK Error



When Exporting APK, there are 3 kinds of error when using ADT 23.0


1. duplicate id @+id/image already defined earlier in this layout

2. This class should be public (android.support.v7.internal.widget.ActionBarView.HomeView) : google-play-services_lib

3. "app_name" is not translated in af, am, ar, be, bg, ca, cs, da, de, el, en-rGB, en-rIN, es, es-rUS, et, et-rEE, fa, fi, fr, fr-rCA, hi, hr, hu, hy-rAM, in, it, iw, ja, ka-rGE, km-rKH, ko, lo-rLA, lt, lv, mn-rMN, ms, ms-rMY, nb, nl, pl, pt, pt-rBR, pt-rPT, ro, ru, sk, sl, sr, sv, sw, th, tl, tr, uk, vi, zh-rCN, zh-rHK, zh-rTW, zu

to fix that  Change Lint  FATAL to Warring
Window -> Preference -> Android -> Lint Error Checking

Correctness ->  DuplicateIds
Correctness ->  Instantiatable

Correctness:Messages -> Missing Translation

2014年5月11日 星期日

Android Programming - Disable Soft Keyboard On Button Click



import android.view.inputmethod.InputMethodManager;
import android.content.Context;

public void onClick(View v) {

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

imm.hideSoftInputFromWindow(calcButton.getWindowToken(), 0);

}

2014年2月10日 星期一

Android Google Play Store IAP V3 Consuming Product (扣點未取得道具問題) (驗單)

Sample Code :

https://code.google.com/p/marketbilling/source/browse/?r=ba61fb3aaad43650b1f0e73d6057d5374ff43518

說明
http://developer.android.com/training/in-app-billing/preparing-iab-app.html

參考資料:

http://developer.android.com/google/play/billing/billing_integrate.html


Querying for Purchased Items 和

Consuming a Purchase 部份 

Securing Your Application 部分 (驗單)


https://developers.google.com/android-publisher/api-ref/purchases/products    (驗token)
http://developer.android.com/google/play/billing/billing_reference.html
http://robertomurray.co.uk/blog/2013/server-side-google-play-in-app-billing-receipt-validation-and-testing/







2013年10月16日 星期三

Decode and Encode Android APK file

1.  Download Apktool

https://code.google.com/p/android-apktool/

extract to get apktool.jar


2.  decode
java -jar apktool.jar decode app.apk app

3.  encode
java -jar apktool.jar build app app_new.apk

Warning : You need to resign the apk....