Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
F
File Recovery RecycleBin
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
File Recovery RecycleBin
Commits
2ca447af
Commit
2ca447af
authored
Sep 09, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
7cd6ad09
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
24 deletions
+26
-24
InstallHelps.kt
...java/com/base/filerecoveryrecyclebin/help/InstallHelps.kt
+2
-3
FileObserverExample.java
...e/filerecoveryrecyclebin/service/FileObserverExample.java
+11
-7
StayNotificationService.kt
...filerecoveryrecyclebin/service/StayNotificationService.kt
+13
-14
No files found.
app/src/main/java/com/base/filerecoveryrecyclebin/help/InstallHelps.kt
View file @
2ca447af
...
@@ -19,7 +19,7 @@ object InstallHelps {
...
@@ -19,7 +19,7 @@ object InstallHelps {
private
val
TAG
=
"InstallHelps"
private
val
TAG
=
"InstallHelps"
fun
init
()
{
fun
init
()
=
Thread
{
//InstallReferrer not empty
//InstallReferrer not empty
// if (!TextUtils.isEmpty(AppPreferences.getInstance().getString("install_source", ""))) {
// if (!TextUtils.isEmpty(AppPreferences.getInstance().getString("install_source", ""))) {
// if (AdmobMaxHelper.haveSpAdmobTrueMaxFalse()) {
// if (AdmobMaxHelper.haveSpAdmobTrueMaxFalse()) {
...
@@ -34,7 +34,6 @@ object InstallHelps {
...
@@ -34,7 +34,6 @@ object InstallHelps {
val
referrerClient
=
InstallReferrerClient
.
newBuilder
(
BaseApplication
.
context
).
build
()
val
referrerClient
=
InstallReferrerClient
.
newBuilder
(
BaseApplication
.
context
).
build
()
referrerClient
.
startConnection
(
object
:
InstallReferrerStateListener
{
referrerClient
.
startConnection
(
object
:
InstallReferrerStateListener
{
@RequiresApi
(
Build
.
VERSION_CODES
.
O
)
override
fun
onInstallReferrerSetupFinished
(
responseCode
:
Int
)
{
override
fun
onInstallReferrerSetupFinished
(
responseCode
:
Int
)
{
try
{
try
{
when
(
responseCode
)
{
when
(
responseCode
)
{
...
@@ -76,7 +75,7 @@ object InstallHelps {
...
@@ -76,7 +75,7 @@ object InstallHelps {
override
fun
onInstallReferrerServiceDisconnected
()
{
override
fun
onInstallReferrerServiceDisconnected
()
{
}
}
})
})
}
}
.
start
()
fun
requestCfg
(
callBackAd
:
Boolean
)
{
fun
requestCfg
(
callBackAd
:
Boolean
)
{
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/service/FileObserverExample.java
View file @
2ca447af
...
@@ -100,14 +100,18 @@ public class FileObserverExample {
...
@@ -100,14 +100,18 @@ public class FileObserverExample {
}
}
private
void
handleFileCreation
(
String
namePath
)
{
private
void
handleFileCreation
(
String
namePath
)
{
// 确保线程安全,这里我们只是打印出来,实际使用中可能需要同步机制
try
{
for
(
File
dir
:
watchList
)
{
// 确保线程安全,这里我们只是打印出来,实际使用中可能需要同步机制
File
src
=
new
File
(
dir
,
namePath
);
for
(
File
dir
:
watchList
)
{
if
(
src
.
exists
())
{
File
src
=
new
File
(
dir
,
namePath
);
Log
.
d
(
TAG
,
"新创建的文件 "
+
namePath
+
" 属于目录: "
+
dir
.
getAbsolutePath
());
if
(
src
.
exists
())
{
BackUpUtils
.
INSTANCE
.
backupFile
(
src
,
namePath
);
Log
.
d
(
TAG
,
"新创建的文件 "
+
namePath
+
" 属于目录: "
+
dir
.
getAbsolutePath
());
break
;
BackUpUtils
.
INSTANCE
.
backupFile
(
src
,
namePath
);
break
;
}
}
}
}
catch
(
Exception
e
){
}
}
}
}
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/service/StayNotificationService.kt
View file @
2ca447af
...
@@ -54,10 +54,12 @@ class StayNotificationService : Service() {
...
@@ -54,10 +54,12 @@ class StayNotificationService : Service() {
//Android 14 no
//Android 14 no
return
return
}
}
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
runCatching
{
startForegroundService
(
intent
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
}
else
{
startForegroundService
(
intent
)
startService
(
intent
)
}
else
{
startService
(
intent
)
}
}
}
}
}
}
}
...
@@ -68,11 +70,6 @@ class StayNotificationService : Service() {
...
@@ -68,11 +70,6 @@ class StayNotificationService : Service() {
EventUtils
.
event
(
"onStartCommand"
,
"Foreground System auto launch intent=null isRunning=$isRunning"
)
EventUtils
.
event
(
"onStartCommand"
,
"Foreground System auto launch intent=null isRunning=$isRunning"
)
return
START_NOT_STICKY
return
START_NOT_STICKY
}
}
if
(
Build
.
VERSION
.
SDK_INT
>
Build
.
VERSION_CODES
.
TIRAMISU
)
{
//Android 14 no
return
START_NOT_STICKY
}
if
(
fileObserver
==
null
)
{
if
(
fileObserver
==
null
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
fileObserver
=
FileObserverExample
()
fileObserver
=
FileObserverExample
()
...
@@ -80,11 +77,13 @@ class StayNotificationService : Service() {
...
@@ -80,11 +77,13 @@ class StayNotificationService : Service() {
}
}
}
}
if
(!
isRunning
)
{
if
(!
isRunning
)
{
val
notification
=
createPermanentNotification
(
applicationContext
)
runCatching
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
val
notification
=
createPermanentNotification
(
applicationContext
)
startForeground
(
1
,
notification
,
ServiceInfo
.
FOREGROUND_SERVICE_TYPE_DATA_SYNC
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
}
else
{
startForeground
(
1
,
notification
,
ServiceInfo
.
FOREGROUND_SERVICE_TYPE_DATA_SYNC
)
startForeground
(
1
,
notification
)
}
else
{
startForeground
(
1
,
notification
)
}
}
}
isRunning
=
true
isRunning
=
true
}
}
...
...
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