Subscribe!

Don't forget to...

 Subscribe

Friday, April 12, 2013

Above is an activity's lifecycle.


Twitter auth only works if the time on the phone being used is correct.  Sometimes the emulator is way off and then I'll get an error when trying to get authorized.

Twitter resources:
http://blog.enbake.com/developing-an-android-twitter-client-using-twitter4j/
http://twitter4j.org/en/code-examples.html
https://github.com/itog/Twitter4j-android-Sample/

Tuesday, April 9, 2013


OAuth works like the above.  What makes it REALLY difficult to do in android is the constraint that you can only make external calls through an async task (a new thread).  One way to do it with Twitter4j is to setup the Twitter object reference, AccessToken and the RequestToken as globals (ew...) and then use 1 private AsyncTask to call twitter to get the request token, then show the authorize url that's returned so the user can go authorize.  Then ask the user for the verifier, and use it to start another asyncTask to get the accesstoken. 

Monday, April 8, 2013

android tips/notes

APK = Java (src,gen) + Resources (res)

R.java = glue between Java and Resources



make a project command-line compileable :
enter project workspace directory
> android update project --name --path .
> ant install ( will fail if no device to run on)
> ant debug (should succeed, as it only compiles a debug version)


info for android virtual machines located in ~/.android/avd/

adb (add sdk/platform-tools to PATH)

adb shell

adb devices, adb -s

To get nexus one working : edit /etc/udev/rules.d/51-android.rules and add
SUBSYSTEM=="usb", ATTR{idVendor}=="18D1", MODE="0666", GROUP="plugdev".

then unhook phone, and restart everything, then allow debugging on phone, and hook it in
and then start eclipse .... that seemed to do the trick

18D1 is the vendor code, i believe for google - don't use the htc one.                             


Services : code that runs in the background (no UI)
Content Providers : share content with applications across application boundaries, e.g. contacts


LOGCAT
from project folder :
> adb logcat StatusActivity:* *:s

SETUP TWITTER easy walkthrough : http://forums.asp.net/t/1787715.aspx/1
twitter example : https://github.com/itog/Twitter4j-android-Sample

apparently, android sdk 11 and higher doesn't allow potentially long-running things to happen in the foreground thread because it could lead to the dreaded "application not responding...or w/e" error.  From that I'll get a StrictMode exception - use a lower target version of android OR put the faulty code in an async task in the background.... reference : http://stackoverflow.com/questions/6976317/android-http-connection-exception

Wednesday, April 3, 2013

android setup

Download the adt bundle, then use http://developer.android.com/sdk/installing/bundle.html to start your first app.

Might need http://developer.android.com/tools/device.html to get a device to test on.  Also might need http://stackoverflow.com/questions/10005907/eclipse-android-plugin-libncurses-so-5 to get the right libraries.

Always start eclipse using ./eclipse -vmargs -Xms1024m -Xmx2048m
( reference : http://stackoverflow.com/a/12335947/1119849 )

AFTER doing all that, you can try using ruboto : http://ruboto.org/