Rename notification channel

This commit is contained in:
Mygod
2018-01-13 13:50:59 +08:00
parent 9866db6c46
commit 9fd3966fda
2 changed files with 8 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
package be.mygod.vpnhotspot
import android.annotation.TargetApi
import android.app.Application
import android.app.NotificationChannel
import android.app.NotificationManager
@@ -15,9 +16,12 @@ class App : Application() {
override fun onCreate() {
super.onCreate()
app = this
if (Build.VERSION.SDK_INT >= 26) getSystemService(NotificationManager::class.java)
.createNotificationChannel(NotificationChannel(RepeaterService.CHANNEL,
"Hotspot Service", NotificationManager.IMPORTANCE_LOW))
if (Build.VERSION.SDK_INT >= 26) @TargetApi(26) {
val nm = getSystemService(NotificationManager::class.java)
nm.createNotificationChannel(NotificationChannel(RepeaterService.CHANNEL,
"Repeater Service", NotificationManager.IMPORTANCE_LOW))
nm.deleteNotificationChannel("hotspot") // remove old service channel
}
}
val pref: SharedPreferences by lazy { PreferenceManager.getDefaultSharedPreferences(this) }

View File

@@ -22,7 +22,7 @@ import java.util.regex.Pattern
class RepeaterService : Service(), WifiP2pManager.ChannelListener, VpnListener.Callback {
companion object {
const val CHANNEL = "hotspot"
const val CHANNEL = "repeater"
const val STATUS_CHANGED = "be.mygod.vpnhotspot.RepeaterService.STATUS_CHANGED"
private const val TAG = "RepeaterService"