好吧,我正在尝试实现其中一项服务,我正在使用此处的代码:http: //developer.android.com/training/accessibility/service.html#create但我无法启用该服务,因为我在系统设置中看不到。谁能帮帮我?
显现:
<service android:name=".MyAccessibilityService" >
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
</service>
MyAccessibilityService.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);
}
}