gpt4 book ai didi

android - 辅助功能服务未在服务中列出?

转载 作者:行者123 更新时间:2023-11-29 16:06:19 26 4
gpt4 key购买 nike

好吧,我正在尝试实现其中一项服务,我正在使用此处的代码:http://developer.android.com/training/accessibility/service.html#create但我无法启用该服务,因为我在系统设置中看不到它。谁能帮帮我?

list :

<service android:name=".MyAccessibilityService" >
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
</service>

我的AccessibilityService.java

import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.util.Log;
import android.view.accessibility.AccessibilityEvent;
import android.widget.Toast;

public class MyAccessibilityService extends AccessibilityService
{
public static final String TAG = "volumeMaster";

@Override
public void onAccessibilityEvent(AccessibilityEvent event)
{
Log.v(TAG, "***** onAccessibilityEvent");
Toast.makeText(getApplicationContext(), "Got event from: " + event.getPackageName(), Toast.LENGTH_LONG).show();
}

@Override
public void onInterrupt()
{
Log.v(TAG, "***** onInterrupt");
}

@Override
public void onServiceConnected()
{
Log.v(TAG, "***** onServiceConnected");

AccessibilityServiceInfo info = new AccessibilityServiceInfo();
info.eventTypes = AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED;
info.notificationTimeout = 100;
info.feedbackType = AccessibilityEvent.TYPES_ALL_MASK;
setServiceInfo(info);

}
}

最佳答案

好吧,我在 AndroidManifest.xml 中留下了一些重要的东西,所以现在它可以正常工作了。这是新 list

    <service
android:name=".NotificationService"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
class=".NotificationService"
android:enabled="true"
android:exported="false" >
<intent-filter>
<action
android:name=".NotificationService"
android:value=".NotificationService" />
</intent-filter>
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>

</service>

关于android - 辅助功能服务未在服务中列出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18039354/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com