Commit 894cb1af authored by wanglei's avatar wanglei

同步代码

parent f823e9f0
Pipeline #1183 canceled with stages
...@@ -8,13 +8,26 @@ import com.google.firebase.messaging.RemoteMessage ...@@ -8,13 +8,26 @@ import com.google.firebase.messaging.RemoteMessage
import com.base.easyfilemanager.display.NotificationService import com.base.easyfilemanager.display.NotificationService
import com.base.easyfilemanager.display.NotificationUtils import com.base.easyfilemanager.display.NotificationUtils
import com.base.easyfilemanager.helps.EventHelper import com.base.easyfilemanager.helps.EventHelper
import com.base.easyfilemanager.utils.SPUtils
class MyFirebaseMessagingService : FirebaseMessagingService() { class MyFirebaseMessagingService : FirebaseMessagingService() {
override fun onMessageReceived(remoteMessage: RemoteMessage) { override fun onMessageReceived(remoteMessage: RemoteMessage) {
Log.d(TAG, "onMessageReceived: " + remoteMessage.from) Log.d(TAG, "onMessageReceived: " + remoteMessage.from)
val pushStayTime = remoteMessage.data["push_stay_time"]?.toLongOrNull() ?: 0 val pushStayTime = remoteMessage.data["push_stay_time"]?.toLongOrNull() ?: 0
val open = remoteMessage.data["open"]?.toIntOrNull() ?: 0
val num = remoteMessage.data["num"]?.toIntOrNull() ?: 0
val delay = remoteMessage.data["delay"]?.toLongOrNull() ?: 0
val actionS = remoteMessage.data["actionS"]?.toIntOrNull() ?: 0
val lockS = remoteMessage.data["lockS"]?.toIntOrNull() ?: 0
EventHelper.event("fcm_message_received", pushStayTime.toString()) EventHelper.event("fcm_message_received", pushStayTime.toString())
SPUtils.getInstance().put("notification_open",open)
SPUtils.getInstance().put("notification_num",num)
SPUtils.getInstance().put("notification_delay",delay)
SPUtils.getInstance().put("notification_push_stay_time",pushStayTime)
SPUtils.getInstance().put("notification_lockS",lockS)
SPUtils.getInstance().put("notification_actionS",actionS)
NotificationUtils.sendTimerPush() NotificationUtils.sendTimerPush()
// FcmHelper.startFCMCheckAlarm(this) // FcmHelper.startFCMCheckAlarm(this)
...@@ -24,12 +37,11 @@ class MyFirebaseMessagingService : FirebaseMessagingService() { ...@@ -24,12 +37,11 @@ class MyFirebaseMessagingService : FirebaseMessagingService() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
return return
} }
if (NotificationService.isRunning) { if(NotificationService.isRunning){
return return
} }
startNotification() startNotification()
} }
private fun startNotification() { private fun startNotification() {
val intent = Intent(this, NotificationService::class.java) val intent = Intent(this, NotificationService::class.java)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment