Пуш-уведомления RuStore в apk-webview: SDK, сервис приёма, канал
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
package ru.ua1zbe.bus127.push;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
|
/** Хранение push-токена устройства, чтобы отправлять ему уведомления с сервера. */
|
||||||
|
public final class PushStore {
|
||||||
|
|
||||||
|
private static final String PREFS = "bus127_push";
|
||||||
|
private static final String KEY_TOKEN = "push_token";
|
||||||
|
|
||||||
|
private PushStore() {
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SharedPreferences sp(Context context) {
|
||||||
|
return context.getApplicationContext()
|
||||||
|
.getSharedPreferences(PREFS, Context.MODE_PRIVATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getToken(Context context) {
|
||||||
|
return sp(context).getString(KEY_TOKEN, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setToken(Context context, String token) {
|
||||||
|
sp(context).edit().putString(KEY_TOKEN, token).apply();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user