Mini Program Methods | MiniOpenApiProxy Methods | Description of the method |
wx.login | login | Login interface |
wx.getUserInfo | getUserInfo | Get basic user information |
wx.getUserProfile | getUserProfile | Get user profile information |
wx.getPhoneNumber | getPhoneNumber | Get phone number |
wx.requestPayment | requestPayment | Initiate a payment |
wx.checkSession | checkSession | Checks if the login status has expired. |
@ProxyService(proxy = MiniOpenApiProxy.class) public class MiniOpenApiProxyImpl implements MiniOpenApiProxy { private static final String TAG = "MiniOpenApiProxyImpl"; @Override public void login(IMiniAppContext miniAppContext, JSONObject params, AsyncResult result) { QMLog.d(TAG, "login:" + params); JSONObject jsonObject = new JSONObject(); try { jsonObject.put("key", "wx.login"); } catch (JSONException e) { e.printStackTrace(); } result.onReceiveResult(true, jsonObject); } @Override public void checkSession(IMiniAppContext miniAppContext, JSONObject params, AsyncResult result) { QMLog.d(TAG, "checkSession:" + params); JSONObject jsonObject = new JSONObject(); try { jsonObject.put("key", "wx.checkSession"); } catch (JSONException e) { e.printStackTrace(); } result.onReceiveResult(true, jsonObject); } @Override public void getUserInfo(IMiniAppContext miniAppContext, JSONObject params, AsyncResult result) { QMLog.d(TAG, "getUserInfo:" + params); JSONObject jsonObject = new JSONObject(); try { final JSONObject userInfo = new JSONObject(); userInfo.put("nickName", "userInfotest"); // userInfo.put("avatarUrl", bundle.getString("avatarUrl")); userInfo.put("gender", 0); userInfo.put("country", "CN"); userInfo.put("province", "BeiJing"); userInfo.put("city", "BeiJing"); userInfo.put("language", "en"); jsonObject.put("userInfo", userInfo); } catch (JSONException e) { e.printStackTrace(); } result.onReceiveResult(true, jsonObject); } @Override public void getUserProfile(IMiniAppContext miniAppContext, JSONObject params, AsyncResult result) { QMLog.d(TAG, "getUserProfile:" + params); JSONObject jsonObject = new JSONObject(); try { jsonObject.put("key", "wx.getUserProfile"); } catch (JSONException e) { e.printStackTrace(); } result.onReceiveResult(true, jsonObject); } @Override public void getPhoneNumber(IMiniAppContext miniAppContext, JSONObject params, AsyncResult result) { QMLog.d(TAG, "getPhoneNumber:" + params); JSONObject jsonObject = new JSONObject(); try { jsonObject.put("key", "wx.getPhoneNumber"); } catch (JSONException e) { e.printStackTrace(); } result.onReceiveResult(true, jsonObject); } @Override public void requestPayment(IMiniAppContext miniAppContext, JSONObject params, AsyncResult result) { QMLog.d(TAG, "requestPayment:" + params); JSONObject jsonObject = new JSONObject(); try { jsonObject.put("key", "wx.requestPayment"); } catch (JSONException e) { e.printStackTrace(); } result.onReceiveResult(true, jsonObject); }
Was this page helpful?