Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Internet Explorer alert
This browser is not recommended for use with smartdevicelink.com, and may not function properly. Upgrade to a different browser to guarantee support of all features.
close alert
To Top Created with Sketch. To Top
To Bottom Created with Sketch. To Bottom
Android Guides
Example Apps

Example Apps

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.

Build Flavors

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 transport
  • tcp - Transmission Control Protocol - Only used for debugging purposes

You will mainly be dealing with multi build variants if connecting to TDK, or tcp if connecting to Manticore or another emulator.

Connecting to an Infotainment System

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.

Head Unit

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.

Troubleshooting

If your app compiles and but does not show up on the HMI, there are a few things you should check:

TCP Debug Transport

  1. Make sure that you have changed the IP in SdlService.java to match the machine running SDL Core. Being on the same network is also important.
  2. If you are sure that the IP is correct and it is still not showing up, make sure the Build Flavor that is running is tcpDebug.
  3. If the two above don't work, make sure there is no firewall blocking the incoming port 12345 on the machine or VM running SDL Core. Also, make sure your firewall allows that outgoing port.
  4. There are different network configurations needed for different virtualization software (VirtualBox, VMware, etc). Make sure yours is set up correctly. Or use Manticore.

Bluetooth

  1. Make sure the build flavor multi_sec_offDebug is selected.
  2. Ensure your phone is properly paired with the TDK
  3. Make sure Bluetooth is turned on - on both the TDK and your phone
  4. Make sure apps are enabled on the TDK (in settings)

Additional Examples

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.

Note

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.

View on GitHub.com
Previous Section Next Section