Skip to content

Commit 3e71421

Browse files
authored
Merge pull request #1864 from smartdevicelink/bugfix/issue_1863_gradle_build_variants
Bugfix/issue 1863 update gradle build variants for hello_sdl
2 parents 7873fb5 + 27e1d9c commit 3e71421

4 files changed

Lines changed: 14 additions & 11 deletions

File tree

android/hello_sdl_android/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ android {
88
targetSdkVersion 33
99
versionCode 1
1010
versionName "1.0"
11+
resValue "string", "app_name", "Hello Sdl Android"
1112
buildConfigField 'String', 'APP_TYPE', '"DEFAULT"'
1213
buildConfigField 'String', 'REQUIRE_AUDIO_OUTPUT', '"FALSE"'
14+
buildConfigField 'String', 'SDL_APP_NAME', '"Hello Sdl"'
15+
buildConfigField 'String', 'SDL_APP_ID', '"8678309"'
16+
manifestPlaceholders = [
17+
appIcon: "@mipmap/ic_launcher"
18+
]
1319
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
1420
}
1521
buildTypes {

android/hello_sdl_android/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
<application
3030
android:allowBackup="false"
31-
android:icon="@mipmap/ic_launcher"
31+
android:icon="${appIcon}"
3232
android:label="@string/app_name"
3333
android:theme="@style/AppTheme"
3434
tools:ignore="DeepLinks">

android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,8 @@ public class SdlService extends Service {
6060

6161
private static final String TAG = "SDL Service";
6262

63-
private static final String APP_NAME = "Hello Sdl";
6463
private static final String APP_NAME_ES = "Hola Sdl";
6564
private static final String APP_NAME_FR = "Bonjour Sdl";
66-
private static final String APP_ID = "8678309";
6765

6866
private static final String ICON_FILENAME = "hello_sdl_icon.png";
6967
private static final String SDL_IMAGE_FILENAME = "sdl_full_image.png";
@@ -104,7 +102,7 @@ public void onCreate() {
104102
@SuppressLint("NewApi")
105103
public void enterForeground() {
106104
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
107-
NotificationChannel channel = new NotificationChannel(APP_ID, "SdlService", NotificationManager.IMPORTANCE_DEFAULT);
105+
NotificationChannel channel = new NotificationChannel(BuildConfig.SDL_APP_ID, "SdlService", NotificationManager.IMPORTANCE_DEFAULT);
108106
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
109107
if (notificationManager != null) {
110108
notificationManager.createNotificationChannel(channel);
@@ -161,14 +159,14 @@ private void startProxy() {
161159
} else {
162160
securityLevel = MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF;
163161
}
164-
transport = new MultiplexTransportConfig(this, APP_ID, securityLevel);
162+
transport = new MultiplexTransportConfig(this, BuildConfig.SDL_APP_ID, securityLevel);
165163
if (BuildConfig.REQUIRE_AUDIO_OUTPUT.equals("TRUE") ) {
166164
((MultiplexTransportConfig)transport).setRequiresAudioSupport(true);
167165
}
168166
} else if (BuildConfig.TRANSPORT.equals("TCP")) {
169167
transport = new TCPTransportConfig(TCP_PORT, DEV_MACHINE_IP_ADDRESS, true);
170168
} else if (BuildConfig.TRANSPORT.equals("MULTI_HB")) {
171-
MultiplexTransportConfig mtc = new MultiplexTransportConfig(this, APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
169+
MultiplexTransportConfig mtc = new MultiplexTransportConfig(this, BuildConfig.SDL_APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
172170
mtc.setRequiresHighBandwidth(true);
173171
transport = mtc;
174172
}
@@ -215,8 +213,8 @@ public void onError(String info, Exception e) {
215213
@Override
216214
public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language, Language hmiLanguage) {
217215
boolean isNeedUpdate = false;
218-
String appName = APP_NAME;
219-
String ttsName = APP_NAME;
216+
String appName = BuildConfig.SDL_APP_NAME;
217+
String ttsName = BuildConfig.SDL_APP_NAME;
220218
switch (language) {
221219
case ES_MX:
222220
isNeedUpdate = true;
@@ -260,7 +258,7 @@ public boolean onSystemInfoReceived(SystemInfo systemInfo) {
260258
SdlArtwork appIcon = new SdlArtwork(ICON_FILENAME, FileType.GRAPHIC_PNG, R.mipmap.ic_launcher, true);
261259

262260
// The manager builder sets options for your session
263-
SdlManager.Builder builder = new SdlManager.Builder(this, APP_ID, APP_NAME, listener);
261+
SdlManager.Builder builder = new SdlManager.Builder(this, BuildConfig.SDL_APP_ID, BuildConfig.SDL_APP_NAME, listener);
264262
builder.setAppTypes(appType);
265263
builder.setTransportType(transport);
266264
builder.setAppIcon(appIcon);
@@ -375,7 +373,7 @@ private void performWelcomeSpeak() {
375373
*/
376374
private void performWelcomeShow() {
377375
sdlManager.getScreenManager().beginTransaction();
378-
sdlManager.getScreenManager().setTextField1(APP_NAME);
376+
sdlManager.getScreenManager().setTextField1(BuildConfig.SDL_APP_NAME);
379377
sdlManager.getScreenManager().setTextField2(WELCOME_SHOW);
380378
sdlManager.getScreenManager().setPrimaryGraphic(new SdlArtwork(SDL_IMAGE_FILENAME, FileType.GRAPHIC_PNG, R.drawable.sdl, true));
381379
sdlManager.getScreenManager().commit(new CompletionListener() {

android/hello_sdl_android/src/main/res/values/strings.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
33

4-
<string name="app_name">Hello Sdl Android</string>
54
<string name="hello_world">Hello SDL!</string>
65
<string name="action_settings">Settings</string>
76

0 commit comments

Comments
 (0)