Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
44170e9a
H
Hello UTS
项目概览
DCloud
/
Hello UTS
通知
1605
Star
27
Fork
9
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
2
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
Hello UTS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
2
Issue
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
44170e9a
编写于
3月 21, 2024
作者:
杜庆泉
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加android 辅助服务示例
上级
7a5b31c6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
56 addition
and
1 deletion
+56
-1
uni_modules/uts-nativepage/utssdk/app-android/AndroidManifest.xml
...les/uts-nativepage/utssdk/app-android/AndroidManifest.xml
+13
-0
uni_modules/uts-nativepage/utssdk/app-android/CustomAccessibilityService.uts
...ivepage/utssdk/app-android/CustomAccessibilityService.uts
+31
-0
uni_modules/uts-nativepage/utssdk/app-android/index.uts
uni_modules/uts-nativepage/utssdk/app-android/index.uts
+1
-1
uni_modules/uts-nativepage/utssdk/app-android/res/values/strings.xml
.../uts-nativepage/utssdk/app-android/res/values/strings.xml
+1
-0
uni_modules/uts-nativepage/utssdk/app-android/res/xml/custom_accessibility_service_config.xml
...p-android/res/xml/custom_accessibility_service_config.xml
+10
-0
未找到文件。
uni_modules/uts-nativepage/utssdk/app-android/AndroidManifest.xml
浏览文件 @
44170e9a
...
@@ -5,6 +5,19 @@
...
@@ -5,6 +5,19 @@
<uses-permission
android:name=
"android.permission.FOREGROUND_SERVICE"
/>
<uses-permission
android:name=
"android.permission.FOREGROUND_SERVICE"
/>
<application>
<application>
<service
android:name=
"uts.sdk.modules.utsNativepage.CustomAccessibilityService"
android:enabled=
"true"
android:exported=
"true"
android:permission=
"android.permission.BIND_ACCESSIBILITY_SERVICE"
>
<intent-filter>
<action
android:name=
"android.accessibilityservice.AccessibilityService"
/>
</intent-filter>
<meta-data
android:name=
"android.accessibilityservice"
android:resource=
"@xml/custom_accessibility_service_config"
/>
</service>
<service
android:name=
"uts.sdk.modules.utsNativepage.ForeService"
/>
<service
android:name=
"uts.sdk.modules.utsNativepage.ForeService"
/>
<activity
android:name=
"uts.sdk.modules.utsNativepage.DemoActivity"
></activity>
<activity
android:name=
"uts.sdk.modules.utsNativepage.DemoActivity"
></activity>
<!--桌面widget组件注册-->
<!--桌面widget组件注册-->
...
...
uni_modules/uts-nativepage/utssdk/app-android/CustomAccessibilityService.uts
0 → 100644
浏览文件 @
44170e9a
import AccessibilityService from 'android.accessibilityservice.AccessibilityService'
import AccessibilityEvent from 'android.view.accessibility.AccessibilityEvent'
export class CustomAccessibilityService extends AccessibilityService {
constructor (){
super();
}
override onInterrupt():void {
console.log("onInterrupt");
}
override onAccessibilityEvent(event:AccessibilityEvent ):void {
if(event == null){
return ;
}
console.log("packagename",event!.getPackageName())
if("io.dcloud.uniappx" == event!.getPackageName()){
console.log("辅助服务消息:uniappx 基座打开")
}else if("io.dcloud.HBuilder" == event!.getPackageName()){
console.log("辅助服务消息:HBuilder 基座被打开")
}
}
}
uni_modules/uts-nativepage/utssdk/app-android/index.uts
浏览文件 @
44170e9a
...
@@ -29,7 +29,7 @@ export {DoAppWidget} from "./DoAppWidget.uts"
...
@@ -29,7 +29,7 @@ export {DoAppWidget} from "./DoAppWidget.uts"
import Application from 'android.app.Application';
import Application from 'android.app.Application';
import File from 'java.io.File';
import File from 'java.io.File';
import Uri from 'android.net.Uri';
import Uri from 'android.net.Uri';
export * from './CustomAccessibilityService.uts'
export class AppHookProxy implements UTSAndroidHookProxy {
export class AppHookProxy implements UTSAndroidHookProxy {
override onCreate(application: Application) {
override onCreate(application: Application) {
...
...
uni_modules/uts-nativepage/utssdk/app-android/res/values/strings.xml
浏览文件 @
44170e9a
...
@@ -12,4 +12,5 @@
...
@@ -12,4 +12,5 @@
<string
name=
"dcloud_ad_notification_delete_download"
>
Delete
</string>
<string
name=
"dcloud_ad_notification_delete_download"
>
Delete
</string>
<string
name=
"dcloud_ad_tag_ads"
>
Ads
</string>
<string
name=
"dcloud_ad_tag_ads"
>
Ads
</string>
<string
name=
"app_widget_description"
>
This is an app widget description
</string>
<string
name=
"app_widget_description"
>
This is an app widget description
</string>
<string
name=
"demo_service_name"
>
uniappx 测试辅助服务
</string>
</resources>
</resources>
\ No newline at end of file
uni_modules/uts-nativepage/utssdk/app-android/res/xml/custom_accessibility_service_config.xml
0 → 100644
浏览文件 @
44170e9a
<?xml version="1.0" encoding="utf-8"?>
<accessibility-service
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:description=
"@string/demo_service_name"
android:accessibilityEventTypes=
"typeNotificationStateChanged|typeWindowStateChanged"
android:packageNames=
"io.dcloud.uniappx,io.dcloud.HBuilder"
android:accessibilityFeedbackType=
"feedbackGeneric"
android:notificationTimeout=
"100"
android:accessibilityFlags=
"flagDefault"
android:canRetrieveWindowContent=
"true"
/>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录