Code examples using hidden Android™ APIs

Have you ever thought about using hidden Android™ APIs? A few weeks ago, Erik Hellman from Sony Ericsson’s Technology research department presented a few examples of how these APIs could be used at Droidcon in London, and at Mobile Monday in Bucharest. We have now made Erik’s hidden API code examples available for download.

Download and learn more after the jump.

In every Android release, there are a large number of hidden APIs available. The hidden APIs can be used by applications, but they are not very easy to find unless you know what you are looking for. The reason to hide certain APIs may differ. Some may not be regarded as stable enough to promote, others may be subject to change. Several other reasons may exist. Nonetheless, by knowing about these APIs, you definitely have the chance to get ahead of your competition by creating some unique hidden API-based functionality in your apps.

The hidden API code examples, created by Erik Hellman, consist of four different examples. Find out more about them below.

ReadSMS code example
This is a small code example that is intended to show how an application can read the internal SMS database. The hidden part here is the content URI to the SMS database: “content://sms/inbox”. This code example only requires the following permission to read SMS: “android.permission.READ_SMS”.

Tethering code example
This code example demonstrates how an app can use Wi-Fi with the Java reflection methods. This code example must be signed with a system certificate, and it must also share the User Id with the system. The system User Id is declared shared by declaration in the Android manifest:

<manifest xmlns:android=""

This code example also requires a set of Wi-Fi permissions:

<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_APN_SETTINGS" />

The hidden API here is the broadcast intent: “”. This is received by the broadcast receiver in the project. The hidden method in this class is called setWifiApConfiguration and it is reached using the Java reflection method in that class.

WifiConfiguration config = new WifiConfiguration();
config.SSID = "EriksOpenWifi";
String setWifiApConfigurationMethodName = "setWifiApConfiguration";
Method setWifiApConfigurationMethod =
wifiManager.getClass().getMethod(setWifiApConfigurationMethodName, WifiConfiguration.class);
result = (Boolean) setWifiApConfigurationMethod.invoke(wifiManager, config);

This code snippet is used to reach this code:

public boolean setWifiApConfiguration(WifiConfiguration wifiConfig) {
   try {
      return true;
   } catch (RemoteException e) {
      return false;

Overlay and Touch input code examples
These two code examples work together in order to demonstrate how to do touch input and how to draw a window on top of the currently active window. These code examples need system permissions, and must be run as system user.

<manifest xmlns:android=""

The two things requiring system privileges are the permission “.provider.Telephony.SMS_RECEIVED” and the direct interface to the window manager. To use the code example requiring the system certificate, you need to sign your apps with the keys of the system certificate. To try this, you can use a phone with a custom ROM.

Feedback and learning more
These are some examples showing how you can work with hidden APIs. To learn more, there are several resources available online. We especially recommend the five part hidden API introduction available at DevMaze. Here, you will not only learn how to work more with hidden APIs, but also how to get it to work in different phones.

Feel free to comment and ask questions on this topic, Erik Hellman and the rest of the Engineering team will try to answer your questions as soon as possible. What potential uses do you see in utilising these hidden APIs?

More information

Comments 2

Sort by: Newest | Oldest | Most popular

  1. Pingback #1

    […] Sony-Ericsson Developer: Code examples using hidden Android™ APIs […]

  2. By shivaprasad imdapur


    Can you tell me that how to use hidden API’s in android application.

    Thanks in advance.

1-2 of 2 comments.