Skip to content

Commit

Permalink
Lower the reverse geocode error notification priority
Browse files Browse the repository at this point in the history
  • Loading branch information
growse committed Mar 19, 2021
1 parent 1b3085b commit 26338be
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Version 2.3.1

### Bug fixes

* Lower notification priority of geocoder error notifications to make them a bit less present / shouty

## Version 2.3.0

### New features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.content.Intent
import android.content.SharedPreferences
import android.widget.TextView
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationCompat.PRIORITY_LOW
import androidx.core.app.NotificationManagerCompat
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
Expand Down Expand Up @@ -96,6 +97,8 @@ class GeocoderProvider @Inject constructor(@AppContext val context: Context, val
.setSmallIcon(R.drawable.ic_owntracks_80)
.setStyle(NotificationCompat.BigTextStyle().bigText(errorNotificationText))
.setContentIntent(PendingIntent.getActivity(context, 0, activityLaunchIntent, PendingIntent.FLAG_UPDATE_CURRENT))
.setPriority(PRIORITY_LOW)
.setNotificationSilent()
.build()

notificationManager.notify(GEOCODE_ERROR_NOTIFICATION_TAG, 0, notification)
Expand Down Expand Up @@ -151,7 +154,7 @@ class GeocoderProvider @Inject constructor(@AppContext val context: Context, val
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
val channelName = if (context.getString(R.string.notificationChannelErrors).trim().isNotEmpty()) context.getString(R.string.notificationChannelErrors) else "Errors"
notificationManager.createNotificationChannel(
NotificationChannel(ERROR_NOTIFICATION_CHANNEL_ID, channelName, NotificationManager.IMPORTANCE_DEFAULT)
NotificationChannel(ERROR_NOTIFICATION_CHANNEL_ID, channelName, NotificationManager.IMPORTANCE_LOW)
)
}
}
Expand Down

0 comments on commit 26338be

Please sign in to comment.