Skip to content

Commit

Permalink
V1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
szvone committed Feb 25, 2019
1 parent 6ed03d7 commit ed9f7d6
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 6 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ V免签 是基于SpringBoot 2.1.1 实现的一套免签支付程序,主要包
+ 本系统原理为监控收款后手机的通知栏推送消息,所以请保持微信/支付宝/V免签监控端后台正常运行,且添加到内存清理白名单!

## 更新记录
+ v1.1(2019.02.25)
+ 修复安卓7.0以上系统监控App闪退问题
+ 修复监控端检测服务状态无法正确检测是否正常问题
+ 添加商家码收款回调支持,商家码收款的也能正常回调啦

+ v1.0(2019.01.31)
+ 初版发布
Expand Down
Binary file modified app/app-release.apk
Binary file not shown.
50 changes: 45 additions & 5 deletions app/src/main/java/com/dommy/vmq/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Looper;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
Expand Down Expand Up @@ -60,7 +61,7 @@ protected void onCreate(Bundle savedInstanceState) {


//步骤1:创建一个SharedPreferences接口对象
SharedPreferences read = getSharedPreferences("vone", MODE_WORLD_READABLE);
SharedPreferences read = getSharedPreferences("vone", MODE_PRIVATE);
//步骤2:获取文件中的值
host = read.getString("host", "");
key = read.getString("key", "");
Expand Down Expand Up @@ -140,14 +141,19 @@ public void onResponse(Call call, Response response) throws IOException {

}
});
if (tmp[0].indexOf("localhost")>=0){
Toast.makeText(MainActivity.this, "配置信息错误,本机调试请访问 本机局域网IP:8080(如192.168.1.101:8080) 获取配置信息进行配置!", Toast.LENGTH_LONG).show();

return;
}
//将扫描出的信息显示出来
txthost.setText(" 通知地址:"+tmp[0]);
txtkey.setText(" 通讯密钥:"+tmp[1]);
host = tmp[0];
key = tmp[1];

//步骤2-1:创建一个SharedPreferences.Editor接口对象,lock表示要写入的XML文件名,MODE_WORLD_WRITEABLE写操作
SharedPreferences.Editor editor = getSharedPreferences("vone", MODE_WORLD_WRITEABLE).edit();
SharedPreferences.Editor editor = getSharedPreferences("vone", MODE_PRIVATE).edit();
//步骤2-2:将获取过来的值放入文件
editor.putString("host", host);
editor.putString("key", key);
Expand Down Expand Up @@ -203,7 +209,37 @@ public void doStart(View view) {
btnStart.setText("检测服务状态");
Toast.makeText(MainActivity.this, "开启成功!", Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(MainActivity.this, "程序运行正常!", Toast.LENGTH_SHORT).show();

String t = String.valueOf(new Date().getTime());
String sign = md5(t+key);

//1.创建OkHttpClient对象
OkHttpClient okHttpClient = new OkHttpClient();
//2.创建Request对象,设置一个url地址(百度地址),设置请求方式。
Request request = new Request.Builder().url("http://"+host+"/appHeart?t="+t+"&sign="+sign).method("GET",null).build();
//3.创建一个call对象,参数就是Request请求对象
Call call = okHttpClient.newCall(request);
//4.请求加入调度,重写回调方法
call.enqueue(new Callback() {
//请求失败执行的方法
@Override
public void onFailure(Call call, IOException e) {
Looper.prepare();
Toast.makeText(MainActivity.this, "心跳状态错误,请检查配置是否正确!", Toast.LENGTH_SHORT).show();
Looper.loop();
}
//请求成功执行的方法
@Override
public void onResponse(Call call, Response response) throws IOException {
//Log.d(TAG, "onResponse heard: "+response.body().string());
Looper.prepare();
Toast.makeText(MainActivity.this, "程序运行正常,心跳返回:"+response.body().string(), Toast.LENGTH_LONG).show();
Looper.loop();
}
});



}
}
private boolean isAccessibilitySettingsOn(Context mContext) {
Expand Down Expand Up @@ -324,13 +360,17 @@ public void run() {
//请求失败执行的方法
@Override
public void onFailure(Call call, IOException e) {

Looper.prepare();
Toast.makeText(MainActivity.this, "心跳状态错误,请检查配置是否正确!", Toast.LENGTH_SHORT).show();
Looper.loop();
}
//请求成功执行的方法
@Override
public void onResponse(Call call, Response response) throws IOException {
Log.d(TAG, "onResponse heard: "+response.body().string());

Looper.prepare();
//Toast.makeText(MainActivity.this, "心跳正常", Toast.LENGTH_SHORT).show();
Looper.loop();
}
});
try {
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/com/dommy/vmq/NeNotificationService.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public void onAccessibilityEvent(AccessibilityEvent event) {
Log.d(TAG, "onAccessibilityEvent: 匹配成功: 支付宝 到账 "+money);
appPush(2,Double.valueOf(money));

}else if (text.indexOf("成功收款")!=-1){
String money = getSubString(text,"成功收款","元");
Log.d(TAG, "onAccessibilityEvent: 匹配成功: 支付宝 到账 "+money);
appPush(2,Double.valueOf(money));

}
}
}
Expand Down
8 changes: 7 additions & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.dommy.vmq.MainActivity">
tools:context="com.dommy.vmq.MainActivity"

>

<include layout="@layout/toolbar_main" />

<TextView
android:paddingTop="20dp"
android:paddingBottom="10dp"

android:id="@+id/txt_host"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
Expand All @@ -18,6 +23,7 @@
android:text=" 通知地址:请扫码配置" />

<TextView
android:paddingBottom="20dp"
android:id="@+id/txt_key"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
Expand Down

0 comments on commit ed9f7d6

Please sign in to comment.