2016年1月11日星期一

Expand: NASA 's Astronomy Picture of the Day

Limit of original API https://api.nasa.gov/api.html#apod

-> no List with assoicated datetimes.

Now, adding calling with different date-time scopes.

Specification

APIMethodComment
/listPOSTGet list of photos with dates.
/month_listPOSTGet list of photos of a month.
/last_three_listPOSTGet list of photos of last 3 days including today.

Source
https://github.com/XinyueZ/nasaphoto-server




2015年12月18日星期五

2015年12月3日星期四

Push and install APK to different on PC connected devices

There's one classical problem for multi-devices that connect onto PC when we develop Android. You cannot push or install apk by command-line when more than one on it. Fine you can use two steps to do this:

1. Find devices:
    # adb devices -list

2. Select  one or more serial-numbers in your head.

3. Run:
   #  adb -s serial-number install -r  ../asdfasdf/hello.apk

That works but only for one device.

I've packed this command in to a batch and we can do with more than one devices.

Just run:  
   # installapk --all ../asdfasdf/hello.apk 
or
  # installapk serial-number serial-number serial-number serial-number ../asdfasdf/hello.apk 


Try and fork it.

P.S There's also a program to uninstall application from devices.
The command-line to uninstall app is easy like install by instead typing path of apk by package name:

# uninstallapp --all com.helloworld
or
# uninstallapp 23445345sdf sdffsdg com.helloworld

Try



2015年11月30日星期一

Should I move API level to 14

It is an interesting question.  Some % is still in the list of current version fragments.

Is it a real time to switch normal development to API 14 (android 4.0) ?


2015年11月28日星期六

Permissions type: what "must" be done and "can" be done.

If we develop with SDK >= android 6.x (target 2.3 or above) then we need permission check before application starts. It is so nice for user to let them know what the application needs, however for developer is f"x", because the codes need refactoring. There're some "know-how" to do this, even with some 3rd libraries can simplify the functions like https://github.com/hotchemi/PermissionsDispatcher .


I used this library in my projects for permission check for android 6.x.  However there's two parts of permissions which we can be granted. First one are normal ones that only should be declared in mainfest like before  (PROTECTION_NORMAL). The other part of it is the ones that not only be written in mainfest but also in your Java codes to test. Like with PermissionDispatcher you must give user system build-in popup to grant next route.


Automatically granted permissions :

android.permission.ACCESS_LOCATION_EXTRA_COMMANDS
android.permission.ACCESS_NETWORK_STATE
android.permission.ACCESS_NOTIFICATION_POLICY
android.permission.ACCESS_WIFI_STATE
android.permission.ACCESS_WIMAX_STATE
android.permission.BLUETOOTH
android.permission.BLUETOOTH_ADMIN
android.permission.BROADCAST_STICKY
android.permission.CHANGE_NETWORK_STATE
android.permission.CHANGE_WIFI_MULTICAST_STATE
android.permission.CHANGE_WIFI_STATE
android.permission.CHANGE_WIMAX_STATE
android.permission.DISABLE_KEYGUARD
android.permission.EXPAND_STATUS_BAR
android.permission.FLASHLIGHT
android.permission.GET_ACCOUNTS
android.permission.GET_PACKAGE_SIZE
android.permission.INTERNET
android.permission.KILL_BACKGROUND_PROCESSES
android.permission.MODIFY_AUDIO_SETTINGS
android.permission.NFC
android.permission.READ_SYNC_SETTINGS
android.permission.READ_SYNC_STATS
android.permission.RECEIVE_BOOT_COMPLETED
android.permission.REORDER_TASKS
android.permission.REQUEST_INSTALL_PACKAGES
android.permission.SET_TIME_ZONE
android.permission.SET_WALLPAPER
android.permission.SET_WALLPAPER_HINTS
android.permission.SUBSCRIBED_FEEDS_READ
android.permission.TRANSMIT_IR
android.permission.USE_FINGERPRINT
android.permission.VIBRATE
android.permission.WAKE_LOCK
android.permission.WRITE_SYNC_SETTINGS
com.android.alarm.permission.SET_ALARM
com.android.launcher.permission.INSTALL_SHORTCUT
com.android.launcher.permission.UNINSTALL_SHORTCUT

Just simply declare those permissions in AndroidManifest.xml and it will work just fine. No need to check for the permission listed above since it couldn't be revoked.

The permissions must be checked: