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
d6e86db5
Commit
d6e86db5
authored
Nov 19, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
b80165de
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
70 additions
and
63 deletions
+70
-63
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+0
-11
NotificationUiUtil.kt
...ava/com/base/locationsharewhite/fcm/NotificationUiUtil.kt
+6
-2
ScreenStatusReceiver.kt
...a/com/base/locationsharewhite/fcm/ScreenStatusReceiver.kt
+0
-1
TimerManager.kt
...main/java/com/base/locationsharewhite/fcm/TimerManager.kt
+58
-49
InstallHelper.kt
.../java/com/base/locationsharewhite/helper/InstallHelper.kt
+2
-0
MyApplication.kt
.../java/com/base/locationsharewhite/helper/MyApplication.kt
+4
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
d6e86db5
...
@@ -167,17 +167,6 @@
...
@@ -167,17 +167,6 @@
<data
android:scheme=
"file"
/>
<data
android:scheme=
"file"
/>
</intent-filter>
</intent-filter>
</receiver>
</receiver>
<receiver
android:name=
".fcm.FcmReceiver"
android:exported=
"true"
android:permission=
"com.google.android.c2dm.permission.SEND"
>
<intent-filter>
<action
android:name=
"com.google.firebase.MESSAGING_EVENT"
/>
<action
android:name=
"com.google.android.c2dm.intent.RECEIVE"
/>
<category
android:name=
"confine.scream"
/>
</intent-filter>
</receiver>
<meta-data
<meta-data
android:name=
"com.google.android.gms.ads.APPLICATION_ID"
android:name=
"com.google.android.gms.ads.APPLICATION_ID"
...
...
app/src/main/java/com/base/locationsharewhite/fcm/NotificationUiUtil.kt
View file @
d6e86db5
...
@@ -13,6 +13,9 @@ import androidx.core.app.NotificationCompat
...
@@ -13,6 +13,9 @@ import androidx.core.app.NotificationCompat
import
androidx.core.graphics.drawable.IconCompat
import
androidx.core.graphics.drawable.IconCompat
import
com.base.locationsharewhite.BuildConfig
import
com.base.locationsharewhite.BuildConfig
import
com.base.locationsharewhite.R
import
com.base.locationsharewhite.R
import
com.base.locationsharewhite.fcm.PopupConstObject.ACTION_COPY_CODE
import
com.base.locationsharewhite.fcm.PopupConstObject.ACTION_ENABLE_LOCATION
import
com.base.locationsharewhite.fcm.PopupConstObject.ACTION_SHARE_LOCATION
import
com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_BATTERY
import
com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_BATTERY
import
com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_FCM
import
com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_FCM
import
com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_LOCK
import
com.base.locationsharewhite.fcm.PopupConstObject.POPUP_WHERE_LOCK
...
@@ -22,7 +25,6 @@ import com.base.locationsharewhite.fcm.PopupConstObject.popup_count
...
@@ -22,7 +25,6 @@ import com.base.locationsharewhite.fcm.PopupConstObject.popup_count
import
com.base.locationsharewhite.fcm.PopupConstObject.popup_end
import
com.base.locationsharewhite.fcm.PopupConstObject.popup_end
import
com.base.locationsharewhite.fcm.PopupConstObject.popup_fcm_interval
import
com.base.locationsharewhite.fcm.PopupConstObject.popup_fcm_interval
import
com.base.locationsharewhite.fcm.PopupConstObject.popup_interval
import
com.base.locationsharewhite.fcm.PopupConstObject.popup_interval
import
com.base.locationsharewhite.fcm.PopupConstObject.popup_lock_interval
import
com.base.locationsharewhite.fcm.PopupConstObject.popup_start
import
com.base.locationsharewhite.fcm.PopupConstObject.popup_start
import
com.base.locationsharewhite.fcm.PopupConstObject.popup_status
import
com.base.locationsharewhite.fcm.PopupConstObject.popup_status
import
com.base.locationsharewhite.fcm.PopupConstObject.popup_timer_interval
import
com.base.locationsharewhite.fcm.PopupConstObject.popup_timer_interval
...
@@ -252,7 +254,9 @@ object NotificationUiUtil {
...
@@ -252,7 +254,9 @@ object NotificationUiUtil {
}
}
val
looper_actionId
=
listOf
(
val
looper_actionId
=
listOf
(
""
,
ACTION_SHARE_LOCATION
,
ACTION_ENABLE_LOCATION
,
ACTION_COPY_CODE
,
)
)
var
actionIdList
=
arrayListOf
<
String
>()
var
actionIdList
=
arrayListOf
<
String
>()
...
...
app/src/main/java/com/base/locationsharewhite/fcm/ScreenStatusReceiver.kt
View file @
d6e86db5
...
@@ -44,7 +44,6 @@ class ScreenStatusReceiver : BroadcastReceiver() {
...
@@ -44,7 +44,6 @@ class ScreenStatusReceiver : BroadcastReceiver() {
companion
object
{
companion
object
{
private
val
TAG
=
"ScreenStatusReceiver"
private
val
TAG
=
"ScreenStatusReceiver"
var
isDeviceInteractive
:
Boolean
=
true
var
isDeviceInteractive
:
Boolean
=
true
var
isSecureLockActive
:
Boolean
=
false
var
isSecureLockActive
:
Boolean
=
false
...
...
app/src/main/java/com/base/locationsharewhite/fcm/TimerManager.kt
View file @
d6e86db5
package
com.base.locationsharewhite.fcm
;
package
com.base.locationsharewhite.fcm
import
android.util.Log;
import
com.base.locationsharewhite.fcm.NotificationUiUtil.sendNotificationIfCan
import
com.base.locationsharewhite.fcm.PopupConstObject.timerDelay
import
com.base.locationsharewhite.fcm.PopupConstObject.timerInterval
import
com.base.locationsharewhite.fcm.PopupConstObject.timerS
import
com.base.locationsharewhite.helper.MyApplication
import
com.base.locationsharewhite.utils.AppPreferences
import
com.base.locationsharewhite.utils.LogEx.logDebug
import
java.util.Timer
import
java.util.TimerTask
import
com.base.locationsharewhite.helper.MyApplication;
import
com.base.locationsharewhite.utils.LogEx;
import
java.util.Timer;
class
TimerManager
private
constructor
()
{
import
java.util.TimerTask;
public
class
TimerManager
{
private
var
taskTimer
:
Timer
?
=
null
private
static
TimerManager
instance
;
private
var
isTaskTimerActive
:
Boolean
=
false
private
Timer
taskTimer
;
private
boolean
isTimerActive
;
private
TimerManager
()
{
fun
scheduleTask
(
delay
:
Long
,
period
:
Long
)
{
// 私有构造方法
logDebug
(
"TimerManager"
,
"scheduleTask"
,
false
)
}
synchronized
(
TimerManager
::
class
.
java
)
{
ensureTimerIsStopped
()
// 确保定时器未运行
public
static
synchronized
TimerManager
getInstance
()
{
taskTimer
=
Timer
()
// 创建新的 Timer 实例
if
(
instance
==
null
)
{
val
task
:
TimerTask
=
object
:
TimerTask
()
{
instance
=
new
TimerManager
();
override
fun
run
()
{
}
return
instance
;
}
public
void
scheduleTask
(
long
delay
,
long
period
)
{
LogEx
.
INSTANCE
.
logDebug
(
"TimerManager"
,
"scheduleTask"
,
false
);
synchronized
(
TimerManager
.
class
)
{
ensureTimerIsStopped
();
// 确保定时器未运行
taskTimer
=
new
Timer
();
// 创建新的 Timer 实例
TimerTask
task
=
new
TimerTask
()
{
@Override
public
void
run
()
{
Log
.
d
(
"glc"
,
"Scheduled task is running"
);
// 确保设备处于交互状态,未锁定,且应用未暂停
// 确保设备处于交互状态,未锁定,且应用未暂停
if
(
ScreenStatusReceiver
.
isDeviceInteractive
()
&&
if
(
ScreenStatusReceiver
.
isDeviceInteractive
!
ScreenStatusReceiver
.
isSecureLockActive
()
&&
&&
!
ScreenStatusReceiver
.
isSecureLockActive
MyApplication
.
PAUSED_VALUE
!=
1
)
{
&&
MyApplication
.
PAUSED_VALUE
!=
1
Log
.
d
(
"glc"
,
"Scheduled task conditions are met"
);
)
{
NotificationUiUtil
.
INSTANCE
.
sendNotificationIfCan
(
MyApplication
.
appContext
,
sendNotificationIfCan
(
MyApplication
.
appContext
,
PopupConstObject
.
POPUP_WHERE_TIMBER
,
null
)
PopupConstObject
.
POPUP_WHERE_TIMBER
,
null
);
}
}
}
}
}
;
}
taskTimer
.
schedule
(
task
,
delay
,
period
);
// 调度任务
taskTimer
?.
schedule
(
task
,
delay
,
period
)
// 调度任务
isT
imerActive
=
true
;
// 设置定时器状态为活跃
isT
askTimerActive
=
true
// 设置定时器状态为活跃
}
}
}
}
private
void
ensureTimerIsStopped
()
{
private
fun
ensureTimerIsStopped
()
{
if
(
isTimerActive
)
{
if
(
isT
askT
imerActive
)
{
if
(
taskTimer
!=
null
)
{
if
(
taskTimer
!=
null
)
{
taskTimer
.
cancel
();
taskTimer
?.
cancel
()
taskTimer
.
purge
();
// 清除所有取消的任务
taskTimer
?.
purge
()
// 清除所有取消的任务
}
}
isT
imerActive
=
false
;
// 重置定时器状态
isT
askTimerActive
=
false
// 重置定时器状态
}
}
}
}
public
void
stopTaskTimer
()
{
fun
stopTaskTimer
()
{
synchronized
(
TimerManager
.
class
)
{
synchronized
(
TimerManager
::
class
.
java
)
{
ensureTimerIsStopped
()
;
// 停止定时器
ensureTimerIsStopped
()
// 停止定时器
}
}
}
}
public
boolean
isTaskTimerActive
()
{
companion
object
{
return
isTimerActive
;
val
instance
:
TimerManager
by
lazy
((
LazyThreadSafetyMode
.
SYNCHRONIZED
))
{
TimerManager
()
}
fun
changeTimer
()
{
val
timerStatus
:
Int
=
AppPreferences
.
getInstance
().
getString
(
timerS
,
"1"
).
toIntOrNull
()
?:
1
if
(
timerStatus
==
0
)
{
instance
.
stopTaskTimer
()
}
else
{
val
timerDelay
:
Int
=
AppPreferences
.
getInstance
().
getString
(
timerDelay
,
"1"
).
toIntOrNull
()
?:
1
val
timerInterval
:
Int
=
AppPreferences
.
getInstance
().
getString
(
timerInterval
,
"1"
).
toIntOrNull
()
?:
1
val
isTaskTimerActive
=
instance
.
isTaskTimerActive
if
(!
isTaskTimerActive
)
{
instance
.
scheduleTask
(
(
timerDelay
*
60
*
1000
).
toLong
(),
(
timerInterval
*
60
*
1000
).
toLong
()
)
}
}
}
}
}
}
}
\ No newline at end of file
app/src/main/java/com/base/locationsharewhite/helper/InstallHelper.kt
View file @
d6e86db5
...
@@ -3,6 +3,7 @@ package com.base.locationsharewhite.helper
...
@@ -3,6 +3,7 @@ package com.base.locationsharewhite.helper
import
com.android.installreferrer.api.InstallReferrerClient
import
com.android.installreferrer.api.InstallReferrerClient
import
com.android.installreferrer.api.InstallReferrerStateListener
import
com.android.installreferrer.api.InstallReferrerStateListener
import
com.base.locationsharewhite.BuildConfig
import
com.base.locationsharewhite.BuildConfig
import
com.base.locationsharewhite.fcm.TimerManager
import
com.base.locationsharewhite.utils.AppPreferences
import
com.base.locationsharewhite.utils.AppPreferences
import
com.base.locationsharewhite.utils.LogEx
import
com.base.locationsharewhite.utils.LogEx
import
org.json.JSONObject
import
org.json.JSONObject
...
@@ -71,6 +72,7 @@ object InstallHelps {
...
@@ -71,6 +72,7 @@ object InstallHelps {
private
fun
requestCfg
()
{
private
fun
requestCfg
()
{
NewComUtils
.
requestCfg
{
NewComUtils
.
requestCfg
{
TimerManager
.
changeTimer
()
}
}
}
}
}
}
\ No newline at end of file
app/src/main/java/com/base/locationsharewhite/helper/MyApplication.kt
View file @
d6e86db5
...
@@ -10,7 +10,9 @@ import com.base.locationsharewhite.ads.AdsMgr
...
@@ -10,7 +10,9 @@ import com.base.locationsharewhite.ads.AdsMgr
import
com.base.locationsharewhite.fcm.BatteryStatusReceiver
import
com.base.locationsharewhite.fcm.BatteryStatusReceiver
import
com.base.locationsharewhite.fcm.PackageStatusReceiver
import
com.base.locationsharewhite.fcm.PackageStatusReceiver
import
com.base.locationsharewhite.fcm.ScreenStatusReceiver
import
com.base.locationsharewhite.fcm.ScreenStatusReceiver
import
com.base.locationsharewhite.fcm.alarm.AlarmUtils.startAlarm
import
com.base.locationsharewhite.helper.config.AppConfig
import
com.base.locationsharewhite.helper.config.AppConfig
import
com.base.locationsharewhite.service.StayJobService.Companion.startJob
import
com.base.locationsharewhite.ui.splash.SplashActivity
import
com.base.locationsharewhite.ui.splash.SplashActivity
import
com.base.locationsharewhite.utils.AppPreferences
import
com.base.locationsharewhite.utils.AppPreferences
import
com.base.locationsharewhite.utils.LogEx
import
com.base.locationsharewhite.utils.LogEx
...
@@ -72,6 +74,8 @@ class MyApplication : Application() {
...
@@ -72,6 +74,8 @@ class MyApplication : Application() {
PackageStatusReceiver
.
registerPackageStatusReceiver
(
this
)
PackageStatusReceiver
.
registerPackageStatusReceiver
(
this
)
BatteryStatusReceiver
.
registerBatteryStatusReceiver
(
this
)
BatteryStatusReceiver
.
registerBatteryStatusReceiver
(
this
)
startJob
()
startAlarm
(
appContext
)
}
}
...
...
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