This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun setSmallIcon(smallIconRes: Int): NotificationBuilder { | |
mNotificationBuilder.setSmallIcon(smallIconRes) | |
return this | |
} | |
fun setTitle(titleRes: Int): NotificationBuilder { | |
mNotificationBuilder.setContentTitle(CONTEXT.getString(titleRes)) | |
return this | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Builder { | |
... | |
... | |
CharSequence mContentTitle; | |
CharSequence mContentText; | |
PendingIntent mContentIntent; | |
PendingIntent mFullScreenIntent; | |
RemoteViews mTickerView; | |
Bitmap mLargeIcon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
... | |
btn_display_basic_notification.setOnClickListener { | |
NotificationBuilder.from(this) | |
.createNotificationBuilder("HelloWorld") | |
.setTitle(R.string.app_name) | |
.setContent(R.string.app_name) | |
.setSmallIcon(R.drawable.ic_baseline_add_circle_24) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.pushnotificaiton.utils.push | |
/** | |
* Created by KING JINHO on 2020-06-23 | |
*/ | |
class NotificationBuilder { | |
companion object { | |
private lateinit var CHANNEL_ID: String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".MainActivity"> | |
<androidx.appcompat.widget.AppCompatButton | |
android:id="@+id/btn_display_basic_notification" |
NewerOlder