Skip to content

Commit 97a989f

Browse files
committed
Merge branch 'develop' into bugfix/issue_1859_foreground_service_type
# Conflicts: # android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java
2 parents a452ff2 + 3e71421 commit 97a989f

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
@@ -30,7 +30,7 @@
3030

3131
<application
3232
android:allowBackup="false"
33-
android:icon="@mipmap/ic_launcher"
33+
android:icon="${appIcon}"
3434
android:label="@string/app_name"
3535
android:theme="@style/AppTheme"
3636
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";
@@ -105,7 +103,7 @@ public void onCreate() {
105103
public void enterForeground() {
106104
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
107105
try {
108-
NotificationChannel channel = new NotificationChannel(APP_ID, "SdlService", NotificationManager.IMPORTANCE_DEFAULT);
106+
NotificationChannel channel = new NotificationChannel(BuildConfig.SDL_APP_ID, "SdlService", NotificationManager.IMPORTANCE_DEFAULT);
109107
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
110108
if (notificationManager != null) {
111109
notificationManager.createNotificationChannel(channel);
@@ -168,14 +166,14 @@ private void startProxy() {
168166
} else {
169167
securityLevel = MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF;
170168
}
171-
transport = new MultiplexTransportConfig(this, APP_ID, securityLevel);
169+
transport = new MultiplexTransportConfig(this, BuildConfig.SDL_APP_ID, securityLevel);
172170
if (BuildConfig.REQUIRE_AUDIO_OUTPUT.equals("TRUE") ) {
173171
((MultiplexTransportConfig)transport).setRequiresAudioSupport(true);
174172
}
175173
} else if (BuildConfig.TRANSPORT.equals("TCP")) {
176174
transport = new TCPTransportConfig(TCP_PORT, DEV_MACHINE_IP_ADDRESS, true);
177175
} else if (BuildConfig.TRANSPORT.equals("MULTI_HB")) {
178-
MultiplexTransportConfig mtc = new MultiplexTransportConfig(this, APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
176+
MultiplexTransportConfig mtc = new MultiplexTransportConfig(this, BuildConfig.SDL_APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
179177
mtc.setRequiresHighBandwidth(true);
180178
transport = mtc;
181179
}
@@ -222,8 +220,8 @@ public void onError(String info, Exception e) {
222220
@Override
223221
public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language, Language hmiLanguage) {
224222
boolean isNeedUpdate = false;
225-
String appName = APP_NAME;
226-
String ttsName = APP_NAME;
223+
String appName = BuildConfig.SDL_APP_NAME;
224+
String ttsName = BuildConfig.SDL_APP_NAME;
227225
switch (language) {
228226
case ES_MX:
229227
isNeedUpdate = true;
@@ -267,7 +265,7 @@ public boolean onSystemInfoReceived(SystemInfo systemInfo) {
267265
SdlArtwork appIcon = new SdlArtwork(ICON_FILENAME, FileType.GRAPHIC_PNG, R.mipmap.ic_launcher, true);
268266

269267
// The manager builder sets options for your session
270-
SdlManager.Builder builder = new SdlManager.Builder(this, APP_ID, APP_NAME, listener);
268+
SdlManager.Builder builder = new SdlManager.Builder(this, BuildConfig.SDL_APP_ID, BuildConfig.SDL_APP_NAME, listener);
271269
builder.setAppTypes(appType);
272270
builder.setTransportType(transport);
273271
builder.setAppIcon(appIcon);
@@ -382,7 +380,7 @@ private void performWelcomeSpeak() {
382380
*/
383381
private void performWelcomeShow() {
384382
sdlManager.getScreenManager().beginTransaction();
385-
sdlManager.getScreenManager().setTextField1(APP_NAME);
383+
sdlManager.getScreenManager().setTextField1(BuildConfig.SDL_APP_NAME);
386384
sdlManager.getScreenManager().setTextField2(WELCOME_SHOW);
387385
sdlManager.getScreenManager().setPrimaryGraphic(new SdlArtwork(SDL_IMAGE_FILENAME, FileType.GRAPHIC_PNG, R.drawable.sdl, true));
388386
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)