send files from my service in eclipse to android

0

I have a dilemma. I am trying to send a file that I have in my database to my android application. I have my service that gets a byte [] but when calling it from my android application, it goes down. I do not know how to send this file, whether to send it as I am sending it (byte []) or in some other way so that it can be received from my application. Highlight that I use REST service. In android I only call the url of my service, which returns me a bean with the data. Any additional that they require so that they can help me I am attentive. Thank you very much in advance.

Here I make the call from android. It is a service where I send the request and the parameter you need.

@GET ("/ mobileAPI / FileNotificationById / {id}")  Call > getFileNotificationById (@Path ("id") Long id, @Query ("access_token") String access_token);

The following code gets the service. This is my activity private void dowloand () {

    ImageView info = (ImageView) findViewById(R.id.dowloand);
    info.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            System.out.println("ENTRE: " + notificationPk );
            NotificationService notificationUserBean = ServiceGenerator.createService(NotificationService.class);
            Call<ResponseBean<NotificationUserBean>> dbCall = notificationUserBean.getFileNotificationById(notificationPk,access_token);

            dbCall.enqueue(new Callback<ResponseBean<NotificationUserBean>>() {
                @Override
                public void onResponse(Call<ResponseBean<NotificationUserBean>> call, Response<ResponseBean<NotificationUserBean>> response) {


                    NotificationUserBean File = (NotificationUserBean) response.body().getData();
                    System.out.println("FIlE: " + File.getBtData());


                }

                @Override
                public void onFailure(Call<ResponseBean<NotificationUserBean>> call, Throwable t) {

                }

            });

        }
    });
}

}

In java I only send a bean with a byte parameter []

    
asked by David pineda canales 05.06.2017 в 19:55
source

0 answers