Friday, 26 July 2013

Android API Fun

Android team have a good sense of humor and adding funny method or variable names to the API since from the first day. Below I compiled a list I have came across don't hesitate to post the ones I've been missing.

public static final float GRAVITY_DEATH_STAR_I

This constant is a member of  SensorManager class since api level 1 and gives the estimated gravity of the first Death Star (in Empire units!). Constant Value: 3.5303614E-7

public static final float GRAVITY_THE_ISLAND

This constant is also a member of SensorManager class since api level 1 and gives the gravity on the island. Which island you ask? The lost island (from the TV series Lost). Constant Value: 4.815162

public static int wtf (String tag, Throwable tr)

wtf method is a member of Log class since api level 8 and luckily doesn't stand for the f word. According to the Java Doc and wtf stands for "what a terrible failure".

public static boolean isUserAMonkey ()

isUserAMonkey method is a member of ActivityManager class since api level 8. This method can be used to determine if the user is a real user or an automated test (well, unless you are developing apps for real monkeys).

public void fyiWillBeAdvancedByHostKThx ()

fyiWillBeAdvancedByHostKThx method is a member of AdapterViewFlipper since api level 11. This method lets AdapterViewFlipper to prepare by no longer advancing its children. Instead it indicates it will be automatically advancing the the views of the AdapterViewFlipper to AppWidgetHost.

public boolean isUserAGoat ()

isUserAGoat method is a member of UserManager since api level 17 and it simply returns true if the user is a goat :) and according to the api documentation "Used to determine whether the user making this call is subject to teleportations". Basically the method is an easter egg and unless you are messing up the interface it will return false.

 Thats my collection so far, feel free to add yours or stay tuned for the upcoming version of the Android to bring some new ones.