sample/src/androidTest/java/com/urbanairship/sample/utils/PushSender.java
public void send(com.urbanairship.sample.utils.PushPayload payload) {

        Gson gson = new Gson();
        PushPayload gsonPayload = gson.fromJson(payload.toString(), PushPayload.class);
        Call<ResponseBody> call = service.send(Credentials.basic(appKey, masterSecret), gsonPayload);

        try {
            retrofit2.Response response = call.execute();
            // 5xx
            if (response == null || UAHttpStatusUtil.inServerErrorRange(response.code())) {
                Log.e(TAG, "Failed to receive a response. Will retry");
            }
            // 4xx
            if (UAHttpStatusUtil.inClientErrorRange(response.code())) {
                Log.e(TAG, "Failed to send message: " + payload.toString() + ". Received a response: " + response);
            }
            // 2xx
            if (UAHttpStatusUtil.inSuccessRange(response.code())) {
                Log.d(TAG, "Received a response: " + response);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
/**
     * Sends the push message.
     *
     * @param payload The PushPayload
     */
Sends the push message.
@param payload The PushPayload
Sends the push message . @param payload The PushPayload
public void send(com.urbanairship.sample.utils.PushPayload payload) {
        Gson gson = new Gson();
        PushPayload gsonPayload = gson.fromJson(payload.toString(), PushPayload.class);
        Call<ResponseBody> call = service.send(Credentials.basic(appKey, masterSecret), gsonPayload);
        try {
            retrofit2.Response response = call.execute();
            if (response == null || UAHttpStatusUtil.inServerErrorRange(response.code())) {
                Log.e(TAG, "Failed to receive a response. Will retry");
            }
            if (UAHttpStatusUtil.inClientErrorRange(response.code())) {
                Log.e(TAG, "Failed to send message: " + payload.toString() + ". Received a response: " + response);
            }
            if (UAHttpStatusUtil.inSuccessRange(response.code())) {
                Log.d(TAG, "Received a response: " + response);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
public void send ( com . urbanairship . sample . utils . PushPayload payload ) { Gson gson = new Gson ( ) ; PushPayload gsonPayload = gson . fromJson ( payload . toString ( ) , PushPayload . class ) ; Call < ResponseBody > call = service . send ( Credentials . basic ( appKey , masterSecret ) , gsonPayload ) ; try { retrofit2 . Response response = call . execute ( ) ; if ( response == null || UAHttpStatusUtil . inServerErrorRange ( response . code ( ) ) ) { Log . e ( TAG , "Failed to receive a response. Will retry" ) ; } if ( UAHttpStatusUtil . inClientErrorRange ( response . code ( ) ) ) { Log . e ( TAG , "Failed to send message: " + payload . toString ( ) + ". Received a response: " + response ) ; } if ( UAHttpStatusUtil . inSuccessRange ( response . code ( ) ) ) { Log . d ( TAG , "Received a response: " + response ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } }
Sends the push message.
Sends the push message .
// 5xx // 4xx // 2xx