Skip to content

Commit

Permalink
allow 0 importance for radar foreground service (#385)
Browse files Browse the repository at this point in the history
* allow 0 importance for radar foreground service

* bump version

---------

Co-authored-by: Liam Meier <[email protected]>
  • Loading branch information
ShiCheng-Lu and lmeier authored Oct 8, 2024
1 parent bf54cc0 commit 68705f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ apply plugin: "org.jetbrains.dokka"
apply plugin: 'io.radar.mvnpublish'

ext {
radarVersion = '3.18.2'
radarVersion = '3.18.3'
}

String buildNumber = ".${System.currentTimeMillis()}"
Expand Down
11 changes: 5 additions & 6 deletions sdk/src/main/java/io/radar/sdk/RadarForegroundService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,12 @@ class RadarForegroundService : Service() {
manager.deleteNotificationChannel("RadarSDK")
var id = extras?.getInt("id") ?: 0
id = if (id == 0) NOTIFICATION_ID else id
var importance = extras?.getInt("importance") ?: 0
importance = if (importance == 0) NotificationManager.IMPORTANCE_DEFAULT else importance
val importance = extras?.getInt("importance", NotificationManager.IMPORTANCE_DEFAULT) ?: NotificationManager.IMPORTANCE_DEFAULT
val title = extras?.getString("title")
val text = extras?.getString("text") ?: "Location tracking started"
var icon = extras?.getInt("icon") ?: 0
var iconString = extras?.getString("iconString") ?: this.applicationInfo.icon.toString()
var iconColor = extras?.getString("iconColor") ?: ""
val icon = extras?.getInt("icon") ?: 0
val iconString = extras?.getString("iconString") ?: this.applicationInfo.icon.toString()
val iconColor = extras?.getString("iconColor") ?: ""
var smallIcon = resources.getIdentifier(iconString, "drawable", applicationContext.packageName)
if (icon != 0){
smallIcon = resources.getIdentifier(icon.toString(), "drawable", applicationContext.packageName)
Expand All @@ -74,7 +73,7 @@ class RadarForegroundService : Service() {
.setContentText(text as CharSequence?)
.setOngoing(true)
.setSmallIcon(smallIcon)
if (title != null && title.isNotEmpty()) {
if (!title.isNullOrEmpty()) {
builder = builder.setContentTitle(title as CharSequence?)
}
if (iconColor.isNotEmpty()) {
Expand Down

0 comments on commit 68705f7

Please sign in to comment.