Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
GuoXiCheng committed Sep 25, 2024
1 parent d7a0c6d commit 360533b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class MyAccessibilityService : AccessibilityService() {
appPackageName = rootNodePackageName
}

if (!whiteListRepository.isAppInWhiteList(rootNodePackageName) && scanTimes < 30) {
if (!whiteListRepository.isAppInWhiteList(rootNodePackageName) && scanTimes < 50) {
val that = this
serviceScope.launch {
val targetRect =
Expand Down
13 changes: 11 additions & 2 deletions app/src/main/java/com/android/skip/service/MyForegroundService.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.android.skip.service

import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
Expand All @@ -12,6 +13,8 @@ import com.android.skip.R
import com.android.skip.ui.main.MainActivity

class MyForegroundService : Service() {
private lateinit var notification: Notification

override fun onBind(p0: Intent?): IBinder? {
TODO("Not yet implemented")
}
Expand All @@ -28,8 +31,8 @@ class MyForegroundService : Service() {
manager.createNotificationChannel(channel)

val intent = Intent(this, MainActivity::class.java)
val pendingIntent = PendingIntent.getActivity(this, 0 , intent, PendingIntent.FLAG_IMMUTABLE)
val notification = NotificationCompat.Builder(this, "SKIP_FOREGROUND_SERVICE")
val pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE)
notification = NotificationCompat.Builder(this, "SKIP_FOREGROUND_SERVICE")
.setContentTitle(getString(R.string.app_name))
.setContentText(getString(R.string.notification_accessibility_service_running))
.setSmallIcon(R.drawable.favicon32)
Expand All @@ -40,4 +43,10 @@ class MyForegroundService : Service() {

startForeground(2, notification)
}

override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
super.onStartCommand(intent, flags, startId)
startForeground(2, notification)
return START_STICKY
}
}

0 comments on commit 360533b

Please sign in to comment.