Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fallenstardust
YGOMobile
Commits
cfaab8cd
Commit
cfaab8cd
authored
Dec 08, 2018
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试 CHANNEL_ID
parent
db20b658
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/ServiceDuelAssistant.java
...ava/cn/garymb/ygomobile/ui/plus/ServiceDuelAssistant.java
+11
-8
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/ServiceDuelAssistant.java
View file @
cfaab8cd
...
...
@@ -2,21 +2,18 @@ package cn.garymb.ygomobile.ui.plus;
import
android.annotation.SuppressLint
;
import
android.app.Notification
;
import
android.app.NotificationChannel
;
import
android.app.NotificationManager
;
import
android.app.PendingIntent
;
import
android.app.Service
;
import
android.content.ClipData
;
import
android.content.ClipboardManager
;
import
android.content.ComponentName
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.graphics.PixelFormat
;
import
android.os.Build
;
import
android.os.Handler
;
import
android.os.IBinder
;
import
android.provider.Settings
;
import
android.support.v4.app.NotificationCompat
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.Gravity
;
...
...
@@ -40,7 +37,6 @@ import cn.garymb.ygomobile.bean.ServerList;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.adapters.ServerListAdapter
;
import
cn.garymb.ygomobile.ui.cards.CardSearchAcitivity
;
import
cn.garymb.ygomobile.ui.home.HomeActivity
;
import
cn.garymb.ygomobile.ui.home.MainActivity
;
import
cn.garymb.ygomobile.ui.home.ServerListManager
;
import
cn.garymb.ygomobile.utils.IOUtils
;
...
...
@@ -53,6 +49,8 @@ import static cn.garymb.ygomobile.Constants.ASSET_SERVER_LIST;
public
class
ServiceDuelAssistant
extends
Service
{
private
final
static
String
TAG
=
ServiceDuelAssistant
.
class
.
getSimpleName
();
private
static
final
String
CHANNEL_ID
=
"YGOMobile"
;
private
static
final
String
CHANNEL_NAME
=
"Duel_Assistant"
;
private
final
static
String
DUEL_ASSISTANT_SERVICE_ACTION
=
"YGOMOBILE:ACTION_DUEL_ASSISTANT_SERVICE"
;
private
final
static
String
CMD_NAME
=
"CMD"
;
private
final
static
String
CMD_START_GAME
=
"CMD : START GAME"
;
...
...
@@ -180,8 +178,13 @@ public class ServiceDuelAssistant extends Service {
pendingIntent
=
PendingIntent
.
getService
(
this
,
2
,
intent
,
PendingIntent
.
FLAG_UPDATE_CURRENT
);
remoteViews
.
setOnClickPendingIntent
(
R
.
id
.
buttonStopService
,
pendingIntent
);
NotificationChannel
channel
=
new
NotificationChannel
(
CHANNEL_ID
,
CHANNEL_NAME
,
NotificationManager
.
IMPORTANCE_HIGH
);
Notification
.
Builder
builder
=
new
Notification
.
Builder
(
this
,
"决斗助手状态"
);
NotificationManager
manager
=
(
NotificationManager
)
getSystemService
(
Context
.
NOTIFICATION_SERVICE
);
manager
.
createNotificationChannel
(
channel
);
Notification
.
Builder
builder
=
new
Notification
.
Builder
(
this
,
CHANNEL_ID
);
builder
.
setSmallIcon
(
R
.
drawable
.
ic_icon
);
builder
.
setCustomContentView
(
remoteViews
);
startForeground
(
1
,
builder
.
build
());
...
...
@@ -223,7 +226,7 @@ public class ServiceDuelAssistant extends Service {
if
(
start
!=
-
1
)
{
//如果有悬浮窗权限再显示
if
(
PermissionUtil
.
isServicePermission
(
ServiceDuelAssistant
.
this
,
false
))
if
(
PermissionUtil
.
isServicePermission
(
ServiceDuelAssistant
.
this
,
false
))
joinRoom
(
clipMessage
,
start
);
}
else
{
for
(
String
s
:
cardSearchKey
)
{
...
...
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