yaboo@maniac:~/Projects/Android/UseLocation$ jarsigner -verbose -keystore ~/.android/debug.keystore bin/MainActivity-unsigned.apk androiddebugkey キーストアのパスワードを入力してください: 追加中: META-INF/MANIFEST.MF 追加中: META-INF/ANDROIDD.SF 追加中: META-INF/ANDROIDD.RSA 署名中: res/layout/main.xml 署名中: AndroidManifest.xml 署名中: resources.arsc 署名中: res/drawable-hdpi/icon.png 署名中: res/drawable-ldpi/icon.png 署名中: res/drawable-mdpi/icon.png 署名中: classes.dex
Showing posts with label android. Show all posts
Showing posts with label android. Show all posts
2011/07/25
android tips: what to do before install self-compiled apk
android tips: check build-target from android-sdk command
first, check installed android-sdk supports my build-target.
now, create android project using 'android' command
yaboo@maniac:~/Projects/Android$ android list targets
Available Android targets:
id: 1 or "android-3"
Name: Android 1.5
Type: Platform
API level: 3
Revision: 4
Skins: QVGA-P, HVGA-L, QVGA-L, HVGA-P, HVGA (default)
id: 2 or "android-4"
Name: Android 1.6
Type: Platform
API level: 4
Revision: 3
Skins: WVGA800 (default), WVGA854, QVGA, HVGA
id: 3 or "android-7"
Name: Android 2.1-update1
Type: Platform
API level: 7
Revision: 2
Skins: WQVGA400, WVGA800 (default), WVGA854, QVGA, WQVGA432, HVGA
id: 4 or "android-8"
Name: Android 2.2
Type: Platform
API level: 8
Revision: 2
Skins: WQVGA400, WVGA800 (default), WVGA854, QVGA, WQVGA432, HVGA
id: 5 or "android-9"
Name: Android 2.3.1
Type: Platform
API level: 9
Revision: 2
Skins: WQVGA400, WVGA800 (default), WVGA854, QVGA, WQVGA432, HVGA
id: 6 or "android-10"
Name: Android 2.3.3
Type: Platform
API level: 10
Revision: 1
Skins: WQVGA400, WVGA800 (default), WVGA854, QVGA, WQVGA432, HVGA
id: 7 or "android-11"
Name: Android 3.0
Type: Platform
API level: 11
Revision: 1
Skins: WXGA (default)
id: 8 or "android-12"
Name: Android 3.1
Type: Platform
API level: 12
Revision: 2
Skins: WXGA (default)
id: 9 or "android-13"
Name: Android 3.2
Type: Platform
API level: 13
Revision: 1
Skins: WXGA (default)
now, create android project using 'android' command
yaboo@maniac:~/Projects/Android$ android create project --target 6 --path ./myProject --activity MyActivity --package com.yablog.myproject Created project directory: ./myProject Created directory /home/yaboo/Projects/Android/myProject/src/com/yablog/myproject Added file ./myProject/src/com/yablog/myproject/MyActivity.java Created directory /home/yaboo/Projects/Android/myProject/res Created directory /home/yaboo/Projects/Android/myProject/bin Created directory /home/yaboo/Projects/Android/myProject/libs Created directory /home/yaboo/Projects/Android/myProject/res/values Added file ./myProject/res/values/strings.xml Created directory /home/yaboo/Projects/Android/myProject/res/layout Added file ./myProject/res/layout/main.xml Created directory /home/yaboo/Projects/Android/myProject/res/drawable-hdpi Created directory /home/yaboo/Projects/Android/myProject/res/drawable-mdpi Created directory /home/yaboo/Projects/Android/myProject/res/drawable-ldpi Added file ./myProject/AndroidManifest.xml Added file ./myProject/build.xml Added file ./myProject/proguard.cfg
2011/07/24
python tips: python scripting on android and remotecontrol
* Overview
SL4A(Script Layer for Android) enables you to execute several script language (such as python, ruby, ...) on your android devices. Today I tried to SL4A and remotecontrol which enables you to remotely execute python code from your non-android computer (such as linux, windows...).
- SL4A installation steps are introduced here
- RemoteControl setup steps are described here
- SL4A API is also described here
* Get location and geocode from android device (RemoteControl)
* Testing TelephonyManager functionality
* Testing Batterymanager API
* Testing CommonIntentsFacade
* Testing ContactsFacade
* Testing WifiFacade
SL4A(Script Layer for Android) enables you to execute several script language (such as python, ruby, ...) on your android devices. Today I tried to SL4A and remotecontrol which enables you to remotely execute python code from your non-android computer (such as linux, windows...).
- SL4A installation steps are introduced here
- RemoteControl setup steps are described here
- SL4A API is also described here
* Get location and geocode from android device (RemoteControl)
yaboo@maniac:~/Downloads/android-sdk-linux_x86/platform-tools$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import android
>>> droid = android.Android(('192.168.10.4', 46522)) # public server mode
>>> droid.startLocating()
Result(id=0, result=None, error=None)
>>> loc = droid.readLocation().result
>>> loc
{u'network': {u'altitude': 0, u'provider': u'network', u'longitude': 139.***69349999998, u'time': 1311439075865, u'latitude': 35.***094566666668, u'speed': 0, u'accuracy': 75}, u'gps': {u'altitude': 58.9000244140625, u'provider': u'gps', u'longitude': 139.***20321081579, u'time': 1311439081000, u'latitude': 35.***270288087428, u'speed': 0, u'accuracy': 55}}
>>> n = loc['network']
>>> la = n['latitude']
>>> lo = n['longitude']
>>> la
35.***094566666668
>>> lo
139.***69349999998
>>> address = droid.geocode(la, lo).result
>>> print repr(address).decode('unicode-escape')
[{u'thoroughfare': u'*丁目', u'locality': u'**市', u'admin_area': u'**県', u'feature_name': u'27', u'country_code': u'JP', u'country_name': u'日本'}]
>>> droid.stopLocating()
Result(id=3, result=None, error=None)
* Testing TelephonyManager functionality
>>> print droid.getDeviceId().result
3568***********
>>> print droid.getCellLocation().result
{u'lac': 145, u'cid': 99008715}
>>> print droid.getDeviceSoftwareVersion().result
01
>>> print droid.getNeighboringCellInfo().result
[]
>>> print droid.getNetworkOperator().result
44010
>>> print droid.getNetworkOperatorName().result
NTT DOCOMO
>>> print droid.getPhoneType().result
gsm
>>> print droid.getSimCountryIso().result
jp
>>> print droid.getSimOperator().result
44010
>>> print droid.getSimOperatorName().result
>>> print droid.getSimSerialNumber().result
89811**************
>>> print droid.getSimState().result
ready
>>> print droid.SubscriberId().result
com.googlecode.android_scripting.rpc.RpcError: Unknown RPC.
None
* Testing Batterymanager API
>>> droid.batteryStartMonitoring()
Result(id=24, result=None, error=None)
>>> print droid.batteryCheckPresent().result
True
>>> print droid.batteryGetHealth().result
2
>>> print droid.batteryGetLevel().result
74
>>> print droid.batteryGetPlugType().result
2
>>> print droid.batteryGetPlugType().result
1
>>> print droid.batteryGetStatus().result
2
>>> print droid.batteryGetTechnology().result
Li-ion
>>> print droid.batteryGetTemperature().result
360
>>> print droid.batteryGetVoltage().result
4057
>>> print droid.readBatteryData().result
{u'status': 2, u'temperature': 380, u'level': 74, u'battery_present': True, u'plugged': 1, u'health': 2, u'voltage': 4057, u'technology': u'Li-ion'}
>>> droid.batteryStopMonitoring()
Result(id=35, result=None, error=None)
* Testing CommonIntentsFacade
>>> droid.viewMap(u"*****") # android device open google map!!! Result(id=40, result=None, error=None)
* Testing ContactsFacade
>>> droid.contactsGetCount().result 301
* Testing WifiFacade
>>> print droid.wifiGetConnectionInfo().result
{u'ssid': u'**********', u'bssid': u'00:0d:02:f7:**:**', u'network_id': 0, u'supplicant_state': u'completed', u'link_speed': 54, u'mac_address': u'04:**:65:**:**:18', u'rssi': -57, u'ip_address': 67***24, u'hidden_ssid': False}
>>> print droid.wifiGetScanResults().result
[{u'capabilities': u'[WPA-PSK-TKIP+CCMP][WPA2-PSK-TKIP+CCMP]', u'frequency': 2467, u'ssid': u'logitec51', u'bssid': u'00:01:8e:f2:**:c0', u'level': -82}, {u'capabilities': u'[WEP]', u'frequency': 2442, u'ssid': u'**********', u'bssid': u'00:0d:02:f7:c0:bc', u'level': -55}]
Subscribe to:
Posts (Atom)