Skip to content

yudonghui/CouponsTao

Repository files navigation

Android 自动化操作,辅助功能无障碍,在其他应用的上层显示

​apk

在其他应用的上层显示

1、获取权限
uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"
2、创建服务 用来展示悬浮窗
3、启动悬浮窗

辅助功能无障碍

uses-permission android:name="android.permission.FOREGROUND_SERVICE"
给Service设置无障碍模式

ScrollService需要继承AccessibilityService

点击 滑动 返回操作

@RequiresApi(Build.VERSION_CODES.N) protected void autoSlideView(float startX, float startY, float endX, float endY) { android.graphics.Path path = new android.graphics.Path(); path.moveTo(startX, startY); path.lineTo(endX, endY); GestureDescription gestureDescription = new GestureDescription.Builder() .addStroke(new GestureDescription.StrokeDescription(path, 0, 500)) .build(); dispatchGesture(gestureDescription, new GestureResultCallback() { @Override public void onCompleted(GestureDescription gestureDescription) { super.onCompleted(gestureDescription); }

    @Override
    public void onCancelled(GestureDescription gestureDescription) {
        super.onCancelled(gestureDescription);
    }
}, null);

}

@RequiresApi(Build.VERSION_CODES.N) protected void autoClickView(float startX, float startY) { android.graphics.Path path = new android.graphics.Path(); path.moveTo(startX, startY); GestureDescription gestureDescription = new GestureDescription.Builder() .addStroke(new GestureDescription.StrokeDescription(path, 0, 5)) .build(); dispatchGesture(gestureDescription, new GestureResultCallback() { @Override public void onCompleted(GestureDescription gestureDescription) { super.onCompleted(gestureDescription); }

    @Override
    public void onCancelled(GestureDescription gestureDescription) {
        super.onCancelled(gestureDescription);
    }
}, null);

}

protected void autoBackView() { performGlobalAction(GLOBAL_ACTION_BACK); } ​

About

淘宝,京东,优惠券 电商券

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages