Let your app stay on top with Small Apps for Xperia™ Tablet S [SDK]

We recently announced the Xperia Tablet S, which includes a new, unique functionality called Small Apps. Small Apps are special miniature apps that run on top of other applications, to enable true multi-tasking. And now you can create your own Small Apps for the Xperia™ Tablet S by using the Sony Add-on SDK and Small App code example and documentation.  By doing so, you can gain more visibility since your app will be listed in predefined searches, which will be easily accessible for Xperia™ Tablet S users. Learn more after the jump!

Maps and small browser

Screenshot showing the Browser as a Small App on top of Google Maps.

Small Apps provide an easy way to perform several tasks at the same time. For instance, you can have a Small App web browser running on top of Google Maps, as shown in the screen shot above. In general, a Small App can have almost the same functionality as a normal app, but it’s optimised to run on top of another user activity.

Small App launcher

Screenshot showing the Small App launcher.

On the Xperia™ Tablet S, Small Apps are easily accessed from the Small App launcher always available in the system bar at the bottom of the screen.  A number of Small Apps are included on the Xperia™ Tablet S from start, such as Browser, Calculator, and Remote control. By touching “+ Add” as shown in the screenshot above, users can add a new Small App, either from Google Play, or by selecting and adding any standard widget as a Small App.

minimised view

Example of minimised voice recorder Small App icon, showing recording time.

A nice feature is that you can minimise a Small App at the edge of the screen, by a simple drag-and-drop action. Then in the minimised view, you will have several options on how to define the display of the Small App icon in addition to using a basic graphic. For example, for the voice recorder Small App icon doesn’t just include a microphone graphic as its Small App icon; it also shows the recording time as it keeps recording, and shows this data even when the voice recorder Small App is minimised.

Why develop a Small App?
As mentioned earlier, developing a Small App can help you gain visibility for your application. On the Sony Xperia™ Tablet S, a Small App launcher is a part of the system bar. When you develop a Small App according to the developer guidelines, your Small App will appear in a predefined search on Google Play. All Xperia™ Tablet S users will then see your Small App when looking for new Small Apps through the Small App interface. This means you have a really good way to get more visibility by developing a Small App! How to implement this is explained in more detail in the section “Make your Small App visible on Google Play”.

Add Small App

Example of option to add a Small App from the Google Play Store by clicking the “+ Add” option in the Small Apps launcher on Xperia™ Tablet S.

How Small Apps work
From a developer’s perspective, a Small App is a framework that runs as a service in Android. However, unlike a regular service, it has a user-interface overlaid on top of the currently running activity. A Small App has access to all regular android framework APIs, just as a usual app would have.  And it can be either a self contained app or an extension to another app, with merged code, resources, and manifest.

Small App architecture

Architecture of Small Apps framework showing the lifecycle of a Small App.

With the Sony Add-on SDK and Small App code example and documentation, you can give your app almost the same functionality as an Android™ activity, while running in a window on top of the currently running app. This means that there are several advantages with doing a Small App compared to a widget. For example, you can design your Small App window with a custom background, title, and size. You can also show a custom view when the window is minimised. Unlike widgets, a Small App can handle all types of input events, such as text input and pinch to zoom. Best of all, the Small App SDK offers a unique possibility to gain visibility for your app, which is described further down in the article.

How to develop your own Small App
To start developing your own Small App, download the Sony Tablet SDK Add-on package and the Small Apps code example and documentation and extract the files on your computer. These two zips contains everything you need to make your own Small App, including Eclipse add-ons, code examples, an emulator and documentation. Make sure to have a look in the “Get started: Use Small Apps in the Sony Tablet SDK Add-on” document that is included in the Small Apps code example and documentation package.

To make the Android framework recognise your app as a Small App, declare your Small App in the AndroidManifest.xml in the following way:

1. Add the following uses-permission (mandatory)

<uses-permission android:name="com.sony.smallapp.permission.SMALLAPP" />

2. Add the following uses-library (mandatory)

<uses-library android:name="com.sony.smallapp.framework" />

3. Add the following “service” (mandatory)
a. “exported” attribute of this service must be “true” (mandatory)

<service android:name=“SampleSmallApp” android:exported=“true” >

b. This service must specify following intent filter (mandatory)

<intent-filter>

<action android:name="com.sony.smallapp.intent.action.MAIN" />

</intent-filter>

c. To show your small app on the small-app-launcher, you have to specify the following category to this intent filter (mandatory)

<category android:name=”com.sony.smallapp.intent.category.LAUNCHER” />

After performing step 1-3 above, your code should look like this:

<manifest>
	<uses-permission android:name="com.sony.smallapp.permission.SMALLAPP" />
	<application android:label="@string/app_name" android:icon="@mipmap/ic_launcher”>
		<uses-library android:name="com.sony.smallapp.framework" />
		<service android:name=“SampleSmallApp” android:exported=“true” >
			<intent-filter>
				<action android:name="com.sony.smallapp.intent.action.MAIN" />
				<category   android:name=“com.sony.smallapp.intent.category.LAUNCHER” />
			</intent-filter>
		</service>
	</application>
</manifest>

To help you get started creating your own Small App, we have also included a basic “Hello world” Small App code example in the Small App code example and documentation. This code example provides you with basic code to be able to create a Small App, along with the code you use to configure the size and layout options available.

package com.sony.nfx.app.smallappsample;

import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.sony.smallapp.SmallAppWindow;
import com.sony.smallapp.SmallApplication;

public class MainApplication extends SmallApplication {

	TextView tx;

	@Override
    public void onCreate() {
        super.onCreate();
        setContentView(R.layout.main);
        setTitle(R.string.app_name);

        SmallAppWindow.Attributes attr = getWindow().getAttributes();
        attr.minWidth = 100; /* The minimum width of the application, if it's resizable.*/

        attr.minHeight = 100; /*The minimum height of the application, if it's resizable.*/

        attr.width = 400;  /*The requested width of the application.*/

        attr.height = 300;  /*The requested height of the application.*/

        attr.flags |= SmallAppWindow.Attributes.FLAG_RESIZABLE;   /*Use this flag to enable the application window to be resizable*/
//      attr.flags |= SmallAppWindow.Attributes.FLAG_NO_TITLEBAR;  /*Use this flag to remove the titlebar from the window*/

        getWindow().setAttributes(attr); /*setting window attributes*/

        findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Toast.makeText(MainApplication.this, R.string.hello, Toast.LENGTH_SHORT).show();
            }
        });
    }

    @Override
    public void onStart() {
        super.onStart();
    }

    @Override
    public void onStop() {
        super.onStop();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }
}

Make your Small App visible on Google Play
In order to make your Small App show up in the predefined Google Play query for Small Apps, the app description on Google Play must include “Small apps extension for Sony products”.

In addition, if the application apk file is only for a Small App, we recommended you to add “Small app” or “small app” to the application title on Google Play. For example, “Clock Small app”, “Viewer small app”, or “Note for small app”. Please note that this relates to the title on Google Play, not for the application name itself.

Download the SDK and get started right away
So, have we inspired you to develop a new Small App? Or do you already have an app that would be perfect to extend with a Small App? Head over and install the Sony Add-on SDK and the Small Apps code examples and documentation kit. We hope to see a lot of new innovative Small Apps on Google Play. And feel free to drop us a line with any questions or comments!

More information

Comments 11

Sort by: Newest | Oldest | Most popular

  1. By Timothy Bedford

    #1

    Can we download a Small App icon template? I’d love to make an icon for my small app that was a stylistic match for the Sony-supplied ones, but need a copy of the grey background with border

    • By Anna Aleryd

      #2

      Hi Timothy,

      Unfortunately, you can’t download a template for the Small App icon at the moment. However, I talked to the developers behind the SDK, and they will look into if they can provide the resource for future releases.

      Best regards,
      Anna Aleryd

  2. By Done Dos

    #3

    I’m done with my Small app but i need a little help.. can you give us a sample code using Intent on small app? i’m a little bit confuse since it’s a service instead of class. Thanks.

  3. By Tuấn Trần Anh

    #4

    I think I got the same problem with Piran Smith, the small app crashed when I started it. The stack trace showed: java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
    Is something wrong with SDK?

    • By Tuấn Trần Anh

      #5

      I found the problem. It’s running normally by changing the target of Project to Sony Tablet SDK add-on and remove all the .jar library file. :D

  4. By Piran Smith

    #6

    I’m not entirely sure that this SDK works. I’ve created many applications before and wanted to develop some neat Small Apps for my Xperia Tablet.

    I’ve started our with the sample included in the SDK, then created some myself, but the small apps on the Tablet just force close on start up, same with the emulator.

    • By Anna Aleryd

      #7

      Hi Piran Smith,

      It is hard for me to say what has gone wrong in your tries with the Small App SDK, since I don’t know the details of your specific setup and what troubleshooting you’ve done. Did you use completely unmodified sample code or did you change it in any way? What does “adb logcat” say? My recommendation is that you head over to Stackoverflow and submit your question, as we have engineers monitoring the forum for any questions related to Sony.

      Good luck!
      Br,
      Anna from Developer World

  5. By Daniel Fazio

    #8

    hi i’ve downloaded the SDK for the small apps and added to the add-on folder of the SDK.
    I also have the newwest version of ADT and SDK, but when i create a new project it doesnt show me up the smallApp SDK to choose.
    Id like to partecipate to the context.

    • By Anna Aleryd

      #9

      Hi Daniel,

      Cool to hear you want to develop a Small App! When creating your project, you should choose the Sony Tablet SDK add-on (it doesn’t have Small App in the name). Hope this answer helps you out! If not, please head over to stackoverflow with your question. We have support engineers monitoring any Sony related questions there, and they will be glad to help you out!

      Br,
      Anna from Developer World

      • By Stephen ROBINSON

        #10

        Hi Anna (feel free to delete this if you feel it is not inline) I own a Sony Tablet p, and have since purchased two Xperia phones a Z and then Z1. I’ve just had my device updated to 14.3.A.0.681 and found that the small app browser is no longer in existence. I have posted on the Sony Support Forum [http://talk.sonymobile.com/t5/forums/editpage/board-id/Xperia_Z1/message-id/22564] but the only help I am receiving is from a volunteer who believes my phone is rooted!
        As I said delete this if you feel its out of line,,,

        • By Anna Aleryd

          #11

          Hi Stephen,

          I’m sorry, but I can’t help you out with the Sony Tablet P. The right place to get support should be Sony Support. Good luck!

          Best regards,
          Anna from Developer World

1-11 of 11 comments.