Skip to main content
Samsung Developer Program

Edge Single Plus Panels, Edge Single Panels, and Edge Feeds

You can create Edge Single Plus panel apps, Edge Single panel apps, and Edge feed apps. They can be standalone or companion Edge apps. You can market your Edge apps, either individually or multiple Edge apps of the same type, to users through the Galaxy Apps store and other app stores.

This section presents programming used only when developing Edge Single Plus panel apps, Edge Single panel apps, and Edge feed apps. For programming used when developing all types of Edges apps, see Fundamental Edge Functionality.

 

Edge App Configuration File

The com.samsung.android.cocktail.provider XML file configures fundamental aspects of your Edge panel or feed app (such as its label, description, preview image, category, update interval, and an Edge configuration activity).

The configuration file must specify a single <cocktail-provider> element with all appropriate metadata. The file must be saved in the project resource directory res/xml/ .

Edge app metadata must or can include the following:

label

Required

Reference to a file containing the descriptive name of the Edge app.

This name is displayed in the Device Settings > Edge Screens > Manage Panel screen when the user taps the Edge app.

description

Required

Reference to a file containing a brief explanation of the Edge app.

For Edge Single Plus panels, the description is displayed in the title area.

previewImage Required Reference to the PNG file (72x325 pixels for 640-dpi displays, 82x371 pixels for 560-dpi displays) containing the image of the Edge app to be displayed in the in the Device Settings > Edge Screens > Manage Panel screen.

configure

Conditionally Required

When providing users with access to your Edge app configuration, the name of the configuration activity that specifies user-configurable settings.

category

Conditionally Required

For Edge feeds only, your Edge feed app must specify category: 'feeds'.

updatePeriodMillis

Optional

How often (in milliseconds) the Edge Framework will send your Edge app a request to refresh its item content.

The actual refresh broadcast is not guaranteed to occur within the specified intervals. To conserve battery power, we recommend that updatePeriodMillis is greater than 1 800 000 (30 minutes).

permitVisibilityChanged

Optional

Whether or not the Edge Framework is to notify your Edge app (through onVisibilityChange()) when the display status (shown or hidden) of your Edge app changes, as a result of user action: 

true  onVisibilityChanged() is to be called when the Edge app display status changes.
false onVisibilityChange() is not to be called when the display status changes.

cocktailWidth

Conditionally Required

For Edge Single Plus and Edge Single panels only, the width (in pixels) of the item area (Edge Single Plus panels) or the entire panel (Edge Single panels).

For Edge Single Plus panels, cocktailWidth must be specified and must be 550 or less and not 160.

For Edge Single panels, either:

  • Specify cocktailWidth as 160.
    or
  • Do not specify cocktailWidth (160 is the default setting).

launchOnClick

Optional

For Edge Single Plus panels only, specifies the action to be initiated (such as launching an activity) when the user taps the Edge panel's app title area.

The following example code shows how to specify a configuration file for an Edge Single Plus panel app:

<?xml version="1.0" encoding="utf-8"?> 
<cocktail-provider xmlns:android=http://schemas.android.com/apk/res/android 
    label="@string/edge_name" 
    decription="@string/edge_description" 
    previewImage="@drawable/edge_preview" 
    updatePeriodMills="1800000" 
    permitVisibilityChanged="true|false" 
    configure="com.example.edge.EdgeConfigure"
    category="feeds" 
    cocktailWidth="550" 
    launchOnClick="com.example.edge.MainActivity">
</ cocktail-provider>

Edge Panel or Feed Receivers

Your Edge app's APK AndroidManifest.xml must specify an Edge broadcast receiver that refers to the configuration file for your type of Edge app.

Caution: All metadata strings values must specify a reference to the Edge app configuration file; they must not specify a string value. Always define your Edge app strings through a strings.xml file.

The <receiver> tag must specify:

  • android:name with the name of the SlookCocktailProvider object associated with the Edge app.
  • <intent-filter> element with an <action> element containing the android:name attribute that specifies the type of Edge app, and that the SlookCocktailProvider object accepts the type of Edge update broadcasts to be accepted and processed by the Edge app receiver.
    Note: This is the only broadcast that must be explicitly declared.
  • For Edge Single Plus panel apps, specify com.samsung.android.cocktail.v2.action.COCKTAIL_UPDATE
  • For Edge Single panel and Edge feed apps, specify com.samsung.android.cocktail.action.COCKTAIL_UPDATE
  • A <meta-data> element that specifies:
    • android:name with the metadata name that identifies the data as the CocktailProviderInfo descriptor.
      Note: Always specify android:name="com.samsung.android.cocktail.provider"
    • android:resource with the path and filename to the file that contains Edge app metadata.

The following example code shows how to specify a receiver for an Edge Single Plus Panel:

/AndroidManifest.xml 

<receiver android:name=".EdgeSinglePlusProvider" > 
    <intent-filter> 
        <action android:name= 
            "com.samsung.android.cocktail.v2.action.COCKTAIL_UPDATE" /> 
    </intent-filter> 
    <meta-data 
        android:name="com.samsung.android.cocktail.provider" 
        android:resource="@xml/edge_single_plus"> 
</receiver>

The following example code shows how to specify a receiver for an Edge Single Panel or Edge Feed:

/AndroidManifest.xml 

<receiver android:name=".EdgeSingleProvider" > 
    <intent-filter> 
        <action android:name= 
            "com.samsung.android.cocktail.action.COCKTAIL_UPDATE" /> 
    </intent-filter> 
    <meta-data 
        android:name="com.samsung.android.cocktail.provider" 
        android:resource="@xml/edg_single"> 
</receiver>

Managing Edge Broadcasts

Your Edge app can extend the Android BroadcastReceiver class as a convenience class in order to manage Edge broadcasts that call the following SlookCocktailProvider methods:

Edge Broadcast Method Called Purpose

Every broadcast

onReceive()

The parameters identify the context of the Edge app receiver and the intent of the received Edge broadcast.

Override when your app wants to specify its own processing to be executed after every broadcast.

Edge app became available

onEnabled()

The parameter identifies the context of the Edge app receiver. 

Override when your app wants to specify its own processing to be executed when the user makes the Edge app available. 

Edge app display status changed

onVisiblityChange()

The parameters identify the context of the Edge app receiver, the ID of the Edge app, and its current display status. 

Override when your app wants to specify its own processing to be executed when the Edge app display status changes (for example, hidden-to-shown or shown-to-hidden). 

Edge app item content may need periodic refreshing

onUpdate()

The parameter identifies the context of the Edge app receiver, the IDs of all items in the Edge app, and its current display status.

Override when your app wants to specify its own processing to be executed to periodically refresh the content of one or more items in the Edge app. 

Edge app became unavailable

onDisabled()

The parameter identifies the context of the Edge app receiver. 

Override when your app wants to specify its own processing to be executed when the user makes the Edge app unavailable.

 

For details, see the Edge SlookCocktailProvider API class section.

The following example code shows how to manage an Edge broadcast to periodically update Edge app item content:

package com.example.edgescreen.provider; 

import com.samsung.android.sdk.look.cocktailbar.SlookCocktailManager; 
import com.samsung.android.sdk.look.cocktailbar.SlookCocktailProvider;
...

public class CocktailSampleProvider extends SlookCocktailProvider { 
    @Override 
    public void onUpdate(Context context, SlookCocktailManager 
        cocktailBarManager, int[] cocktailIds) { 
        ...
    } 
}
  • Was this article helpful?