Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
BYLAppRobot
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
liuyang
BYLAppRobot
Commits
efefe99f
Commit
efefe99f
authored
Oct 19, 2018
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
APK图片抓取识别及轮播流地址抓取,客户端添加自启动
#BYLSERVER-1438
parent
cec45a35
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
4 deletions
+70
-4
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+6
-0
ApkReportData.kt
app/src/main/java/com/duolebo/blyrobot/data/ApkReportData.kt
+13
-3
BootBroadcastReceiver.kt
...ava/com/duolebo/blyrobot/service/BootBroadcastReceiver.kt
+15
-0
BylRobotService.kt
...main/java/com/duolebo/blyrobot/service/BylRobotService.kt
+36
-1
No files found.
app/src/main/AndroidManifest.xml
View file @
efefe99f
...
...
@@ -31,6 +31,12 @@
<service
android:name=
".service.BylRobotService"
/>
<service
android:name=
".service.BylWebService"
/>
<receiver
android:name=
".service.BootBroadcastReceiver"
>
<intent-filter>
<action
android:name=
"android.intent.action.BOOT_COMPLETED"
/>
</intent-filter>
</receiver>
</application>
</manifest>
\ No newline at end of file
app/src/main/java/com/duolebo/blyrobot/data/ApkReportData.kt
View file @
efefe99f
package
com.duolebo.blyrobot.data
import
com.duolebo.appbase.IModel
import
com.duolebo.appbase.prj.XMLHelper
import
com.duolebo.appbase.prj.bmtv.model.ModelBase
import
org.json.JSONArray
import
org.json.JSONObject
class
ApkReportData
:
IModel
{
override
fun
from
(
p0
:
JSONObject
?):
Boolean
{
class
ApkReportData
:
ModelBase
()
{
var
result
=
-
1
override
fun
from
(
json
:
JSONObject
):
Boolean
{
val
data
=
json
.
optJSONArray
(
"data"
)
if
(
data
!=
null
)
{
}
result
=
0
return
true
}
...
...
@@ -18,4 +24,8 @@ class ApkReportData: IModel {
return
false
}
override
fun
getCode
():
Int
{
return
result
}
}
\ No newline at end of file
app/src/main/java/com/duolebo/blyrobot/service/BootBroadcastReceiver.kt
0 → 100644
View file @
efefe99f
package
com.duolebo.blyrobot.service
import
android.content.BroadcastReceiver
import
android.content.Context
import
android.content.Intent
class
BootBroadcastReceiver
:
BroadcastReceiver
()
{
override
fun
onReceive
(
context
:
Context
,
intent
:
Intent
)
{
if
(
intent
.
action
==
"android.intent.action.BOOT_COMPLETED"
)
{
context
.
startService
(
Intent
(
context
,
BylRobotService
::
class
.
java
))
}
}
}
app/src/main/java/com/duolebo/blyrobot/service/BylRobotService.kt
View file @
efefe99f
...
...
@@ -9,8 +9,13 @@ import android.content.IntentFilter
import
android.os.IBinder
import
android.support.v4.content.LocalBroadcastManager
import
android.util.Log
import
com.duolebo.appbase.AppBaseHandler
import
com.duolebo.appbase.IAppBaseCallback
import
com.duolebo.appbase.IProtocol
import
com.duolebo.blyrobot.data.ApkInfo
import
com.duolebo.blyrobot.data.AppInfoData
import
com.duolebo.blyrobot.data.Task
import
com.duolebo.blyrobot.protocol.GetAppInfoProtocol
import
com.duolebo.blyrobot.tools.TaskManager
import
com.duolebo.blyrobot.util.AdbUtil
import
com.duolebo.blyrobot.util.AppUtil
...
...
@@ -20,11 +25,14 @@ import org.json.JSONObject
import
java.util.*
@SuppressLint
(
"Registered"
)
class
BylRobotService
:
Service
()
{
class
BylRobotService
:
Service
()
,
IAppBaseCallback
{
private
val
TAG
=
"BylRobotService"
private
var
count
=
0
private
lateinit
var
dataHandler
:
AppBaseHandler
private
lateinit
var
apkInfoProtocol
:
GetAppInfoProtocol
private
val
broadcastReceiver
=
object
:
BroadcastReceiver
()
{
override
fun
onReceive
(
p0
:
Context
?,
intent
:
Intent
?)
{
if
(
intent
!=
null
)
{
...
...
@@ -48,6 +56,13 @@ class BylRobotService: Service() {
LocalBroadcastManager
.
getInstance
(
this
).
registerReceiver
(
broadcastReceiver
,
intentFilter
)
}
private
fun
requestAppList
()
{
apkInfoProtocol
=
GetAppInfoProtocol
(
this
,
Config
.
instance
)
this
.
dataHandler
=
AppBaseHandler
(
this
)
apkInfoProtocol
.
execute
(
this
.
dataHandler
)
}
private
fun
loadTask
()
{
Log
.
i
(
TAG
,
"loadTask..."
)
...
...
@@ -77,4 +92,24 @@ class BylRobotService: Service() {
super
.
onDestroy
()
LocalBroadcastManager
.
getInstance
(
this
).
unregisterReceiver
(
broadcastReceiver
)
}
override
fun
onProtocolFailed
(
protocol
:
IProtocol
?)
{
}
override
fun
onHttpFailed
(
protocol
:
IProtocol
?)
{
}
override
fun
onProtocolSucceed
(
protocol
:
IProtocol
?)
{
if
(
protocol
is
GetAppInfoProtocol
)
{
val
appInfoData
=
protocol
.
data
as
AppInfoData
for
(
apkInfo
in
appInfoData
.
apkInfos
)
{
if
(
AppUtil
.
isAppInstalled
(
this
,
apkInfo
.
packageName
))
{
val
task
=
Task
(
this
.
applicationContext
)
task
.
from
(
apkInfo
)
TaskManager
.
instance
.
add
(
task
)
}
}
}
}
}
\ No newline at end of file
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