Java Sdk not working in android 11-12


  • generateSession() not working in android version above 10. its giving null pointer exception as Mac address not found. please help me out its very urgent. Thank you.


  • @techsharad said in Java Sdk not working in android 11-12:

    generateSession() not working

    I experienced a similar error while I was trying to integrate third-party apps. I think you will need to help of WorldPay developer, you can hire from techtix.co


  • @techsharad This function is giving error Null pointer exception
    public Request createPostRequest(String apiKey, String url, JSONObject params) {
    try {

    		MediaType JSON = MediaType.parse("application/json; charset=utf-8");
    		RequestBody body = RequestBody.create(params.toString(), JSON);
    
    		String privateKey = apiKey;
    		Request request = new Request.Builder().url(url).post(body).header("Content-Type", "application/json")
    				.header("X-ClientLocalIP", apiheader.getString("clientLocalIP"))
    				.header("X-ClientPublicIP", apiheader.getString("clientPublicIP"))
    				.header("X-MACAddress", apiheader.getString("macAddress"))
    				.header("Accept", apiheader.getString("accept")).header("X-PrivateKey", privateKey)
    				.header("X-UserType", apiheader.getString("userType"))
    				.header("X-SourceID", apiheader.getString("sourceID")).build();
    		return request;
    	} catch (JSONException e) {
    		System.out.println("exception createPostRequest");
    		System.out.println(e.getMessage());
    		return null;
    	}
    }

  • @techsharad Error : exception createPostRequest @admin please look into concern