ym88659208ym87991671
Native App | Documentation SmartMarket
Skip to main content

Native App

note

English version of the documentation is under development.

Native App is an Android app with graphical interface to which you can connect voice control. These may include video games, fitness workouts, apps for launching video and audio etc. Native App is available on SberBox, SberBox Top and SberPortal devices.

Creation of a Native App

Step 1 — development

Native App is a SmartApp with its own front-end and back-end. Native App front-end is an Android app in the apk format. It can be created in any Android development environment, such as Android Studio or Unity. Learn more about apk file download in the apk file download section.

Native App back-end is a voice scenario for the Android app. A scenario can be created with any SmartMarket tool. Front-end and back-end can be connected through the Android library, which should be linked to the project.

Step 2 — testing

  1. Download the apk file.
  2. Give the SmartApp an activation name, for example "cabbage 48".
  3. Ask the assistant on your device to find the SmartApp by its activation name, for instance, "Run cabbage 48".
  4. Install the SmartApp on your device.
  5. Open the SmartApp and test it.
note

If you download a new version of the apk file for the SmartApp that is already installed on your device, updates will appear within an hour. To speed up the process you can reboot the device

If you want other members of your team to test the SmartApp, invite them to your space.

Step 3 — moderation

When SmartApp is ready, submit it for moderation - it's an obligatory check of the SmartApp against our system and interface requirements.

Step 4 — publishing

When the moderation is finished, your SmartApp is ready for publication. To do it, click Publish in SmartMarket Studio settings, and the SmartApp will appear in the SmartMarket app catalog.

Specifics of the development

Requirements to a Native App

When developing a Native App, the following should be taken into account:

  • technical specifications;
  • general requirements;
  • UI and UX requirements to SmartApp design. Designing a Native App is not different from designing a Canvas App.

SmartApp that does not meet the requirements will not be moderated and will not be included in the catalog. That is why we recommend that you read our development guidelines.

The download of the apk file

The easiest way to release a Native App is to port an existing Android app. To do that:

  1. Open SmartMarket Studio and press the Create SmartApp button.
  2. Select a Native App type and a tool where you implement your voice scenario (optionally).
  3. Go to the SmartApp settings and download the apk file in the Basic Settings section. The file size should not be more than 100 Mb.

When it is downloaded, the apk file will be verified for set limits, viruses, archive integrity, etc. If the file is verified, the created SmartApp will be given the "Draft" status. It means that the SmartApp is ready for use, but it will not support work with virtual assistants - you need to develop an additional voice scenario for that.

Apk file signature

Every apk file should have a signature. You can generate a signature with any environment for Android development, for instance, Android Studio. Do not use debug scriptures for the generation.

Do not change the signature of the apk file after its first download - any update should only take place with it. If the signature is tampered with or lost, the SmartApp will no longer be able to update.

The connection of ADB

ADB (Android Debug Bridge) is a tool for SmartApp debugging based on the Android operating system. It allows adding test device and running Native App on them at the development stage.

To connect ADB:

  1. Go to the My Devices section in SmartMarket Studio.
  2. Add a test device:
    • Specify identifier, for instance, 385342565001000011350d25. You can find it in the device setting in the About the Device section.
    • Select your device type from the list, for example OKKO Smart Box.
  3. Select a device from the list and press the Connect ADB button. ABD becomes available on the device within a few minutes (for the devices with OS StarOS version 1.71 and later).
  4. Run the adb connect <ip-address> command in the terminal. You can find the ip-address in the device setting in the About the Network section.
danger

Be sure that the device and the computer are on the same Wi-Fi network and that there are no VPN connections that can overwrite network routes.

Display on the device

An installed Native App is displayed in the launcher - an interface in the device, where a user can select and run an installed app.

The following Android attributes must be supported in the project so that the Native App was displayed in the launcher:

  • android:banner is an attribute for the download of the SmartApp icon.
  • Category_Leanback_Launcher is an installation filter of a special category, responsible for launching the SmartApp from the launcher.

If these attributes are not supported, Native App will not appear on the device, and users will not be able to run it.

Back up

There may not be enough space on the device to install a new SmartApp. In this case, SmartApps that have not been run for the longest time, i.e. the most unpopular ones for this user, will be automatically deleted. Several SmartApps can be deleted in order to free enough space for the installation. The deleted SmartApps will be displayed on the user's device with a special icon of reloading.

We recommend setting up a backup in case your SmartApp falls into the unpopular category. A backup will help restore users\' data when the SmartApp is unloaded.

Back up can be configured via the Android protocol. If you have supported this protocol in your SmartApp, all user data will be automatically saved in the SberDevices cloud storage. The size of the saved data should not be more than 25 Mb. If the protocol is not supported, the data will be lost when the SmartApp is unloaded.

SmartApp update

To update the SmartApp, go the "Draft" version and download the apk file in your project. When a new file is downloaded, the version Code must be different and higher than the one specified in the previous apk file.

Each new version of the SmartApp should be verified again, so send the SmartApp for moderation after downloading the apk file. When the SmartApp is verified, publish it.

When the SmartApp is updated on the user's device, its data will automatically be transferred to a new version, while the previous version of the SmartApp will be deleted without possibility of recovery. If a new version of the SmartApp is unstable or inadequate, the moderators may temporarily disable the SmartApp. In this case, the SmartApp will be unavailable for users.

Voice control

To provide your Native App with voice control, you should additionally develop and connect a voice scenario. To do that, you can use free SmartMarket Studio tools.

For example, you can select the SmartApp Code development environment and write your scenario in JavaScript, or you can connect the SmartApp Framework library and develop your scenario in Python.

note

When connecting a voice scenario via SmartApp Code, make sure that the Send command / start for voice launch option is selected in your SmartApp settings. Otherwise the SmartApp won't start.

Limitations

Native App has a few limitations that will prevent you from using the following features:

  • accessing the microphone (the limitation for SberBox only);
  • accessing users' personal data (such as geolocation).

Technical specifications

SberBoxSberPortalSberBox Top
Android OS9.0 (AOSP)9.0 (AOSP)9.0 (AOSP)
SoCAmlogic S905Y2Amlogic A311DAmlogic A311D
CPUQuad Cortex-A53, armeabi-v7a,armeabiQuad CoreCortex-A73 + Dual-Core-A53Quad CoreCortex-A73 + Dual-Core-A53
GPUARM Mali-G31 MP2, OpenGL ES 3.2ARM Mali-G52 MP6ARM Mali-G52 MP6
RAM2GB DDR42GB DDR42GB DDR4
DPI320320320
Disk8 GB16 GB16 GB
Resolution1920×10801280×8001920×1080
ScreenIt can be connected to the TV via HDMI interfaceBuilt-in touch-screen. The aspect ration is 16:10It can be connected to the TV via HDMI interface
ControlRemote control
•Gamepad
•Voice
•Virtual remote control
•Gamepad
•Voice
•Touch-screen
•Position identification
•Gestures
•Remote control
•Gamepad
•Voice
•Gestures
•Position

Extra services

SmartMarket offers open source libraries that can be connected to a Native App. The libraries provide the following opportunities:

You can additionally connect the following Android libraries:

Communication between the assistant to the scenario

The exchange of messages between the assistant and the SmartApp scenario is possible via the messaging library. This library allows the SmartApp to transmit information about user actions to the scenario, and allows the scenario to notify the SmartApp about voice queries. The messaging library is not bound to queries and is sent as needed.

You can connect the library by declaring a gradle or maven dependency in your project.

Gesture and posture recognition

Use the cv-api library to recognize postures and gestures from built-in cameras on your devices. The library works on SberPortal and SberBox Top devices.

The library recognizes:

  • gestures (for example, the user shows a palm and the device understands that it is a "Pause" sign);
  • face and body, and their arrangement in a rectangular frame;
  • positions (key points of face and body);
  • background (to separate the background from the human figure).

You can connect the library by declaring a gradle or maven dependency in your project.

SmartApp state

To make the SmartApp scenario understand what is going on in the user's customer side, it should receive the current interface state. The SmartApp state can be communicated via the appstate library. The state is communicated in the json format. Unlike messaging, the appstate library is bound to every voice enquiry the user makes.

The examples of the SmartApp states include current section in the menu, playback status of audio track, game character state etc.

You can connect the library by declaring a gradle or maven dependency in your project.

The state of the camera and microphone

Use the mic-camera-state library to get the current state of microphone and camera of your device. The examples of states include: gestures are not available, the assistant cannot hear the user, the camera is off etc. The library works on SberPortal and SberBox Top devices.

You can connect the library by declaring a gradle or maven dependency in your project.

Accessing the camera

You can use Android\'s built-in mechanisms to capture images from the camera of your device. To do that, examine the Android Camera2 API documentation.

When using the camera through this protocol, you should:

  • ask the user for permission to gain access;
  • handle callback with errors. For example, the SberPortal device has a cover closing access to the camera. If at this point the SmartApp tries to use the camera of the device, an error will appear and it should be handled correctly.

Full-screen mode

By default, devices with assistants display a curtain, an element at the bottom of the screen that shows the current state of the assistant, its responses or suggests. This curtain covers the bottom of the screen and prevents the SmartApp from being displayed in full-screen mode. To remove the curtain, use the following functions:

// enabling the full-screen mode
val currentFlags = decorView.systemUiVisibility
decorView.systemUiVisibility = currentFlags
or View.SYSTEM_UI_FLAG_IMMERSIVE
// disabling the full-screen mode
val currentFlags = decorView.systemUiVisibility
decorView.systemUiVisibility = currentFlags
and View.SYSTEM_UI_FLAG_IMMERSIVE.inv()

Since the curtain displays user requests and assistant responses, it is recommended to hide it only when necessary.