In this guide we take you through the steps to get our sample project, Hello Sdl, running and connected to Sdl Core as well as showing up on HMI.
First, make sure you download or clone the latest release from GitHub. The Hello Sdl Android app is a package within the SDL Android library.
Open the the sdl_java_suite/android
project using "Open an existing Android Studio project" in Android Studio. We will exclusively use Android Studio as it is the current supported platform for Android development.
If you are not using a production head unit for development, we recommend using SDL Core and this Generic HMI for testing.
If you don't want to set up a virtual machine for testing, we offer Manticore, which is a free service that allows you to test your apps via TCP/IP in the cloud.
SDL Core and an HMI or Manticore are needed to run Hello Sdl Android and to ensure that it connects
Hello Sdl Android has been built with different build flavors.
To access the Build Variant menu to choose your flavor, click on the menu Build
then Select Build Variant
. A small window will appear on the bottom left of your IDE window that allows you to choose a flavor.
There are many flavors to choose from and for now we will only be concerned with the debug versions.
Versions Include:
multi
- Multiplexing (Bluetooth, USB, TCP (as secondary transport))multi_high_bandwidth
- Multiplexing for apps that require a high bandwidth transporttcp
- Transmission Control Protocol - used only for debugging purposesWe will mainly be dealing with multi
(if using a TDK) or tcp
(if connecting to SDL Core via a virtual machine or your localhost, or to Manticore)
If you aren't using a TDK or head unit, you can connect to SDL core via a virtual machine or to your localhost. To do this we will use the flavor tcpDebug
.
For TCP to work, you will have to know the IP address of your machine that is running Sdl Core. If you don't know what it is, running ifconfig
in a linux terminal will usually let you see it for the interface you are connected with to your network. We have to modify the IP address in Hello Sdl Android to let it know where your instance of SDL Core is running.
In the main Java folder of Hello Sdl Android, open up SdlService.java
In the top of this file, locate the variable declaration for DEV_MACHINE_IP_ADDRESS
. Change it to your Sdl Core's IP. Leave the TCP_PORT
set to 12345
.
// TCP/IP transport config private static final int TCP_PORT = 12345; // if using manticore, change to assigned port private static final String DEV_MACHINE_IP_ADDRESS = "192.168.1.78"; // change to your IP
if you do not change the target IP address, the application will not connect to Sdl Core or show up on the HMI
Right out of the box, all you need to do to run Bluetooth is to select the multi_sec_offDebug
(Multiplexing) build flavor.
To connect to an SDL Core instance or TDK via USB transport, select the multi_sec_offDebug
(Multiplexing) build flavor. There is more information for USB transport under Getting Started - Using AOA Protocol.
For TCP, you may use the built-in Android emulator or an Android phone on the same network as SDL Core. For Bluetooth, you will need an Android phone that is paired to a TDK or head unit via Bluetooth.
Make sure SDL Core and the HMI are running prior to running Hello Sdl Android
To know more about how to connect the app to the infotainment system, please check the Connecting to an Infotainment System
guide
Sometimes things don't always go as planned, and so this section exists. If your app compiles and does NOT show up on the HMI, there are a few things to check out.
SdlService.java
to match the machine running Sdl Core. Being on the same network is also important.tcpDebug
.12345
on the machine or VM running SDL Core. In the same breath, make sure your firewall allows that outgoing port.multi_sec_offDebug
is selected.