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 package be.mygod.vpnhotspot
import android.annotation.TargetApi
import android.app.Application import android.app.Application
import android.app.NotificationChannel import android.app.NotificationChannel
import android.app.NotificationManager import android.app.NotificationManager
@@ -15,9 +16,12 @@ class App : Application() {
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
app = this app = this
if (Build.VERSION.SDK_INT >= 26) getSystemService(NotificationManager::class.java) if (Build.VERSION.SDK_INT >= 26) @TargetApi(26) {
.createNotificationChannel(NotificationChannel(RepeaterService.CHANNEL, val nm = getSystemService(NotificationManager::class.java)
"Hotspot Service", NotificationManager.IMPORTANCE_LOW)) 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) } 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 { class RepeaterService : Service(), WifiP2pManager.ChannelListener, VpnListener.Callback {
companion object { companion object {
const val CHANNEL = "hotspot" const val CHANNEL = "repeater"
const val STATUS_CHANGED = "be.mygod.vpnhotspot.RepeaterService.STATUS_CHANGED" const val STATUS_CHANGED = "be.mygod.vpnhotspot.RepeaterService.STATUS_CHANGED"
private const val TAG = "RepeaterService" private const val TAG = "RepeaterService"