Tuesday, December 17, 2013

How to Load Apps or Apk on Google Glass ?

For this tutorial we will show you how install Google Sky (also known as stardroid) without rooting your Glass or swapping roms. This is the same basic procedure you would go through to manually load an app on an Android phone, but since Google Glass has a limited amount of input, the specific app you install matters. 

Before we begin it is important that you already have the Android SDK, most importantly you need ADB (android debug bridge). You also need to be somewhat familiar with opening a new terminal window. We will work for Linux and might need a little modification for Windows. We also assume you download files to your home Download directory, but you can change this as needed. (~/Downloads)

Download and Install the Android SDK (http://developer.android.com/sdk/index.html). We find it helpful to have adb in your PATH so you can call it from anywhere (you may want to add it to your .bashrc or whatever you are using).

export PATH=$PATH:~/Downloads/adt-bundle-mac-x86_64-20130514/sdk/platform-tools

First things first, Put your Glass in “Debug Mode” in the settings on the Glass itself. Locate the device info and scroll right to turn Debug Mode on. Then plug your Glass into your computer using the USB micro cable.

Now grab a version of Google Sky that you want to install (this is the same for any Android .apk file).

wget http://file.appsapk.com/wp-content/uploads/apps-2/Google%20Sky%20Map.apk

Simply load the .apk file onto the Glass with adb.

adb install ~/Downloads/Google\ Sky\ Map.apk

After the .apk is loaded onto Glass you now need to use adb shell to run it. The trick here is that you need to figure out what Activity to run. You can use the adb command dumpsys to discover a plethora of information about your Glass. You can figure out the main activity for the .apk with a little help from grep, and since it was the last thing loaded we can also narrow this information down with a tail command.

adb shell dumpsys | grep android.intent.action.MAIN | tail -n 2

This might take some time depending on your system, but it will eventually return something similar to this:

intent={act=android.intent.action.MAIN flg=0×10000000 cmp=com.google.android.stardroid/.activities.SplashScreenActivity}
android.intent.action.MAIN:

You now have the right information to start the app on Glass. We use the am command to start the app on Glass. Simply reformat the Activity call to follow the same format as the stardroid example call below:

adb shell am start -a android.intent.action.MAIN -n com.google.android.stardroid/com.google.android.stardroid.activities.SplashScreenActivity

At this point tap your Glass on and the app should be running. You will need to “down swipe” on your glass to cancel the agreement window. If you see the app running, disconnect, go outside, and check this out at nighttime! Warning: you may feel like a terminator with some kind of super power.

Note: this is not part of the Official Glass Mirror API that is displayed on your timeline and running apps full time like this is a drain on the battery, which is not in Google’s application design guidelines. It merely demonstrates how to sideload an app on Glass in your terminal without voiding your warranty.

Friday, November 22, 2013

How to get SHA certificate in Windows ?

C:\Program Files (x86)\Java\jdk1.6.0_06\bin>keytool -v -list -keystore C:\Users\sshukla\.android\debug.keystore -alias androiddebugkey -storepass android -keypass android
Alias name: androiddebugkey
Creation date: Apr 18, 2013
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Android Debug, O=Android, C=US
Issuer: CN=Android Debug, O=Android, C=US
Serial number: 64bbfdff
Valid from: Thu Apr 18 14:56:16 IST 2013 until: Sat Apr 11 14:56:16 IST 2043
Certificate fingerprints:
         MD5:  75:73:CC:22:4C:C0:EB:04:6A:C5:63:89:57:66:DC:DB
         SHA1: 8A:C7:3A:96:2E:4E:D2:F0:C6:B0:AB:1D:A2:FE:DA:6E:E2:71:8F:CD
         Signature algorithm name: SHA256withRSA
         Version: 3

Extensions:

#1: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: EF 85 F0 F3 11 65 7A D3   C7 66 10 21 BE 85 DB 69  .....ez..f.!...i
0010: 8B 9A 7A 07                                        ..z.
]
]


C:\Program Files (x86)\Java\jdk1.6.0_06\bin>

Thursday, June 20, 2013

APNS SSL Error - javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure?


1. Created certificates from mac machine
2. in tomcat server application using JavaPNS to send the notification
Used Push.alert(...) used .p12 file


javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure

I finally find the problem is due to the p12 certificate. We should not use the private key p12 file, instead we
should generate a p12 from your private key and the cert download from Apple.

Please execute the following OpenSSL command to get the correct p12 file

developer_identity.cer <= download from Apple
mykey.p12 <= Your private key

1) openssl x509 -in developer_identity.cer -inform DER -out developer_identity.pem -outform PEM
- developer_identity.cer = the .cer file obtained from developer.apple.com site.
- developer_identity.pem = the "PEM" output file name.

2) openssl pkcs12 -nocerts -in mykey.p12 -out mykey.pem.
- mykey.p12 = the (.p12) file obtained initially from exporting (.cer) file.
- mykey.pem = the "PEM" output file name.

3) openssl pkcs12 -export -inkey mykey.pem -in developer_identity.pem -out iphone_dev.p12
- mykey.pem = the "PEM" file obtained in step (2).
- developer_identity.pem = the "PEM" file obtained in step (1).
- iphone_dev.p12 = the final (.p12) file, to be used at backend server side.

After that, you should use iphone_dev.p12 to communicate with apple server.