summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Grover <joeygrover@gmail.com>2018-10-03 13:27:47 -0400
committerGitHub <noreply@github.com>2018-10-03 13:27:47 -0400
commit5b80099ac32aa39e6857c5cf3c99dfaf86553368 (patch)
treeb14abbb4f800b9a7aa32f9bea3c571889cee622b
parent300a042a756fdee3c9665435b3af51b650524381 (diff)
parent73124934d2e420e8bb454f4a25eaf2d9ce3a050b (diff)
downloadsdl_android-5b80099ac32aa39e6857c5cf3c99dfaf86553368.tar.gz
Merge pull request #842 from smartdevicelink/feature/add_hello_sdl_android_module
Add hello_sdl_android module
-rw-r--r--.travis.yml3
-rwxr-xr-xhello_sdl_android/build.gradle60
-rwxr-xr-xhello_sdl_android/proguard-rules.pro28
-rwxr-xr-xhello_sdl_android/src/main/AndroidManifest.xml68
-rwxr-xr-xhello_sdl_android/src/main/java/com/sdl/hellosdlandroid/MainActivity.java43
-rwxr-xr-xhello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlReceiver.java51
-rwxr-xr-xhello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlRouterService.java8
-rwxr-xr-xhello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java274
-rwxr-xr-xhello_sdl_android/src/main/res.zipbin0 -> 71117 bytes
-rwxr-xr-xhello_sdl_android/src/main/res/drawable/sdl.pngbin0 -> 3274 bytes
-rwxr-xr-xhello_sdl_android/src/main/res/layout/activity_main.xml16
-rwxr-xr-xhello_sdl_android/src/main/res/menu/main.xml12
-rwxr-xr-xhello_sdl_android/src/main/res/mipmap-hdpi/ic_launcher.pngbin0 -> 6614 bytes
-rwxr-xr-xhello_sdl_android/src/main/res/mipmap-mdpi/ic_launcher.pngbin0 -> 3515 bytes
-rwxr-xr-xhello_sdl_android/src/main/res/mipmap-xhdpi/ic_launcher.pngbin0 -> 9073 bytes
-rwxr-xr-xhello_sdl_android/src/main/res/mipmap-xxhdpi/ic_launcher.pngbin0 -> 17100 bytes
-rwxr-xr-xhello_sdl_android/src/main/res/mipmap-xxxhdpi/ic_launcher.pngbin0 -> 25896 bytes
-rwxr-xr-xhello_sdl_android/src/main/res/values-v11/styles.xml11
-rwxr-xr-xhello_sdl_android/src/main/res/values-v14/styles.xml12
-rwxr-xr-xhello_sdl_android/src/main/res/values-w820dp/dimens.xml10
-rwxr-xr-xhello_sdl_android/src/main/res/values/dimens.xml7
-rwxr-xr-xhello_sdl_android/src/main/res/values/strings.xml8
-rwxr-xr-xhello_sdl_android/src/main/res/values/styles.xml20
-rwxr-xr-xhello_sdl_android/src/main/res/xml/accessory_filter.xml7
-rw-r--r--settings.gradle2
25 files changed, 638 insertions, 2 deletions
diff --git a/.travis.yml b/.travis.yml
index 57284b065..22c941f6c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,6 +13,7 @@ android:
- build-tools-27.0.3
# The SDK version used to compile your project
+ - android-28
- android-27
- android-26
- android-22 #For emulator
@@ -44,7 +45,7 @@ before_script:
script:
- android list target
- - ./gradlew connectedCheck
+ - ./gradlew :sdl_android:connectedCheck
before_install:
- echo yes | sdkmanager "build-tools;27.0.3"
diff --git a/hello_sdl_android/build.gradle b/hello_sdl_android/build.gradle
new file mode 100755
index 000000000..ac8b92278
--- /dev/null
+++ b/hello_sdl_android/build.gradle
@@ -0,0 +1,60 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 28
+ defaultConfig {
+ applicationId "com.sdl.hellosdlandroid"
+ minSdkVersion 14
+ targetSdkVersion 28
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+ flavorDimensions "default"
+ productFlavors{
+ multi_sec_high {
+ buildConfigField 'String', 'TRANSPORT', '"MULTI"'
+ buildConfigField 'String', 'SECURITY', '"HIGH"'
+ }
+ multi_sec_med {
+ buildConfigField 'String', 'TRANSPORT', '"MULTI"'
+ buildConfigField 'String', 'SECURITY', '"MED"'
+ }
+ multi_sec_low {
+ buildConfigField 'String', 'TRANSPORT', '"MULTI"'
+ buildConfigField 'String', 'SECURITY', '"LOW"'
+ }
+ multi_sec_off {
+ buildConfigField 'String', 'TRANSPORT', '"MULTI"'
+ buildConfigField 'String', 'SECURITY', '"OFF"'
+ }
+ multi_high_bandwidth {
+ buildConfigField 'String', 'TRANSPORT', '"MULTI_HB"'
+ buildConfigField 'String', 'SECURITY', '"OFF"'
+ }
+ tcp {
+ buildConfigField 'String', 'TRANSPORT', '"TCP"'
+ buildConfigField 'String', 'SECURITY', '"OFF"'
+ }
+ }
+ lintOptions {
+ disable 'GoogleAppIndexingWarning'
+ }
+}
+
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
+ exclude group: 'com.android.support', module: 'support-annotations'
+ })
+ implementation 'com.android.support:appcompat-v7:28.0.0'
+ implementation project(path: ':sdl_android')
+ testImplementation 'junit:junit:4.12'
+} \ No newline at end of file
diff --git a/hello_sdl_android/proguard-rules.pro b/hello_sdl_android/proguard-rules.pro
new file mode 100755
index 000000000..7b318e2d1
--- /dev/null
+++ b/hello_sdl_android/proguard-rules.pro
@@ -0,0 +1,28 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /Users/livio/Library/Android/sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+-keep class com.smartdevicelink.** { *; }
+-keep class com.livio.** { *; }
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/hello_sdl_android/src/main/AndroidManifest.xml b/hello_sdl_android/src/main/AndroidManifest.xml
new file mode 100755
index 000000000..e556cd680
--- /dev/null
+++ b/hello_sdl_android/src/main/AndroidManifest.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ package="com.sdl.hellosdlandroid">
+
+ <uses-permission android:name="android.permission.BLUETOOTH" />
+ <uses-permission android:name="android.permission.INTERNET" />
+ <!-- Required to check if WiFi is enabled -->
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
+
+ <!-- Required to use the USB Accessory mode -->
+ <uses-feature android:name="android.hardware.usb.accessory" />
+
+ <application
+ android:allowBackup="false"
+ android:icon="@mipmap/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme"
+ tools:ignore="DeepLinks">
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name="com.smartdevicelink.transport.USBAccessoryAttachmentActivity"
+ android:launchMode="singleTop">
+ <intent-filter>
+ <action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
+ </intent-filter>
+
+ <meta-data
+ android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
+ android:resource="@xml/accessory_filter" />
+ </activity>
+
+ <service android:name="com.sdl.hellosdlandroid.SdlService" >
+ </service>
+ <service
+ android:name=".SdlRouterService"
+ android:exported="true"
+ android:process="com.smartdevicelink.router">
+ <intent-filter>
+ <action android:name="com.smartdevicelink.router.service"/>
+ </intent-filter>
+ <meta-data android:name="@string/sdl_router_service_version_name" android:value="@integer/sdl_router_service_version_value" />
+ </service>
+ <receiver
+ android:name=".SdlReceiver"
+ android:enabled="true"
+ android:exported="true"
+ tools:ignore="ExportedReceiver">
+ <intent-filter>
+ <action android:name="com.smartdevicelink.USB_ACCESSORY_ATTACHED"/> <!--For AOA -->
+ <action android:name="android.bluetooth.device.action.ACL_CONNECTED" />
+ <action android:name="sdl.router.startservice" />
+ </intent-filter>
+ </receiver>
+ <activity android:name="com.smartdevicelink.managers.lockscreen.SDLLockScreenActivity"
+ android:launchMode="singleInstance"/>
+ </application>
+
+</manifest> \ No newline at end of file
diff --git a/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/MainActivity.java b/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/MainActivity.java
new file mode 100755
index 000000000..6fc9203db
--- /dev/null
+++ b/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/MainActivity.java
@@ -0,0 +1,43 @@
+package com.sdl.hellosdlandroid;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v7.app.AppCompatActivity;
+import android.view.Menu;
+import android.view.MenuItem;
+
+public class MainActivity extends AppCompatActivity {
+ private static final String TAG = "MainActivity";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ //If we are connected to a module we want to start our SdlService
+ if(BuildConfig.TRANSPORT.equals("MULTI") || BuildConfig.TRANSPORT.equals("MULTI_HB")) {
+ SdlReceiver.queryForConnectedService(this);
+ }else if(BuildConfig.TRANSPORT.equals("TCP")) {
+ Intent proxyIntent = new Intent(this, SdlService.class);
+ startService(proxyIntent);
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.main, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ // Handle action bar item clicks here. The action bar will
+ // automatically handle clicks on the Home/Up button, so long
+ // as you specify a parent activity in AndroidManifest.xml.
+ int id = item.getItemId();
+ if (id == R.id.action_settings) {
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+}
diff --git a/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlReceiver.java b/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlReceiver.java
new file mode 100755
index 000000000..09cf35a82
--- /dev/null
+++ b/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlReceiver.java
@@ -0,0 +1,51 @@
+package com.sdl.hellosdlandroid;
+
+import android.content.Context;
+import android.content.Intent;
+import android.os.Build;
+import android.util.Log;
+
+import com.smartdevicelink.transport.SdlBroadcastReceiver;
+import com.smartdevicelink.transport.SdlRouterService;
+import com.smartdevicelink.transport.TransportConstants;
+
+public class SdlReceiver extends SdlBroadcastReceiver {
+ private static final String TAG = "SdlBroadcastReciever";
+ public static final String RECONNECT_LANG_CHANGE = "RECONNECT_LANG_CHANGE";
+
+ @Override
+ public void onSdlEnabled(Context context, Intent intent) {
+ Log.d(TAG, "SDL Enabled");
+ intent.setClass(context, SdlService.class);
+
+ // SdlService needs to be foregrounded in Android O and above
+ // This will prevent apps in the background from crashing when they try to start SdlService
+ // Because Android O doesn't allow background apps to start background services
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ context.startForegroundService(intent);
+ } else {
+ context.startService(intent);
+ }
+ }
+
+ @Override
+ public Class<? extends SdlRouterService> defineLocalSdlRouterClass() {
+ return com.sdl.hellosdlandroid.SdlRouterService.class;
+ }
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ super.onReceive(context, intent); // Required if overriding this method
+
+ if (intent != null) {
+ String action = intent.getAction();
+ if (action != null){
+ if(action.equalsIgnoreCase(TransportConstants.START_ROUTER_SERVICE_ACTION)) {
+ if (intent.getBooleanExtra(RECONNECT_LANG_CHANGE, false)) {
+ onSdlEnabled(context, intent);
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlRouterService.java b/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlRouterService.java
new file mode 100755
index 000000000..b4bec8cde
--- /dev/null
+++ b/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlRouterService.java
@@ -0,0 +1,8 @@
+package com.sdl.hellosdlandroid;
+
+
+public class SdlRouterService extends com.smartdevicelink.transport.SdlRouterService {
+
+
+
+}
diff --git a/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java b/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java
new file mode 100755
index 000000000..2847a3fd6
--- /dev/null
+++ b/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java
@@ -0,0 +1,274 @@
+package com.sdl.hellosdlandroid;
+
+import android.annotation.SuppressLint;
+import android.app.Notification;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
+import android.app.Service;
+import android.content.Context;
+import android.content.Intent;
+import android.hardware.usb.UsbAccessory;
+import android.hardware.usb.UsbManager;
+import android.os.Build;
+import android.os.IBinder;
+import android.util.Log;
+
+import com.smartdevicelink.exception.SdlException;
+import com.smartdevicelink.managers.CompletionListener;
+import com.smartdevicelink.managers.SdlManager;
+import com.smartdevicelink.managers.SdlManagerListener;
+import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCNotification;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.TTSChunkFactory;
+import com.smartdevicelink.proxy.rpc.AddCommand;
+import com.smartdevicelink.proxy.rpc.MenuParams;
+import com.smartdevicelink.proxy.rpc.OnCommand;
+import com.smartdevicelink.proxy.rpc.OnHMIStatus;
+import com.smartdevicelink.proxy.rpc.Speak;
+import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
+import com.smartdevicelink.proxy.rpc.enums.FileType;
+import com.smartdevicelink.proxy.rpc.enums.HMILevel;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
+import com.smartdevicelink.transport.BTTransportConfig;
+import com.smartdevicelink.transport.BaseTransportConfig;
+import com.smartdevicelink.transport.MultiplexTransportConfig;
+import com.smartdevicelink.transport.TCPTransportConfig;
+import com.smartdevicelink.transport.USBTransportConfig;
+
+import java.util.Collections;
+import java.util.Vector;
+
+public class SdlService extends Service {
+
+ private static final String TAG = "SDL Service";
+
+ private static final String APP_NAME = "Hello Sdl";
+ private static final String APP_ID = "8678309";
+
+ private static final String ICON_FILENAME = "hello_sdl_icon.png";
+ private static final String SDL_IMAGE_FILENAME = "sdl_full_image.png";
+
+ private static final String WELCOME_SHOW = "Welcome to HelloSDL";
+ private static final String WELCOME_SPEAK = "Welcome to Hello S D L";
+
+ private static final String TEST_COMMAND_NAME = "Test Command";
+ private static final int TEST_COMMAND_ID = 1;
+
+ private static final int FOREGROUND_SERVICE_ID = 111;
+
+ // TCP/IP transport config
+ // The default port is 12345
+ // The IP is of the machine that is running SDL Core
+ private static final int TCP_PORT = 12345;
+ private static final String DEV_MACHINE_IP_ADDRESS = "192.168.1.78";
+
+ // variable to create and call functions of the SyncProxy
+ private SdlManager sdlManager = null;
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+
+ @Override
+ public void onCreate() {
+ Log.d(TAG, "onCreate");
+ super.onCreate();
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ enterForeground();
+ }
+ }
+
+ // Helper method to let the service enter foreground mode
+ @SuppressLint("NewApi")
+ public void enterForeground() {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ NotificationChannel channel = new NotificationChannel(APP_ID, "SdlService", NotificationManager.IMPORTANCE_DEFAULT);
+ NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+ if (notificationManager != null) {
+ notificationManager.createNotificationChannel(channel);
+ Notification serviceNotification = new Notification.Builder(this, channel.getId())
+ .setContentTitle("Connected through SDL")
+ .setSmallIcon(R.drawable.ic_sdl)
+ .build();
+ startForeground(FOREGROUND_SERVICE_ID, serviceNotification);
+ }
+ }
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ startProxy();
+ return START_STICKY;
+ }
+
+ @Override
+ public void onDestroy() {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ stopForeground(true);
+ }
+
+ if (sdlManager != null) {
+ sdlManager.dispose();
+ }
+
+ super.onDestroy();
+ }
+
+ private void startProxy() {
+ // This logic is to select the correct transport and security levels defined in the selected build flavor
+ // Build flavors are selected by the "build variants" tab typically located in the bottom left of Android Studio
+ // Typically in your app, you will only set one of these.
+ if (sdlManager == null) {
+ Log.i(TAG, "Starting SDL Proxy");
+ BaseTransportConfig transport = null;
+ if (BuildConfig.TRANSPORT.equals("MULTI")) {
+ int securityLevel;
+ if (BuildConfig.SECURITY.equals("HIGH")) {
+ securityLevel = MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH;
+ } else if (BuildConfig.SECURITY.equals("MED")) {
+ securityLevel = MultiplexTransportConfig.FLAG_MULTI_SECURITY_MED;
+ } else if (BuildConfig.SECURITY.equals("LOW")) {
+ securityLevel = MultiplexTransportConfig.FLAG_MULTI_SECURITY_LOW;
+ } else {
+ securityLevel = MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF;
+ }
+ transport = new MultiplexTransportConfig(this, APP_ID, securityLevel);
+ } else if (BuildConfig.TRANSPORT.equals("TCP")) {
+ transport = new TCPTransportConfig(TCP_PORT, DEV_MACHINE_IP_ADDRESS, true);
+ } else if (BuildConfig.TRANSPORT.equals("MULTI_HB")) {
+ MultiplexTransportConfig mtc = new MultiplexTransportConfig(this, APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
+ mtc.setRequiresHighBandwidth(true);
+ transport = mtc;
+ }
+
+ // The app type to be used
+ Vector<AppHMIType> appType = new Vector<>();
+ appType.add(AppHMIType.MEDIA);
+
+ // The manager listener helps you know when certain events that pertain to the SDL Manager happen
+ // Here we will listen for ON_HMI_STATUS and ON_COMMAND notifications
+ SdlManagerListener listener = new SdlManagerListener() {
+ @Override
+ public void onStart() {
+ // HMI Status Listener
+ sdlManager.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, new OnRPCNotificationListener() {
+ @Override
+ public void onNotified(RPCNotification notification) {
+ OnHMIStatus status = (OnHMIStatus) notification;
+ if (status.getHmiLevel() == HMILevel.HMI_FULL && ((OnHMIStatus) notification).getFirstRun()) {
+ sendCommands();
+ performWelcomeSpeak();
+ performWelcomeShow();
+ }
+ }
+ });
+
+ // Menu Selected Listener
+ sdlManager.addOnRPCNotificationListener(FunctionID.ON_COMMAND, new OnRPCNotificationListener() {
+ @Override
+ public void onNotified(RPCNotification notification) {
+ OnCommand command = (OnCommand) notification;
+ Integer id = command.getCmdID();
+ if(id != null){
+ switch(id){
+ case TEST_COMMAND_ID:
+ showTest();
+ break;
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ public void onDestroy() {
+ SdlService.this.stopSelf();
+ }
+
+ @Override
+ public void onError(String info, Exception e) {
+ }
+ };
+
+ // Create App Icon, this is set in the SdlManager builder
+ SdlArtwork appIcon = new SdlArtwork(ICON_FILENAME, FileType.GRAPHIC_PNG, R.mipmap.ic_launcher, true);
+
+ // The manager builder sets options for your session
+ SdlManager.Builder builder = new SdlManager.Builder(this, APP_ID, APP_NAME, listener);
+ builder.setAppTypes(appType);
+ builder.setTransportType(transport);
+ builder.setAppIcon(appIcon);
+ sdlManager = builder.build();
+ sdlManager.start();
+ }
+ }
+
+ /**
+ * Add commands for the app on SDL.
+ */
+ private void sendCommands(){
+ AddCommand command = new AddCommand();
+ MenuParams params = new MenuParams();
+ params.setMenuName(TEST_COMMAND_NAME);
+ command.setCmdID(TEST_COMMAND_ID);
+ command.setMenuParams(params);
+ command.setVrCommands(Collections.singletonList(TEST_COMMAND_NAME));
+ sendRpcRequest(command);
+ }
+
+ /**
+ * Will speak a sample welcome message
+ */
+ private void performWelcomeSpeak(){
+ sendRpcRequest(new Speak(TTSChunkFactory.createSimpleTTSChunks(WELCOME_SPEAK)));
+ }
+
+ /**
+ * Use the Screen Manager to set the initial screen text and set the image.
+ * Because we are setting multiple items, we will call beginTransaction() first,
+ * and finish with commit() when we are done.
+ */
+ private void performWelcomeShow() {
+ sdlManager.getScreenManager().beginTransaction();
+ sdlManager.getScreenManager().setTextField1(APP_NAME);
+ sdlManager.getScreenManager().setTextField2(WELCOME_SHOW);
+ sdlManager.getScreenManager().setPrimaryGraphic(new SdlArtwork(SDL_IMAGE_FILENAME, FileType.GRAPHIC_PNG, R.drawable.sdl, true));
+ sdlManager.getScreenManager().commit(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ if (success){
+ Log.i(TAG, "welcome show successful");
+ }
+ }
+ });
+ }
+
+ /**
+ * Will show a sample test message on screen as well as speak a sample test message
+ */
+ private void showTest(){
+ sdlManager.getScreenManager().beginTransaction();
+ sdlManager.getScreenManager().setTextField1("Command has been selected");
+ sdlManager.getScreenManager().setTextField2("");
+ sdlManager.getScreenManager().commit(null);
+
+ sendRpcRequest(new Speak(TTSChunkFactory.createSimpleTTSChunks(TEST_COMMAND_NAME)));
+ }
+
+ /**
+ * Sends an RPC Request to the connected head unit. Automatically adds a correlation id.
+ * @param request the rpc request that is to be sent to the module
+ */
+ private void sendRpcRequest(RPCRequest request){
+ try {
+ sdlManager.sendRPC(request);
+ } catch (SdlException e) {
+ e.printStackTrace();
+ }
+ }
+
+} \ No newline at end of file
diff --git a/hello_sdl_android/src/main/res.zip b/hello_sdl_android/src/main/res.zip
new file mode 100755
index 000000000..16370f43a
--- /dev/null
+++ b/hello_sdl_android/src/main/res.zip
Binary files differ
diff --git a/hello_sdl_android/src/main/res/drawable/sdl.png b/hello_sdl_android/src/main/res/drawable/sdl.png
new file mode 100755
index 000000000..5cfc0f84a
--- /dev/null
+++ b/hello_sdl_android/src/main/res/drawable/sdl.png
Binary files differ
diff --git a/hello_sdl_android/src/main/res/layout/activity_main.xml b/hello_sdl_android/src/main/res/layout/activity_main.xml
new file mode 100755
index 000000000..8da613491
--- /dev/null
+++ b/hello_sdl_android/src/main/res/layout/activity_main.xml
@@ -0,0 +1,16 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:paddingBottom="@dimen/activity_vertical_margin"
+ android:paddingLeft="@dimen/activity_horizontal_margin"
+ android:paddingRight="@dimen/activity_horizontal_margin"
+ android:paddingTop="@dimen/activity_vertical_margin"
+ tools:context="com.sdl.hellosdlandroid.MainActivity" >
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/hello_world" />
+
+</RelativeLayout>
diff --git a/hello_sdl_android/src/main/res/menu/main.xml b/hello_sdl_android/src/main/res/menu/main.xml
new file mode 100755
index 000000000..d74718db3
--- /dev/null
+++ b/hello_sdl_android/src/main/res/menu/main.xml
@@ -0,0 +1,12 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ tools:context="com.sdl.hellosdlandroid.MainActivity" >
+
+ <item
+ android:id="@+id/action_settings"
+ android:orderInCategory="100"
+ android:title="@string/action_settings"
+ app:showAsAction="never"/>
+
+</menu>
diff --git a/hello_sdl_android/src/main/res/mipmap-hdpi/ic_launcher.png b/hello_sdl_android/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100755
index 000000000..d10bd53b0
--- /dev/null
+++ b/hello_sdl_android/src/main/res/mipmap-hdpi/ic_launcher.png
Binary files differ
diff --git a/hello_sdl_android/src/main/res/mipmap-mdpi/ic_launcher.png b/hello_sdl_android/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100755
index 000000000..239564b34
--- /dev/null
+++ b/hello_sdl_android/src/main/res/mipmap-mdpi/ic_launcher.png
Binary files differ
diff --git a/hello_sdl_android/src/main/res/mipmap-xhdpi/ic_launcher.png b/hello_sdl_android/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100755
index 000000000..485ca6880
--- /dev/null
+++ b/hello_sdl_android/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary files differ
diff --git a/hello_sdl_android/src/main/res/mipmap-xxhdpi/ic_launcher.png b/hello_sdl_android/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100755
index 000000000..60574c2af
--- /dev/null
+++ b/hello_sdl_android/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/hello_sdl_android/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/hello_sdl_android/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100755
index 000000000..c43021775
--- /dev/null
+++ b/hello_sdl_android/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Binary files differ
diff --git a/hello_sdl_android/src/main/res/values-v11/styles.xml b/hello_sdl_android/src/main/res/values-v11/styles.xml
new file mode 100755
index 000000000..a4a95bc46
--- /dev/null
+++ b/hello_sdl_android/src/main/res/values-v11/styles.xml
@@ -0,0 +1,11 @@
+<resources>
+
+ <!--
+ Base application theme for API 11+. This theme completely replaces
+ AppBaseTheme from res/values/styles.xml on API 11+ devices.
+ -->
+ <style name="AppBaseTheme" parent="Theme.AppCompat.Light">
+ <!-- API 11 theme customizations can go here. -->
+ </style>
+
+</resources>
diff --git a/hello_sdl_android/src/main/res/values-v14/styles.xml b/hello_sdl_android/src/main/res/values-v14/styles.xml
new file mode 100755
index 000000000..664f4f162
--- /dev/null
+++ b/hello_sdl_android/src/main/res/values-v14/styles.xml
@@ -0,0 +1,12 @@
+<resources>
+
+ <!--
+ Base application theme for API 14+. This theme completely replaces
+ AppBaseTheme from BOTH res/values/styles.xml and
+ res/values-v11/styles.xml on API 14+ devices.
+ -->
+ <style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
+ <!-- API 14 theme customizations can go here. -->
+ </style>
+
+</resources>
diff --git a/hello_sdl_android/src/main/res/values-w820dp/dimens.xml b/hello_sdl_android/src/main/res/values-w820dp/dimens.xml
new file mode 100755
index 000000000..f3e70203b
--- /dev/null
+++ b/hello_sdl_android/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,10 @@
+<resources>
+
+ <!--
+ Example customization of dimensions originally defined in res/values/dimens.xml
+ (such as screen margins) for screens with more than 820dp of available width. This
+ would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively).
+ -->
+ <dimen name="activity_horizontal_margin">64dp</dimen>
+
+</resources>
diff --git a/hello_sdl_android/src/main/res/values/dimens.xml b/hello_sdl_android/src/main/res/values/dimens.xml
new file mode 100755
index 000000000..55c1e5908
--- /dev/null
+++ b/hello_sdl_android/src/main/res/values/dimens.xml
@@ -0,0 +1,7 @@
+<resources>
+
+ <!-- Default screen margins, per the Android Design guidelines. -->
+ <dimen name="activity_horizontal_margin">16dp</dimen>
+ <dimen name="activity_vertical_margin">16dp</dimen>
+
+</resources>
diff --git a/hello_sdl_android/src/main/res/values/strings.xml b/hello_sdl_android/src/main/res/values/strings.xml
new file mode 100755
index 000000000..6f96374c6
--- /dev/null
+++ b/hello_sdl_android/src/main/res/values/strings.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <string name="app_name">Hello Sdl Android</string>
+ <string name="hello_world">Hello SDL!</string>
+ <string name="action_settings">Settings</string>
+
+</resources>
diff --git a/hello_sdl_android/src/main/res/values/styles.xml b/hello_sdl_android/src/main/res/values/styles.xml
new file mode 100755
index 000000000..845fb572b
--- /dev/null
+++ b/hello_sdl_android/src/main/res/values/styles.xml
@@ -0,0 +1,20 @@
+<resources>
+
+ <!--
+ Base application theme, dependent on API level. This theme is replaced
+ by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+ -->
+ <style name="AppBaseTheme" parent="Theme.AppCompat.Light">
+ <!--
+ Theme customizations available in newer API levels can go in
+ res/values-vXX/styles.xml, while customizations related to
+ backward-compatibility can go here.
+ -->
+ </style>
+
+ <!-- Application theme. -->
+ <style name="AppTheme" parent="AppBaseTheme">
+ <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+ </style>
+
+</resources>
diff --git a/hello_sdl_android/src/main/res/xml/accessory_filter.xml b/hello_sdl_android/src/main/res/xml/accessory_filter.xml
new file mode 100755
index 000000000..4b0ab7c83
--- /dev/null
+++ b/hello_sdl_android/src/main/res/xml/accessory_filter.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resource>
+ <usb-accessory
+ manufacturer="SDL"
+ model="Core"
+ version="1.0"/>
+</resource> \ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index 5eeb895cf..a358feb22 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1 @@
-include ':sdl_android'
+include ':sdl_android', ':hello_sdl_android' \ No newline at end of file