Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
E
Easy File Manager Junk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
Easy File Manager Junk
Commits
82336d3c
Commit
82336d3c
authored
Jun 23, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+FCM删掉。
parent
b0079e29
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
131 deletions
+0
-131
FcmHelper.kt
...in/java/com/base/easyfilemanager/display/fcm/FcmHelper.kt
+0
-49
MyFirebaseMessagingReceiver.kt
...asyfilemanager/display/fcm/MyFirebaseMessagingReceiver.kt
+0
-22
MyFirebaseMessagingService.kt
...easyfilemanager/display/fcm/MyFirebaseMessagingService.kt
+0
-60
No files found.
app/src/main/java/com/base/easyfilemanager/display/fcm/FcmHelper.kt
deleted
100644 → 0
View file @
b0079e29
package
com.base.easyfilemanager.display.fcm
import
android.util.Log
import
com.google.android.gms.tasks.OnCompleteListener
import
com.google.android.gms.tasks.Task
import
com.google.firebase.messaging.FirebaseMessaging
object
FcmHelper
{
private
const
val
TAG
=
"FcmHelper"
fun
subscribeToTopic
()
{
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
"news"
)
.
addOnCompleteListener
{
task
:
Task
<
Void
?
>
->
if
(
task
.
isSuccessful
)
{
Log
.
d
(
TAG
,
"Subscribed to topic: TOPIC_NAME"
)
}
else
{
Log
.
e
(
TAG
,
"Failed to subscribe to topic: TOPIC_NAME"
,
task
.
exception
)
}
}
}
fun
getToken
()
{
FirebaseMessaging
.
getInstance
().
token
.
addOnCompleteListener
(
OnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
Log
.
w
(
TAG
,
"Fetching FCM registration token failed"
,
task
.
exception
)
return
@OnCompleteListener
}
// Get new FCM registration token
val
token
=
task
?.
result
?:
""
Log
.
d
(
TAG
,
"token: $token"
)
})
}
fun
unSubscribeToTopic
()
{
FirebaseMessaging
.
getInstance
().
unsubscribeFromTopic
(
"news"
)
.
addOnCompleteListener
{
task
:
Task
<
Void
?
>
->
if
(
task
.
isSuccessful
)
{
}
else
{
}
}
}
}
\ No newline at end of file
app/src/main/java/com/base/easyfilemanager/display/fcm/MyFirebaseMessagingReceiver.kt
deleted
100644 → 0
View file @
b0079e29
package
com.base.easyfilemanager.display.fcm
import
android.content.BroadcastReceiver
import
android.content.Context
import
android.content.Intent
import
android.util.Log
class
MyFirebaseMessagingReceiver
:
BroadcastReceiver
()
{
override
fun
onReceive
(
context
:
Context
,
intent
:
Intent
)
{
val
message
=
intent
.
extras
?.
getString
(
"message"
)
Log
.
d
(
TAG
,
"Received FCM message$message"
)
}
companion
object
{
private
const
val
TAG
=
"MyFirebaseMsgReceiver"
}
}
app/src/main/java/com/base/easyfilemanager/display/fcm/MyFirebaseMessagingService.kt
deleted
100644 → 0
View file @
b0079e29
package
com.base.easyfilemanager.display.fcm
import
android.content.Intent
import
android.os.Build
import
android.util.Log
import
com.google.firebase.messaging.FirebaseMessagingService
import
com.google.firebase.messaging.RemoteMessage
import
com.base.easyfilemanager.display.NotificationService
import
com.base.easyfilemanager.display.NotificationUtils
import
com.base.easyfilemanager.utils.SPUtils
class
MyFirebaseMessagingService
:
FirebaseMessagingService
()
{
override
fun
onMessageReceived
(
remoteMessage
:
RemoteMessage
)
{
Log
.
d
(
TAG
,
"onMessageReceived: "
+
remoteMessage
.
from
)
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
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
()
// FcmHelper.startFCMCheckAlarm(this)
FcmHelper
.
getToken
()
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
S
)
{
return
}
if
(
NotificationService
.
isRunning
){
return
}
startNotification
()
}
private
fun
startNotification
()
{
val
intent
=
Intent
(
this
,
NotificationService
::
class
.
java
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
startForegroundService
(
intent
)
}
else
{
startService
(
intent
)
}
}
override
fun
onNewToken
(
token
:
String
)
{
Log
.
d
(
TAG
,
"Refreshed token: $token"
)
}
companion
object
{
private
const
val
TAG
=
"MyFirebaseMsgService"
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment