wrz

29

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 downloading the Small App SDK and Small App SDK 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, using the Small App SDK can help you gain visibility for your application. On tablets, 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 Small App SDK and Small App SDK 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 Small App SDK and Small App SDK documentation and extract the files on your computer. The Small App SDK contains everything you need to make your own Small App, including Eclipse add-ons, code samples, emulator and guiding documents. Make sure to have a look in the user guide “Getting started with the Small App SDK – Developer guidelines” that is included in the Small App SDK 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” />

  1. Add the following uses-library (mandatory)

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

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

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

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

<intent-filter>

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

</intent-filter>

  1. If you want to show your small app on the small-app-launcher, you have to specify the following category to this intent filter (optional)

<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 SDK 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*/
//        attr.flags |= SmallAppWindow.Attributes.FLAG_HARDWARE_ACCELERATED;  /* Use this flag to enable hardware accelerated rendering*/
        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 extensions 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 to the downloads section and get the Small App SDK and Small App SDK documentation. 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

Źródło: Let your app stay on top with Small Apps for Xperia™ Tablet S [SDK]



Category: Sony Ericsson | Tags: None

Related Posts




You must be logged in to post a comment.

Name (wymagane)

Email (wymagane)

Witryna internetowa

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Share your wisdom

wielkoformatowe wydruki Lublin kolorowe wielkoformatowe skanowanie kolorowe skanowanie Lublin drukowanie skanowanie dokumentacji lublin drukowanie projektów w lublinie projekty powykonawcze dokumentacja powykonawcza skanowanie do pliku wielki format