基本信息
源码名称:android 自动抢红包 实例源码下载
源码大小:2.34M
文件格式:.rar
开发语言:Java
更新时间:2017-03-18
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍

微信自动抢红包

findViewById(R.id.open).setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
RobMoney.setStartFunc2(true);
Toast.makeText(MainActivity.this, "开启自动抢红包", Toast.LENGTH_LONG).show();
}
});
findViewById(R.id.stop).setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
RobMoney.setStartFunc2(false);
Toast.makeText(MainActivity.this, "关闭自动抢红包", Toast.LENGTH_LONG).show();
}
});

try {
if (!isAccessibilitySettingsOn(this)) {
Toast.makeText(this, "找到抢红包服务,开启即可", Toast.LENGTH_LONG).show();
Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
startActivity(intent);
}
} catch (Exception e) {
Log.i("Vysor-main", "", e);

}
}


/**
* 判断辅助功能服务是否开启

* @param mContext
* @return
*/
private boolean isAccessibilitySettingsOn(Context mContext) {
int accessibilityEnabled = 0;
final String service = getPackageName() "/" RobMoney.class.getCanonicalName();

try {
accessibilityEnabled = Settings.Secure.getInt(mContext.getApplicationContext().getContentResolver(),
android.provider.Settings.Secure.ACCESSIBILITY_ENABLED);
//Log.v(TAG, "accessibilityEnabled = " accessibilityEnabled);
} catch (Settings.SettingNotFoundException e) {
//Log.e(TAG, "Error finding setting, default accessibility to not found: " e.getMessage());
}
TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':');

if (accessibilityEnabled == 1) {
//Log.v(TAG, "***ACCESSIBILITY IS ENABLED*** -----------------");
String settingValue = Settings.Secure.getString(mContext.getApplicationContext().getContentResolver(),
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
if (settingValue != null) {
mStringColonSplitter.setString(settingValue);
while (mStringColonSplitter.hasNext()) {
String accessibilityService = mStringColonSplitter.next();

//Log.v(TAG, "-------------- > accessibilityService :: " accessibilityService " " service);
if (accessibilityService.equalsIgnoreCase(service)) {
//Log.v(TAG, "We've found the correct setting - accessibility is switched on!");
return true;
}
}
}
} else {
//Log.v(TAG, "***ACCESSIBILITY IS DISABLED***");
}

return false;
}