Skip to content
Snippets Groups Projects
Commit b436adeb authored by Sebastian's avatar Sebastian
Browse files

Move strings for notification and channel to strings.xml

parent 103c93e7
No related branches found
No related tags found
1 merge request!1Basic project setup
......@@ -18,11 +18,9 @@ class MailboxService : Service() {
companion object {
private const val CHANNEL_ID = "Briar Mailbox Service"
private const val CHANNEL_NAME = "Briar Mailbox Channel"
private const val ARG_MESSAGE = "message"
private const val NOTIFICATION_MAIN_ID = 1
private const val NOTIFICATION_MAIN_TITLE = "Briar Mailbox running"
fun startService(context: Context, message: String) {
val startIntent = Intent(context, MailboxService::class.java)
......@@ -45,7 +43,7 @@ class MailboxService : Service() {
)
val notification = NotificationCompat.Builder(this, CHANNEL_ID)
.setContentTitle(NOTIFICATION_MAIN_TITLE)
.setContentTitle(getString(R.string.notification_mailbox_running))
.setContentText(input)
.setSmallIcon(R.drawable.ic_launcher_foreground)
.setContentIntent(pendingIntent)
......@@ -62,7 +60,7 @@ class MailboxService : Service() {
private fun createNotificationChannel() {
if (VERSION.SDK_INT >= VERSION_CODES.O) {
val serviceChannel = NotificationChannel(
CHANNEL_ID, CHANNEL_NAME,
CHANNEL_ID, getString(R.string.notification_channel_name),
NotificationManager.IMPORTANCE_DEFAULT
)
......
<resources>
<string name="app_name">Briar Mailbox</string>
<string name="notification_channel_name">Briar Mailbox Channel</string>
<string name="notification_mailbox_running">Briar Mailbox running</string>
</resources>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment