基于免签支付监测app短信支付宝微信通知信息 发送自动回调过滤信息系统对接集成的功能实现

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

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

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

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

核心源码如下:

import android.os.Build;

public void setOnAsyncResponse(AsyncResponse asyncResponse)

 {
                this.asyncResponse = asyncResponse;
        }
/**

*作者QQ:1918003003. 如有疑问及需求,请添加一起探讨研究!。
         * 是否已授权
         *
         * @return
         */
        @Override
        protected String doInBackground(Map<String,String> ... key) {
                Map<String ,String> postmap=key[0];
                if(postmap==null)
                        return null;
                String url = postmap.get("url");

                if(url==null)
                        return null;

                postmap.remove("url");
                String protocol=UrlUtil.httpOrHttps(url);
                String postjson=map2Json(postmap);
                if("http".equals(protocol)){
                        try{
                                //Log.d(TAG,"post task  url:"+url);
                                //Log.d(TAG,"post task postjson:"+postjson);
                                return httppost(url,postjson);
                        }catch(IOException e){}
                }
                if("https".equals(protocol)){
                        try{
                                Log.d(TAG,"post task  url:"+url);
                                Log.d(TAG,"post task postjson:"+postjson);
                                return httpspost(url,postjson);
                        }catch(IOException e){}

                }
                return null;
        }


public class PostTask extends AsyncTask<Map<String, String>, Void, String> {

        public AsyncResponse asyncResponse;
        public static final MediaType JSON = MediaType.get("application/json; charset=utf-8");
        public String TAG="NLService";
        OkHttpClient client = new OkHttpClient();
        String httppost(String url, String json) throws IOException {
                RequestBody body = RequestBody.create(JSON, json);
                OkHttpClient client = new OkHttpClient.Builder()
                        .connectTimeout(10, TimeUnit.SECONDS)//设置连接超时时间
                        .readTimeout(20, TimeUnit.SECONDS)//设置读取超时时间
                        .build();
                Request.Builder request = new Request.Builder()
                        .url(url)
                        .post(body);
                try (Response response = client.newCall(request.build()).execute()) {
                        return response.body().string();
                }
        }

        String httpspost(String url, String json)  throws IOException{
            if (Build.VERSION.SDK_INT >= 22 )
                return httppost(url, json);
            try {
                RequestBody body = RequestBody.create(JSON, json);
                SSLSocketFactory factory = new SSLSocketFactoryCompat();
                ConnectionSpec cs = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
                    .tlsVersions(TlsVersion.TLS_1_2)
                    .build();

            List<ConnectionSpec> specs = new ArrayList<>();
            specs.add(cs);
            specs.add(ConnectionSpec.COMPATIBLE_TLS);
            specs.add(ConnectionSpec.CLEARTEXT);

    
                OkHttpClient client = new OkHttpClient.Builder()
                        .connectTimeout(10, TimeUnit.SECONDS)//设置连接超时时间
                        .readTimeout(20, TimeUnit.SECONDS)//设置读取超时时间
                        .sslSocketFactory(factory)
                        .connectionSpecs(specs)
                        .build();
                
                Request.Builder request = new Request.Builder()
                        .url(url)
                        .post(body);
                        Response response = client.newCall(request.build()).execute();
                        return response.body().string();
                }
                catch( IOException e){
                        StringWriter sw = new StringWriter();  
                        PrintWriter pw = new PrintWriter(sw);  
                        e.printStackTrace(pw);  
                        LogUtil.debugLog(sw.toString());
                        return null;
                }
                catch (KeyManagementException e) {
                       e.printStackTrace();
                        return null;
                } catch (NoSuchAlgorithmException e) {
                     e.printStackTrace();
                     return null;
              }
                
        }

完成创建检测和回调传送!。

APP运行界面截图

版权声明:本文博主原创文章。博客,未经同意不得转载。

作者QQ:1918003003. 如有疑问及需求,请添加一起探讨研究!。

猜你喜欢

转载自www.cnblogs.com/QQ1918003003/p/12208471.html