The Small Apps API provides classes which enable you to extend existing apps into Small Apps, or create standalone Small Apps. Small Apps are apps that run on top of other apps and add smart solutions for daily routines that require multi-tasking.
In many cases, Android does not allow the user to use several apps at the same time since it displays only one app in full-screen.
The Small Apps Framework offers a method to be able to run a Small App on top of a normal app. Unlike a normal app, the Small App is shown in a small window. In addition, it allows the user to decide its display position and size.
It enables the user to multitask, e.g. play video with a normal app and reading mail with a Small App.
Small Apps can be launched by the Small Apps launcher or launched from your standard-sized application. Users launch Small Apps by using the Small Apps launcher
Normally, the Activity class is used to implement an app which has a GUI. However, if you derive from the SmallApplication class your app becomes a Small App. The SmallApplication class has a similar interface to the Activity class to make it easy to create Small Apps.
The Small App is minimized when it is moved to the edge if the screen. In this case, the minimized window displays the app icon. It shows not only the icon but also an arbitrary view if you use setMinimizedView(int). For example, you can display current date instead of the icon.
Each Small App using the SmallApplication class has a SmallAppWindow. SmallAppWindow has an interface to control its Window. The Window size, attribute, background and other attributes can be modified using this class.
The Small Apps API contains different versions of the API. The version of the Small Apps API is defined as the API level. As well as higher API level of android API cannot be used on old android system, higher API level of the Small App API cannot be used in old Small Apps Framework. When you use higher API level of the Small App API, you need to check the API level, your app running on, using SdkInfo.VERSION.API_LEVEL and call that API only on the Small Apps Framework that supports higher API level.
You must declare your Small App in the manifest file in order for it to be accessible to the system. To declare your Small App, open your manifest file and add a
<service> element as a child of the
<service> element must have the attribute
android:exported="true". In addition to this, you must add the
<uses-permission> element and the
<uses-library> element to use Small Apps feature.
Here is an example:
<manifest> <uses-permission android:name="com.sony.smallapp.permission.SMALLAPP" /> <application> <uses-library android:name="com.sony.smallapp.framework" /> <service 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> </manifest>
<service> element, you must declare intent-filter like in the example above. The
<action> element is mandatory but you can leave-out the
<category> element if your app should not be shown on Small Apps launcher.
If you want to add your Small App to an app that contains a normal app or service or widget, there is a difference in how you declare
<uses-library> in the manifest compared to when making a stand-alone Small App. This makes your app visible on devices without Small Apps Framework.
<uses-permission android:name="com.sony.smallapp.permission.SMALLAPP" android:required="false" />
By setting the
android:required flag to
false, this code ensures that the
<uses-library> is not used to filter out your app for devices witch do not have the Small Apps Framework.
|SmallAppWindow.OnWindowFocusChangeListener||Interface definition for a callback to be invoked when the Window focus is changed.|
|SmallAppWindow.OnWindowStateChangeListener||Interface definition for a callback to be invoked when the state of a Window is changed.|
|R.style.Theme||Theme for the Small App.|
|SdkInfo||Information about the installed Small Apps Framework.|
|SdkInfo.VERSION||Various version strings.|
|SmallApplication||The SmallApplication class is the base class to implement each Small App.|
|SmallAppWindow||SmallAppWindow represents the Window which renders the Small App content.|
|SmallAppWindow.Attributes||Attributes of the Window.|
|SmallApplicationManager||Interact with the overall Small Apps in the system.|
|SmallAppWindow.WindowState||The state of the Window.|
|SmallAppNotFoundException||This exception is thrown when startApplication(Context, Intent) fails because any Small App couldn't be found to execute the given Intent.|