Skip to content

Commit 91ea98f

Browse files
committed
clear notify after 2min
1 parent 2ac2768 commit 91ea98f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

app/src/main/java/ir/aamnapm/copysmsonkeyboard/ForegroundService.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import android.content.Context
77
import android.content.Intent
88
import android.content.IntentFilter
99
import android.os.Build
10+
import android.os.Handler
1011
import android.os.IBinder
1112
import androidx.annotation.RequiresApi
1213

@@ -21,7 +22,7 @@ class ForegroundService : Service() {
2122

2223
context = this
2324

24-
var notifcation = Notifcation(context)
25+
var notifcation = Notification(context)
2526

2627
notifcation.createNotificationChannel()
2728

@@ -61,15 +62,22 @@ class ForegroundService : Service() {
6162

6263

6364
private fun onReceiveMessage(
64-
notification: Notifcation,
65+
notification: Notification,
6566
pendingIntent: PendingIntent
6667
) {
6768
broadcastReceiver = object : BroadcastReceiver() {
6869
override fun onReceive(context: Context, intent: Intent) {
6970
notification.updateNotification(
70-
"رمز " + intent.getStringExtra("DATA"),
71+
getString(R.string.secret) + intent.getStringExtra("DATA"),
7172
pendingIntent
7273
)
74+
var handler = Handler()
75+
handler.postDelayed({
76+
notification.updateNotification(
77+
"",
78+
pendingIntent
79+
)
80+
}, 120000)
7381
}
7482
}
7583
val mIntentFilter = IntentFilter()

0 commit comments

Comments
 (0)