1 回答

TA貢獻2051條經(jīng)驗 獲得超10個贊
用這個 Api 來解決這個問題。?
這是代碼:
HashMap map = new HashMap<>();
? ? ? ? ? ? ? ? ? ? ? ? map.put("KEY_LOGIN",new HashSet<>(Arrays.asList("espere", "waiting", "loading", "esperando")));
? ? ? ? ? ? ? ? ? ? ? ? map.put("KEY_ERROR",new HashSet<>(Arrays.asList("problema", "problem", "error", "null")));
? ? ? ? ? ? ? ? ? ? ? ? final USSDApi ussdApi = USSDController.getInstance(MainActivity.this);
? ? ? ? ? ? ? ? ? ? ? ? ussdApi.callUSSDInvoke("*786#", map, new USSDController.CallbackInvoke() {
? ? ? ? ? ? ? ? ? ? ? ? ? ? @Override
? ? ? ? ? ? ? ? ? ? ? ? ? ? public void responseInvoke(String message) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? // message has the response string data
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? String dataToSend = "data";// <- send "data" into USSD's input text
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ussdApi.send(dataToSend,new USSDController.CallbackMessage(){
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? @Override
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? public void responseMessage(String message) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? // message has the response string data from USSD
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Log.d("message", message);
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? });
? ? ? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ? ? ? ? @Override
? ? ? ? ? ? ? ? ? ? ? ? ? ? public void over(String message) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? // message has the response string data from USSD or error
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? // response no have input text, NOT SEND ANY DATA
? ? ? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ? ? });
添加回答
舉報