This guide takes you through the steps needed to get the sample project, Hello Sdl, connected a module.
To get the example app, download or clone the sdl_java_suite. The Hello Sdl Android app is a package within the SDL Android library. Open the sdl_java_suite/android
project using "Open an existing Android Studio project" in Android Studio. We will use Android Studio throughout this guide as it is the official IDE for Android development.
Hello Sdl Android has been built with different build flavors that allow you to quickly connect the app to an emulator or hardware. You can choose your flavor in the Build Variant menu. To open the menu, select Build > Select Build Variant. A small window will appear on the bottom left of your IDE that allows you to choose a flavor.
There are many flavors to choose from but for now we will only be concerned with the debug build variants:
multi
- Multiplexing - Bluetooth, USB, TCP (as secondary transport)multi_high_bandwidth
- Multiplexing for apps that require a high bandwidth transporttcp
- Transmission Control Protocol - Only used for debugging purposesYou will mainly be dealing with multi
build variants if connecting to TDK, or tcp
if connecting to Manticore or another emulator.
You can use a simulated or a real device to connect the example app to an emulator. To connect the example app to Manticore or another emulator, make sure you are using tcpDebug
build flavor. You must update the IP address and port number in the Hello Sdl Android project so it knows where your emulator is running. Please check the Connecting to an Infotainment System guide for more detailed instructions on how to get the emulator's IP address and port number.
1. In the main Java folder of Hello Sdl Android, open up SdlService.java
.
2. At the top of this file, locate the variable declaration for DEV_MACHINE_IP_ADDRESS
and change it to your emulator's IP address. Set the TCP_PORT
to your emulator's port number.
private static final String DEV_MACHINE_IP_ADDRESS = "192.168.1.78"; // Update private static final int TCP_PORT = 12345; // Update
3. Make sure the emulator is running, then build and run the app on a real device or a simulated device. The SDL app should show up on the HMI.
You need a real device to connect the example app to production or debug hardware. To connect the example app via Bluetooth or USB, all you need to do to is select the multi_sec_offDebug
build flavor and then run the app on an Android device. You can find more information about the USB transport in the Using AOA Protocol guide.
If using the Bluetooth transport, make sure to first pair your Android phone to the hardware before attempting to connect your SDL app.
If your app compiles and but does not show up on the HMI, there are a few things you should check:
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. Also, make sure your firewall allows that outgoing port.multi_sec_offDebug
is selected.For more examples go to the SmartDeviceLink Examples GitHub organization. Download or clone any of these projects.
The examples available include the example weather app, example navigation app, and the SDL Capabilities app.
The example weather app uses the OpenWeather API to implement a basic connected weather app with SDL UI. This example showcases multiple screens for different weather forecast types, displaying hourly and daily weather in popup menus, and showing weather alerts with SDL Alerts.
The example navigation app uses the MapBox API to create a basic video streaming map app. The example navigation app can be used as a reference for developers who want to create their own navigation app.
The SDL Capabilities app showcases various capabilities of SDL.
Some examples require obtaining API tokens from third parties for data and services. For all of these examples follow the setup instructions as outlined in their README.md.