In this guide we take you through the steps to get our sample project, Hello Sdl Android, running and connected to Sdl Core as well as showing up on the generic HMI.
First, make sure you download or clone the latest release from GitHub. It is a package within the SDL Android library.
Open the 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 Ford TDK for development, we will assume that you have SDL Core (We recommend Ubuntu 16.04) and an HMI set up prior to this point. Most people getting started with this tutorial will not have a Ford TDK, so sample outputs will be using Sdl Core and our Generic HMI.
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
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.
multi- Multiplexing (Bluetooth, USB, TCP (as secondary transport))
multi_high_bandwidth- Multiplexing for apps that require a high bandwidth transport
tcp- Transmission Control Protocol - used only for debugging purposes
We 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
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
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
// 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
Run the project in Android Studio, targeting the device you want Hello Sdl Android installed on.
Hello Sdl Android should compile and launch on your device of choosing:
Following this, you should see an application appear on the TDK or HMI. In the case of the Generic HMI (using TCP), you will see the following:
Click on the Hello Sdl icon in the HMI.
This is the main screen of the Hello Sdl App. If you get to this point, the project is working.
On the device you are running the app on, a lock screen should now appear once the app is opened on the HMI if distracted driver notifications are set to
Lock Screens are an important part of Sdl enabled applications. The goal is to keep the driver's eyes forward and off of the device
At this point Hello Sdl Android has been compiled and is running properly! Continue reading through our guides to learn about all of the
RPCs (Remote Procedure Calls) that can be made with the library.
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.javato match the machine running Sdl Core. Being on the same network is also important.
12345on the machine or VM running SDL Core. In the same breath, make sure your firewall allows that outgoing port.