Notes by freyo
Displaying keyword search results 1 - 10
Created by freyo on February 06, 2013 21:10:47
Last update: February 06, 2013 21:12:18
I have an old Samung phone to be used as a toy. After restoring back to factory image and power on, I was stuck at the activate service screen. Unfortunately, the four corner magic touch did not work. So I did quite a bit of digging and this is what worked on my Samsung Continuum: Press emergency call button, then at the dialer, press * # 8 3 7 8 6 6 3 3 , press the Home key From the home screen, tap phone icon, Dial * # 2 2 7 4 5 9 2 7 Enter SPC code: ______ displays tap in white box to show virtual keyboard, enter 6 digit code (default: 000000), tap OK Select “Hidden menu Enable”, tap OK From...
Created by freyo on September 29, 2011 16:01:31
Last update: September 29, 2011 16:09:37
With standalone broadcast receiver
AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?>
<manifes...
Java code:
package com.android.networkreceiver;
import...
Register listener inside Activity programmatically
AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?>
<manifes...
Java code:
package com.android.networklistener;
import...
Register/unregister broadcast receiver in onResume / onPause works because the connectivity change broadcast is sticky . I intentionally used two registerReceiver calls in onResume to demonstrate this - onReceive will be called once for each registration.
Created by freyo on May 13, 2011 15:45:29
Last update: September 20, 2011 08:08:12
This is an Android app that dumps any binarized xml file as plain text - to the sdcard on the device or emulator.
build.xml :
<?xml version="1.0" encoding="UTF-8"?>
<project...
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<man...
res/layout/main.xml
<?xml version="1.0" encoding="utf-8"?>
<Lin...
res/values/strings.xml :
<?xml version="1.0" encoding="utf-8"?>
<res...
src/com/android/xmltool/DumpXml.java
package com.android.xmltool;
import java.ut...
Screenshot
Pre-built APK can be downloaded from: http://code.google.com/p/android-binxml-dump/
Created by freyo on September 08, 2011 07:45:35
Last update: September 08, 2011 13:22:13
Activity test:
AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?>
<manifes...
Test code:
package com.example.android.test;
import co...
Notes: Methods setUp and tearDown are called repetitively for each test method. If you override them, you must call the corresponding super methods for the tests to work.
Self-instrumentation test (the target package is the test package itself):
AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?>
<manifes...
Test code:
package com.android.test;
import android.ut...
Created by freyo on August 25, 2011 09:07:40
Last update: August 25, 2011 20:45:43
This is a list of built-in Android permission values: Permission Description Since API Level android.permission.ACCESS_CHECKIN_PROPERTIES Allows read/write access to the "properties" table in the checkin database, to change values that get uploaded. 1 android.permission.ACCESS_COARSE_LOCATION Allows an application to access coarse (e.g., Cell-ID, WiFi) location 1 android.permission.ACCESS_FINE_LOCATION Allows an application to access fine (e.g., GPS) location 1 android.permission.ACCESS_LOCATION_EXTRA_COMMANDS Allows an application to access extra location provider commands 1 android.permission.ACCESS_MOCK_LOCATION Allows an application to create mock location providers for testing 1 android.permission.ACCESS_NETWORK_STATE Allows applications to access information about networks 1 android.permission.ACCESS_SURFACE_FLINGER Allows an application to use SurfaceFlinger's low level features 1 android.permission.ACCESS_WIFI_STATE Allows applications to access information about Wi-Fi networks 1 android.permission.ACCOUNT_MANAGER Allows applications to call into AccountAuthenticators. Only the system can get this permission. 5 android.permission.AUTHENTICATE_ACCOUNTS...
Created by freyo on October 28, 2010 23:00:48
Last update: August 23, 2011 08:51:42
Running " adb shell procrank ":
root@android:/ # procrank ... Column Name Meaning VSS Virtual Set Size: how much virtual memory associated with process RSS Resident Set Size: how much physical pages allocated for the process. Pages shared between processes are counted multiple times PSS Proportional Set Size. Take the RSS number but evenly distribute shared pages among the sharing processes. For example, if three processes are sharing 3MB, each process gets 1MB in PSS. USS Also known as Private Dirty, which is basically the amount of RAM inside the process that can not be paged to disk (it is not backed by the same data on disk), and is not shared with any other processes. Reference: How to discover memory usage of my application...
Created by freyo on June 28, 2011 11:11:03
Last update: June 28, 2011 11:11:03
This exception occurs when trying to get a private key:
PrivateKey privateKey = (PrivateKey) keyStore.getK...
Stack trace:
Exception in thread "main" java.security.Unrecover...
which was caused by giving a wrong private key password.
The solution is to correct the key password in your code, or change the password in the keystore to match that in your code:
keytool -keypasswd -alias mykey -keypass oldpasswo...
Created by freyo on May 20, 2011 12:09:24
Last update: May 20, 2011 12:09:24
To convert a private key from PEM to DER:
openssl pkey –in privateKey.pem –inform PEM –out p...
To convert a private key from DER to PEM:
openssl pkey –in privateKey.der –inform DER –out p...
Created by freyo on May 17, 2011 12:45:18
Last update: May 17, 2011 13:03:57
This works for JDK1.6 and later.
Export the key to a PKCS#12 store, using -importkeystore !
keytool -importkeystore -srckeystore ~/.keystore \...
Use openssl to convert the key to PEM (which produces a des3 encrypted key):
openssl pkcs12 -in androidplatform.p12 -out androi...
If you don't want DES encryption:
openssl pkcs12 -in androidplatform.p12 -out androi...
Convert both private key and cert to PEM:
openssl pkcs12 -in androidplatform.p12 -out androi...
Created by freyo on May 17, 2011 11:13:17
Last update: May 17, 2011 11:13:17
This is an odd-ball content provider in that it doesn't provide database records, but provides a resource as a stream. It can be used to provide media files or XML resources. Start the project with:
tools/android create project --package com.android... Create assets directory and add an XML file ( assets/demo.xml ): <? xml version="1.0" encoding="UTF-8"?> <people... Edit the layout ( res/layout/main.xml ): <?xml version="1.0" encoding="utf-8"?> <LinearL... Edit src/com/android/cptest/Dummy.java : package com.android.cptest; import java.io.... Add content provider ( src/com/android/cptest/XmlResource.java ): package com.android.cptest; import java.io.... Update AndroidManifest.xml : <?xml version="1.0" encoding="utf-8"?> <manifes... Add this section to the end of build.xml : <target name="-package-resources"> <ech... Build and install: ant install Screenshot: Remove the Dummy activity ( AndroidManifest.xml ): <?xml version="1.0" encoding="utf-8"?> <manifes... Create a new project for...