基於免簽支付監測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. 如有疑問及需求,請添加一起探討研究!。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM