基于监测app短信监控支付宝微信通知信息 发送自动回调信息系统对接的功能实现!

  • Post author:
  • Post category:其他


摘要:基于支付监测app短信监控支付宝微信通知信息, 发送回调金额微信支付宝等过滤信息对接集成的功能实现!

功能描述:该监测APP软件,可以监测任何应用的短信信息内容,及进行自动回调和对接集成。实现由人工手动核对操作,自动处理的转变,实现自动化处理。

方法:监测Android系统在收到短信 支付宝微信通知信息,然后过滤获取其中想要获取到的关键字内容,进行相关数据的上传及回调。

开发工具及编程语言:Eclipse ,JAVA, APP开发。服务后端编程语言:PHP+MYSQL+Http-CURL。

核心源码如下:

import java.io.IOException;

import java.security.MessageDigest;

import java.security.NoSuchAlgorithmException;

import java.util.Date;

import okhttp3.OkHttpClient;

import okhttp3.Request;

import okhttp3.Response;

public class MainActivity extends AppCompatActivity{


private TextView txthost;

private TextView txtkey;

private TextView txtuid;

private boolean isOk = false;

private static String TAG = “MainActivity”;

int id = 0;

@Override

protected void onCreate(Bundle savedInstanceState) {


super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

txthost = (TextView) findViewById(R.id.txt_host);

txtkey = (TextView) findViewById(R.id.txt_key);

txtuid = (TextView) findViewById(R.id.txt_uid);

//检测通知使用权是否启用

if (!isNotificationListenersEnabled()) {


//跳转到通知使用权页面

gotoNotificationAccessSetting();

}

//重启监听服务

toggleNotificationListenerService(this);

//读入保存的配置数据并显示

SharedPreferences read = getSharedPreferences(“vone”, MODE_PRIVATE);

host = read.getString(“host”, “”);

key = read.getString(“key”, “”);

uid = read.getString(“uid”, “”);

    if (host!=null && key!=null && host!="" && key!=""){
        txthost.setText(" 通知地址:"+host);
        txtkey.setText(" 通讯密钥:"+key);
        isOk = true;
    }
    Toast.makeText(MainActivity.this, "短信监控自动回调系统 ", Toast.LENGTH_SHORT).show();
}
//扫码配置
public void startQrCode(View v) {
    // 申请相机权限
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
        // 申请权限
        ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.CAMERA}, Constant.REQ_PERM_CAMERA);
        return;
    }
    // 申请文件读写权限(部分朋友遇到相册选图需要读写权限的情况,这里一并写一下)
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
        // 申请权限
        ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, Constant.REQ_PERM_EXTERNAL_STORAGE);
        return;
    }
    // 二维码扫码
    Intent intent = new Intent(MainActivity.this, CaptureActivity.class);
    startActivityForResult(intent, Constant.REQ_QR_CODE);
}
//手动配置
public void doInput(View v){
    final EditText inputServer = new EditText(this);
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("请输入配置数据").setView(inputServer)
            .setNegativeButton("取消", null);
    builder.setPositiveButton("确认", new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
            String scanResult = inputServer.getText().toString();

            String[] tmp = scanResult.split("/");
            if (tmp.length!=3){
                Toast.makeText(MainActivity.this, "数据错误,请您输入网站上显示的配置数据!", Toast.LENGTH_SHORT).show();
                return;
            }
                @Override
                public void onResponse(Call call, Response response) throws IOException {
                    Log.d(TAG, "onResponse: "+response.body().string());
                    isOk = true;
                }
            });
            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];
            SharedPreferences.Editor editor = getSharedPreferences("vone", MODE_PRIVATE).edit();
        }
//检测心跳
public void doStart(View view) {
    if (isOk==false){
        Toast.makeText(MainActivity.this, "请您先配置!", Toast.LENGTH_SHORT).show();
        return;
    }
    String t = String.valueOf(new Date().getTime());
    String sign = md5(t+key);
    OkHttpClient okHttpClient = new OkHttpClient();
    Request request = new Request.Builder().url("http://"+host+"/appHeart?t="+t+"&sign="+sign+"&uid="+uid).method("GET",null).build();
    Call call = okHttpClient.newCall(request);
    call.enqueue(new Callback() {
        @Override
        public void onFailure(Call call, IOException e) {
            //Looper.prepare();
            //Toast.makeText(MainActivity.this, "心跳状态错误,请检查配置是否正确!", Toast.LENGTH_SHORT).show();
            //Looper.loop();
			//doStart();
        }
//检测监听
public void checkPush(View v){
    Notification mNotification;
    NotificationManager mNotificationManager;
    mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        NotificationChannel channel = new NotificationChannel("1",
                .setSmallIcon(R.mipmap.ic_launcher)
                .setTicker("这是一条测试推送信息,如果程序正常,则会提示监听权限正常")
                .setContentTitle("系统测试推送")
                .build();
    }else{
        mNotification = new Notification.Builder(MainActivity.this)
                .setSmallIcon(R.mipmap.ic_launcher)
                .setTicker("这是一条测试推送信息,如果程序正常,则会提示监听权限正常")
                .setContentTitle("免签测试推送")
                .build();
    }
    mNotificationManager.notify(id++, mNotification);
}
//各种权限的判断
private void toggleNotificationListenerService(Context context) {
    PackageManager pm = context.getPackageManager();
    pm.setComponentEnabledSetting(new ComponentName(context, NeNotificationService2.class),
            PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
    pm.setComponentEnabledSetting(new ComponentName(context, NeNotificationService2.class),
            PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);

    Toast.makeText(MainActivity.this, "服务启动中...", Toast.LENGTH_SHORT).show();
}
public boolean isNotificationListenersEnabled() {
    String pkgName = getPackageName();
    final String flat = Settings.Secure.getString(getContentResolver(), "enabled_notification_listeners");
}
protected boolean gotoNotificationAccessSetting() {
    try {
        Intent intent = new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS");
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    } catch (ActivityNotFoundException e) {//普通情况下找不到的时候需要再特殊处理找一次
        try {
            Intent intent = new Intent();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            ComponentName cn = new ComponentName("com.android.settings", "com.android.settings.Settings$NotificationAccessSettingsActivity");
            intent.setComponent(cn);
            intent.putExtra(":settings:show_fragment", "NotificationAccessSettings");
            startActivity(intent);
            return true;
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        Toast.makeText(this, "对不起,您的手机暂不支持", Toast.LENGTH_SHORT).show();
        e.printStackTrace();
        return false;
    }
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    //扫描结果回调
    if (requestCode == Constant.REQ_QR_CODE && resultCode == RESULT_OK) {
        Bundle bundle = data.getExtras();
        String scanResult = bundle.getString(Constant.INTENT_EXTRA_KEY_QR_SCAN);
        String[] tmp = scanResult.split("/");
        if (tmp.length!=3){
            Toast.makeText(MainActivity.this, "二维码错误,请您扫描网站上显示的二维码!", Toast.LENGTH_SHORT).show();
            return;
        }
        OkHttpClient okHttpClient = new OkHttpClient();
        Request request = new Request.Builder().url("http://"+tmp[0]+"/appHeart?t="+t+"&sign="+sign+"&uid="+yidd).method("GET",null).build();
        Call call = okHttpClient.newCall(request);
        call.enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

            }
            @Override
            public void onResponse(Call call, Response response) throws IOException {
                Log.d(TAG, "onResponse: "+response.body().string());
                isOk = true;
            }
        });
    }
    短信监控自动回调微信支付宝APP源码 点击下载 http://kw.bjx-tech.com/CodesQq1918003003/appActivity.zip



版权声明:本文为bengpeique7830原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。