i have built rails app interacts android application. sending , receiving data android on localhost working flawlessly. when upload aws ec2 instance, i'm able send data android server not other way around.
i using passenger gem upload in aws.
my rails code accept request app gives 200 ok
class android::onetimelogincontroller < applicationcontroller respond_to :json # handles 1 time login android app def create # takes credentials android app , # sends header token used further pings credentials = permitted_credentials # checks credentials , renders responses if credentials.has_key?("name") if branch.exists?(name: credentials["something"]) && credentials["password"] == "something" response_json = {"response" => "yes"} render :json => response_json else render :text => "no" end end end private def permitted_credentials params.require("credentials").permit(:name, :password, :tablet_id) end end
but i'm not getting on android side(although response in localhost)
i got response curl request. curl command.
curl -v -h "content-type: application/json" -x post -d ' {"credentials":{"name" : "something", "password": "something"}}' http://ip/path_to_controller
i checked putting "content-type" , "accept" headers android request, no use.
please tell me going wrong? aws problem?
i had same bug. not problem rails script. think volley framework have used might have been corrupt or buggy. try importing library other source using gradle. try importing mcxiaoke.volley. worked me....