Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
b92178ac
Commit
b92178ac
authored
Aug 24, 2022
by
刘鹏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release' into d/v4.4.08
# Conflicts: # build.gradle
parents
a00b71db
ec32ab46
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
0 deletions
+50
-0
AndroidManifest.xml
m-audioim/src/main/AndroidManifest.xml
+2
-0
AudioService.kt
m-audioim/src/main/java/com/ydl/audioim/AudioService.kt
+48
-0
No files found.
m-audioim/src/main/AndroidManifest.xml
View file @
b92178ac
...
@@ -17,5 +17,7 @@
...
@@ -17,5 +17,7 @@
android:launchMode=
"singleTask"
android:launchMode=
"singleTask"
android:configChanges=
"screenSize|smallestScreenSize|screenLayout|orientation"
android:configChanges=
"screenSize|smallestScreenSize|screenLayout|orientation"
android:screenOrientation=
"portrait"
/>
android:screenOrientation=
"portrait"
/>
<service
android:name=
".AudioService"
/>
</application>
</application>
</manifest>
</manifest>
m-audioim/src/main/java/com/ydl/audioim/AudioService.kt
0 → 100644
View file @
b92178ac
package
com.ydl.audioim
import
android.app.*
import
android.content.Context
import
android.content.Intent
import
android.os.Build
class
AudioService
:
Service
()
{
override
fun
onCreate
()
{
val
createNotification
=
createNotification
(
this
)
startForeground
(
12001
,
createNotification
)
}
override
fun
onBind
(
intent
:
Intent
?)
=
null
private
fun
createNotification
(
context
:
Context
):
Notification
=
when
{
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
->
{
// 创建消息渠道
val
channel
=
NotificationChannel
(
"EasyFloat"
,
"系统悬浮窗"
,
NotificationManager
.
IMPORTANCE_MIN
)
val
manager
=
context
.
getSystemService
(
Context
.
NOTIFICATION_SERVICE
)
as
NotificationManager
manager
.
createNotificationChannel
(
channel
)
Notification
.
Builder
(
context
,
"EasyFloat"
)
.
setCategory
(
Notification
.
CATEGORY_SERVICE
)
}
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
->
Notification
.
Builder
(
context
)
.
setCategory
(
Notification
.
CATEGORY_SERVICE
)
.
setPriority
(
Notification
.
PRIORITY_MIN
)
else
->
Notification
.
Builder
(
context
)
}
// .setSmallIcon(R.drawable.audioim_audio_home_img_answer)
// .setContentText("正在通话中")
// .setContentIntent(PendingIntent.getActivity(context, 0, Intent(context, MainActivity::class.java), 0))
.
setAutoCancel
(
true
)
.
setOngoing
(
true
)
.
build
()
}
\ 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