Created
July 7, 2018 05:08
-
-
Save the-dagger/02d2bdb99905c196897e605676419b3b to your computer and use it in GitHub Desktop.
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
private fun showNotification(channelID: String) { | |
val stopSelf = Intent(this, CopieService::class.java) | |
stopSelf.putExtra(INTENT_EXTRA, true) | |
val startApp = Intent(this, MainActivity::class.java) | |
val stopPendingIntent = PendingIntent.getService(this, 0, stopSelf, FLAG_CANCEL_CURRENT) | |
val openAppPendingIntent = PendingIntent.getActivity(this, 0, startApp, FLAG_CANCEL_CURRENT) | |
startForeground(1995, NotificationCompat.Builder(this, channelID) | |
.setSmallIcon(R.drawable.ic_paste) | |
.setContentTitle("Copie is online") | |
.setContentText("Touch to open") | |
.setPriority(PRIORITY_MIN) | |
.setContentIntent(openAppPendingIntent) | |
.setCategory(NotificationCompat.CATEGORY_SERVICE) | |
.addAction(R.drawable.ic_stop, "Stop", stopPendingIntent) | |
.build()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment