Skip to content
Merged
6 changes: 6 additions & 0 deletions android/hello_sdl_android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ android {
targetSdkVersion 33
versionCode 1
versionName "1.0"
resValue "string", "app_name", "Hello Sdl Android"
buildConfigField 'String', 'APP_TYPE', '"DEFAULT"'
buildConfigField 'String', 'REQUIRE_AUDIO_OUTPUT', '"FALSE"'
buildConfigField 'String', 'SDL_APP_NAME', '"Hello Sdl"'
buildConfigField 'String', 'SDL_APP_ID', '"8678309"'
manifestPlaceholders = [
appIcon: "@mipmap/ic_launcher"
]
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
Expand Down
2 changes: 1 addition & 1 deletion android/hello_sdl_android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:icon="${appIcon}"
android:label="@string/app_name"
android:theme="@style/AppTheme"
tools:ignore="DeepLinks">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ 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_NAME_ES = "Hola Sdl";
private static final String APP_NAME_FR = "Bonjour 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";
Expand Down Expand Up @@ -104,7 +102,7 @@ public void onCreate() {
@SuppressLint("NewApi")
public void enterForeground() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel(APP_ID, "SdlService", NotificationManager.IMPORTANCE_DEFAULT);
NotificationChannel channel = new NotificationChannel(BuildConfig.SDL_APP_ID, "SdlService", NotificationManager.IMPORTANCE_DEFAULT);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (notificationManager != null) {
notificationManager.createNotificationChannel(channel);
Expand Down Expand Up @@ -161,14 +159,14 @@ private void startProxy() {
} else {
securityLevel = MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF;
}
transport = new MultiplexTransportConfig(this, APP_ID, securityLevel);
transport = new MultiplexTransportConfig(this, BuildConfig.SDL_APP_ID, securityLevel);
if (BuildConfig.REQUIRE_AUDIO_OUTPUT.equals("TRUE") ) {
((MultiplexTransportConfig)transport).setRequiresAudioSupport(true);
}
} 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);
MultiplexTransportConfig mtc = new MultiplexTransportConfig(this, BuildConfig.SDL_APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
mtc.setRequiresHighBandwidth(true);
transport = mtc;
}
Expand Down Expand Up @@ -215,8 +213,8 @@ public void onError(String info, Exception e) {
@Override
public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language, Language hmiLanguage) {
boolean isNeedUpdate = false;
String appName = APP_NAME;
String ttsName = APP_NAME;
String appName = BuildConfig.SDL_APP_NAME;
String ttsName = BuildConfig.SDL_APP_NAME;
switch (language) {
case ES_MX:
isNeedUpdate = true;
Expand Down Expand Up @@ -260,7 +258,7 @@ public boolean onSystemInfoReceived(SystemInfo systemInfo) {
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);
SdlManager.Builder builder = new SdlManager.Builder(this, BuildConfig.SDL_APP_ID, BuildConfig.SDL_APP_NAME, listener);
builder.setAppTypes(appType);
builder.setTransportType(transport);
builder.setAppIcon(appIcon);
Expand Down Expand Up @@ -375,7 +373,7 @@ private void performWelcomeSpeak() {
*/
private void performWelcomeShow() {
sdlManager.getScreenManager().beginTransaction();
sdlManager.getScreenManager().setTextField1(APP_NAME);
sdlManager.getScreenManager().setTextField1(BuildConfig.SDL_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() {
Expand Down
1 change: 0 additions & 1 deletion android/hello_sdl_android/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?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>

Expand Down