Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
Out
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xjl
Out
Commits
c66c9801
Commit
c66c9801
authored
Dec 01, 2023
by
xujialang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新-2
parent
3191b0d5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
57 deletions
+53
-57
OutHelp.java
app/src/main/java/com/zl/sdk/OutHelp.java
+53
-57
No files found.
app/src/main/java/com/zl/sdk/OutHelp.java
View file @
c66c9801
...
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
...
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
import
android.content.BroadcastReceiver
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
androidx.annotation.Keep
;
import
androidx.annotation.Keep
;
...
@@ -38,7 +39,6 @@ public final class OutHelp implements KPListener {
...
@@ -38,7 +39,6 @@ public final class OutHelp implements KPListener {
private
boolean
isDebug
=
false
;
private
boolean
isDebug
=
false
;
private
Intent
intent
=
null
;
private
Intent
intent
=
null
;
private
KPListener
kpListener
=
null
;
//是否第一次轮询
//是否第一次轮询
private
boolean
firstLx
=
true
;
private
boolean
firstLx
=
true
;
...
@@ -51,8 +51,10 @@ public final class OutHelp implements KPListener {
...
@@ -51,8 +51,10 @@ public final class OutHelp implements KPListener {
*
*
* @param context 上下文
* @param context 上下文
* @param isDebug 开启调试
* @param isDebug 开启调试
* @param isDebug appId
* @param isDebug appKey
*/
*/
public
void
init
(
Context
context
,
boolean
isDebug
)
{
public
void
init
(
Context
context
,
boolean
isDebug
,
String
appId
,
String
appKey
)
{
this
.
mContext
=
context
;
this
.
mContext
=
context
;
this
.
isDebug
=
isDebug
;
this
.
isDebug
=
isDebug
;
...
@@ -64,60 +66,34 @@ public final class OutHelp implements KPListener {
...
@@ -64,60 +66,34 @@ public final class OutHelp implements KPListener {
// IcOptManager.getInstance().init(context);
// IcOptManager.getInstance().init(context);
IconHelp
.
get
().
init
(
context
);
IconHelp
.
get
().
init
(
context
);
//初始化触发条件
initTriggerConditions
();
initTriggerConditions
();
}
}
private
void
initTriggerConditions
()
{
private
void
initTriggerConditions
()
{
initTimer
();
initTimer
();
initReciver
();
initRec
e
iver
();
}
}
private
void
initReciver
()
{
}
private
void
initTimer
()
{
private
void
initTimer
()
{
Timer
timer
=
new
Timer
();
Timer
timer
=
new
Timer
();
timer
.
schedule
(
new
TimerTask
()
{
timer
.
schedule
(
new
TimerTask
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
showOutAd
(
firstLx
);
showOutAd
(
firstLx
,
null
);
}
}
},
60
*
1000
);
},
60
*
1000
);
}
}
private
void
initReceiver
()
{
@Override
TriggerReceiver
triggerReceiver
=
new
TriggerReceiver
();
public
boolean
isInit
()
{
IntentFilter
intentfilter
=
new
IntentFilter
();
if
(
kpListener
!=
null
)
{
intentfilter
.
addAction
(
Intent
.
ACTION_USER_PRESENT
);
return
kpListener
.
isInit
();
intentfilter
.
addAction
(
Intent
.
ACTION_SCREEN_ON
);
}
intentfilter
.
addAction
(
Intent
.
ACTION_CLOSE_SYSTEM_DIALOGS
);
return
false
;
mContext
.
registerReceiver
(
triggerReceiver
,
intentfilter
);
}
@Override
public
boolean
iconShow
()
{
if
(
kpListener
!=
null
)
{
return
kpListener
.
iconShow
();
}
return
true
;
}
@Override
public
boolean
isAppForeground
()
{
if
(
kpListener
!=
null
)
{
return
kpListener
.
isAppForeground
();
}
return
AppUtils
.
isAppForeground
();
}
}
@Override
public
void
startOutDialog
(
Intent
intent
,
DialogShowStatusCallback
callback
)
{
if
(
kpListener
!=
null
)
{
kpListener
.
startOutDialog
(
intent
,
callback
);
}
}
/**
/**
* 进入外展广告播放逻辑(解锁)
* 进入外展广告播放逻辑(解锁)
...
@@ -126,13 +102,9 @@ public final class OutHelp implements KPListener {
...
@@ -126,13 +102,9 @@ public final class OutHelp implements KPListener {
* @param callback 结果回调
* @param callback 结果回调
*/
*/
public
void
showOutAd
(
ActionFrom
actionFrom
,
DialogShowStatusCallback
callback
)
{
public
void
showOutAd
(
ActionFrom
actionFrom
,
DialogShowStatusCallback
callback
)
{
try
{
intent
=
new
Intent
(
mContext
,
);
intent
=
new
Intent
(
mContext
,
Class
.
forName
(
targetClass
));
dialogShowStatusCallback
=
callback
;
dialogShowStatusCallback
=
callback
;
OutAdManager
.
get
().
startShowOutAd
(
actionFrom
);
OutAdManager
.
get
().
startShowOutAd
(
actionFrom
);
}
catch
(
ClassNotFoundException
e
)
{
LogUtil
.
e
(
"showOutAd"
,
"目标页面未找到"
);
}
}
}
...
@@ -143,13 +115,9 @@ public final class OutHelp implements KPListener {
...
@@ -143,13 +115,9 @@ public final class OutHelp implements KPListener {
* @param callback 结果回调
* @param callback 结果回调
*/
*/
private
void
showOutAd
(
boolean
isFirst
,
DialogShowStatusCallback
callback
)
{
private
void
showOutAd
(
boolean
isFirst
,
DialogShowStatusCallback
callback
)
{
try
{
intent
=
new
Intent
(
mContext
,
);
intent
=
new
Intent
(
mContext
,
Class
.
forName
(
targetClass
));
dialogShowStatusCallback
=
callback
;
dialogShowStatusCallback
=
callback
;
OutAdManager
.
get
().
checkShowOutAd
(
isFirst
);
OutAdManager
.
get
().
checkShowOutAd
(
isFirst
);
}
catch
(
ClassNotFoundException
e
)
{
LogUtil
.
e
(
"showOutAd"
,
"目标页面未找到"
);
}
}
}
...
@@ -186,6 +154,38 @@ public final class OutHelp implements KPListener {
...
@@ -186,6 +154,38 @@ public final class OutHelp implements KPListener {
}
}
/**
* 反射获取保活是否初始化
*/
@Override
public
boolean
isInit
()
{
return
false
;
}
/**
* 反射获取icon状态
*/
@Override
public
boolean
iconShow
()
{
return
false
;
}
@Override
public
boolean
isAppForeground
()
{
return
AppUtils
.
isAppForeground
(
mContext
.
getPackageName
());
}
/**
* 反射调用保活拉起弹窗
* @param intent
* @param callback
*/
@Override
public
void
startOutDialog
(
Intent
intent
,
DialogShowStatusCallback
callback
)
{
}
public
static
class
TriggerReceiver
extends
BroadcastReceiver
{
public
static
class
TriggerReceiver
extends
BroadcastReceiver
{
@Override
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
...
@@ -193,21 +193,17 @@ public final class OutHelp implements KPListener {
...
@@ -193,21 +193,17 @@ public final class OutHelp implements KPListener {
return
;
return
;
}
}
String
action
=
intent
.
getAction
();
String
action
=
intent
.
getAction
();
LogUtil
.
d
(
TAG
,
"onReceive action ="
+
action
);
switch
(
action
)
{
switch
(
action
)
{
case
Intent
.
ACTION_USER_PRESENT
:
{
case
Intent
.
ACTION_USER_PRESENT
:
{
LogUtil
.
d
(
TAG
,
"onReceive ACTION_USER_PRESENT"
);
LogUtil
.
d
(
"OutShow ===>>> 解锁"
);
LogUtil
.
d
(
"OutShow ===>>> 解锁"
);
Out
AdManager
.
get
().
showOutAd
(
""
,
ActionFrom
.
ACTION_USER_PRESENT
,
null
);
Out
Help
.
get
().
showOutAd
(
ActionFrom
.
ACTION_USER_PRESENT
,
null
);
break
;
break
;
}
}
case
Intent
.
ACTION_SCREEN_ON
:
{
case
Intent
.
ACTION_SCREEN_ON
:
{
LogUtil
.
d
(
TAG
,
"onReceive ACTION_SCREEN_ON"
);
LogUtil
.
d
(
"OutShow ===>>> 亮屏"
);
LogUtil
.
d
(
"OutShow ===>>> 亮屏"
);
break
;
break
;
}
}
case
Intent
.
ACTION_CLOSE_SYSTEM_DIALOGS
:
{
case
Intent
.
ACTION_CLOSE_SYSTEM_DIALOGS
:
{
LogUtil
.
d
(
TAG
,
"onReceive ACTION_CLOSE_SYSTEM_DIALOGS ="
+
intent
.
getStringExtra
(
"reason"
));
LogUtil
.
d
(
"OutShow ===>>> 桌面"
);
LogUtil
.
d
(
"OutShow ===>>> 桌面"
);
break
;
break
;
}
}
...
...
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