PHP-Android | base64_encode() Function in PHP | base64_decode() Function in Android

Jyotishgher Astrology
By -
0

 PHP-Android | base64_encode() Function in PHP | base64_decode() Function in Android

Either make a method in ANDROID


private String decodeBase64(String coded){
    byte[] valueDecoded= new byte[0];
    try {
        valueDecoded = Base64.decode(coded.getBytes("UTF-8"), Base64.DEFAULT);
    } catch (UnsupportedEncodingException e) {
    }
    return new String(valueDecoded);
}


IN PHP WRITE AS WHATEVER RESPONSE YOU WANT TO ENCODE AS:


$response["name"] =  base64_encode($objResult["NAME"]);


oR IN aNDROID wRITE DECODE AS:


String   FINAL_NAME = json.getString(NAME);

valueDecoded = Base64.decode(FINAL_NAME.getBytes(StandardCharsets.UTF_8), Base64.DEFAULT);
PAN_NO =new String(valueDecoded);


Post a Comment

0Comments

Post a Comment (0)