Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
L
location share white
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
location share white
Commits
546a7184
Commit
546a7184
authored
Nov 19, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
ecb1cfcd
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
22 deletions
+62
-22
BatteryStatusReceiver.kt
.../com/base/locationsharewhite/fcm/BatteryStatusReceiver.kt
+16
-6
PackageStatusReceiver.kt
.../com/base/locationsharewhite/fcm/PackageStatusReceiver.kt
+18
-6
ScreenStatusReceiver.kt
...a/com/base/locationsharewhite/fcm/ScreenStatusReceiver.kt
+20
-6
MyApplication.kt
.../java/com/base/locationsharewhite/helper/MyApplication.kt
+8
-4
No files found.
app/src/main/java/com/base/locationsharewhite/fcm/BatteryStatusReceiver.kt
View file @
546a7184
...
...
@@ -12,6 +12,7 @@ import com.base.locationsharewhite.fcm.PopupConstObject.popup_battery_interval
import
com.base.locationsharewhite.helper.EventUtils
import
com.base.locationsharewhite.utils.AppPreferences
import
com.base.locationsharewhite.utils.KotlinExt.currentDate
import
com.base.locationsharewhite.utils.LogEx
import
kotlin.math.absoluteValue
/**
...
...
@@ -22,8 +23,9 @@ class BatteryStatusReceiver() : BroadcastReceiver() {
companion
object
{
private
val
TAG
=
"BatteryStatusReceiver"
fun
registerBatteryReceiver
(
context
:
Context
)
{
fun
registerBattery
Status
Receiver
(
context
:
Context
)
{
val
intentFilter
=
IntentFilter
().
apply
{
addAction
(
Intent
.
ACTION_BATTERY_CHANGED
)
}
...
...
@@ -78,12 +80,20 @@ class BatteryStatusReceiver() : BroadcastReceiver() {
val
passTime
=
System
.
currentTimeMillis
()
-
batteryLastPushTime
val
flag2
=
batteryLastPushTime
==
0L
||
passTime
>
interval
val
flag
=
flag1
&&
flag2
if
(!
flag
)
{
EventUtils
.
event
(
"Notification_Error"
,
"todayBatteryPush=$todayBatteryPush
popupBatteryCount=$popupBatteryCount where=$POPUP_WHERE_BATTERY"
"Notification_Error"
,
"todayBatteryPush=$todayBatteryPush "
+
"
popupBatteryCount=$popupBatteryCount where=$POPUP_WHERE_BATTERY"
)
return
flag1
&&
flag2
LogEx
.
logDebug
(
TAG
,
"Notification_Error todayBatteryPush=$todayBatteryPush "
+
"popupBatteryCount=$popupBatteryCount where=$POPUP_WHERE_BATTERY"
)
}
return
flag
}
...
...
app/src/main/java/com/base/locationsharewhite/fcm/PackageStatusReceiver.kt
View file @
546a7184
...
...
@@ -11,12 +11,16 @@ import com.base.locationsharewhite.fcm.PopupConstObject.popup_package_interval
import
com.base.locationsharewhite.helper.EventUtils
import
com.base.locationsharewhite.utils.AppPreferences
import
com.base.locationsharewhite.utils.KotlinExt.currentDate
import
com.base.locationsharewhite.utils.LogEx
import
kotlin.math.E
class
PackageStatusReceiver
()
:
BroadcastReceiver
()
{
companion
object
{
fun
registerBatteryReceiver
(
context
:
Context
)
{
private
val
TAG
=
"PackageStatusReceiver"
fun
registerPackageStatusReceiver
(
context
:
Context
)
{
val
intentFilter
=
IntentFilter
().
apply
{
addAction
(
Intent
.
ACTION_PACKAGE_ADDED
)
addAction
(
Intent
.
ACTION_PACKAGE_REMOVED
)
...
...
@@ -71,11 +75,19 @@ class PackageStatusReceiver() : BroadcastReceiver() {
val
passTime
=
System
.
currentTimeMillis
()
-
packageLastPushTime
val
flag2
=
packageLastPushTime
==
0L
||
passTime
>
interval
val
flag
=
flag1
&&
flag2
if
(!
flag
)
{
EventUtils
.
event
(
"Notification_Error"
,
"todayPackagePush=$todayPackagePush
popupPackageCount=$popupPackageCount where=$POPUP_WHERE_PACKAGE"
"Notification_Error"
,
"todayPackagePush=$todayPackagePush "
+
"
popupPackageCount=$popupPackageCount where=$POPUP_WHERE_PACKAGE"
)
return
flag1
&&
flag2
LogEx
.
logDebug
(
TAG
,
"Notification_Error todayPackagePush=$todayPackagePush "
+
"popupPackageCount=$popupPackageCount where=$POPUP_WHERE_PACKAGE"
)
}
return
flag
}
/**
...
...
app/src/main/java/com/base/locationsharewhite/fcm/ScreenStatusReceiver.kt
View file @
546a7184
...
...
@@ -13,10 +13,12 @@ import com.base.locationsharewhite.fcm.PopupConstObject.popup_screen_interval
import
com.base.locationsharewhite.helper.EventUtils
import
com.base.locationsharewhite.utils.AppPreferences
import
com.base.locationsharewhite.utils.KotlinExt.currentDate
import
com.base.locationsharewhite.utils.LogEx
import
java.util.Objects
class
ScreenStatusReceiver
:
BroadcastReceiver
()
{
override
fun
onReceive
(
context
:
Context
,
intent
:
Intent
)
{
val
action
=
intent
.
action
when
(
Objects
.
requireNonNull
<
String
?>(
action
))
{
...
...
@@ -40,10 +42,13 @@ class ScreenStatusReceiver : BroadcastReceiver() {
companion
object
{
private
val
TAG
=
"ScreenStatusReceiver"
var
isDeviceInteractive
:
Boolean
=
true
var
isSecureLockActive
:
Boolean
=
false
fun
setupScreenStatusListen
er
(
context
:
Context
)
{
fun
registerScreenStatusReceiv
er
(
context
:
Context
)
{
val
intentFilter
=
IntentFilter
()
intentFilter
.
addAction
(
Intent
.
ACTION_SCREEN_OFF
)
intentFilter
.
addAction
(
Intent
.
ACTION_SCREEN_ON
)
...
...
@@ -96,11 +101,20 @@ class ScreenStatusReceiver : BroadcastReceiver() {
val
passTime
=
System
.
currentTimeMillis
()
-
screenLastPushTime
val
flag2
=
screenLastPushTime
==
0L
||
passTime
>
interval
val
flag
=
flag1
&&
flag2
if
(!
flag
)
{
EventUtils
.
event
(
"Notification_Error"
,
"todayScreenPush=$todayScreenPush popupScreenCount=$popupScreenCount where=$POPUP_WHERE_LOCK"
"Notification_Error"
,
"todayScreenPush=$todayScreenPush "
+
"popupScreenCount=$popupScreenCount where=$POPUP_WHERE_LOCK"
)
LogEx
.
logDebug
(
TAG
,
"Notification_Error todayScreenPush=$todayScreenPush "
+
"popupScreenCount=$popupScreenCount where=$POPUP_WHERE_LOCK"
)
return
flag1
&&
flag2
}
return
flag
}
/**
...
...
app/src/main/java/com/base/locationsharewhite/helper/MyApplication.kt
View file @
546a7184
...
...
@@ -7,12 +7,12 @@ import android.os.Bundle
import
android.text.TextUtils
import
com.base.locationsharewhite.ads.AdsConfigBean
import
com.base.locationsharewhite.ads.AdsMgr
import
com.base.locationsharewhite.bean.ConstObject.topic_number
import
com.base.locationsharewhite.fcm.BatteryStatusReceiver
import
com.base.locationsharewhite.fcm.PackageStatusReceiver
import
com.base.locationsharewhite.fcm.ScreenStatusReceiver
import
com.base.locationsharewhite.helper.config.AppConfig
import
com.base.locationsharewhite.ui.splash.SplashActivity
import
com.base.locationsharewhite.utils.AppPreferences
import
com.base.locationsharewhite.utils.KotlinExt.toFormatMinute
import
com.base.locationsharewhite.utils.LogEx
import
java.util.Locale
import
java.util.UUID
...
...
@@ -58,7 +58,7 @@ class MyApplication : Application() {
LogEx
.
logDebug
(
TAG
,
"uuid=${AppPreferences.getInstance().getString("
uuid
", "")}"
)
}
fun
initApp
()
{
private
fun
initApp
()
{
// FacebookSdk.sdkInitialize(applicationContext)
val
topic
=
AppConfig
.
packageName
+
"_push"
LogEx
.
logDebug
(
TAG
,
"topic=${topic}"
)
...
...
@@ -67,7 +67,11 @@ class MyApplication : Application() {
InstallHelps
.
init
()
initAdSdk
()
initLifeListener
()
ScreenStatusReceiver
.
setupScreenStatusListener
(
this
)
ScreenStatusReceiver
.
registerScreenStatusReceiver
(
this
)
PackageStatusReceiver
.
registerPackageStatusReceiver
(
this
)
BatteryStatusReceiver
.
registerBatteryStatusReceiver
(
this
)
}
...
...
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