0

Hey folks trying to run the redis client on my android app but getting the error Failed connecting to host ,basically I installed redis on my Mac and im using Jedis as a redis client in my android app , started the redis server with the redid-server cmd on terminal and here is my code below for java ,is there any part that im missing here ? Thanks !

  Thread thread = new Thread(new Runnable() {

        @Override
        public void run() {
            try  {
                //Your code goes here

               Jedis jedis =new Jedis("127.0.0.1",6379);


                jedis.set("event","15.00000000");

           //     jedisString=jedis.get("event");

                //   redis2.setT

                redis2.setText(jedis.get("event"));




            } catch (Exception e) {
                e.printStackTrace();


               redis2.setText(""+e.getMessage());


            }
        }
    });

    thread.start();

redis2 is a TextView that wanted to check if redis is working or not.

  • 1
    Take a look at https://stackoverflow.com/questions/4779963/how-can-i-access-my-localhost-from-my-android-device . This says about connecting to localhost from android device/emulator – Slashbin Feb 05 '19 at 13:06
  • Hey Solved with Airmore ,this gives my the right IP address ,127.0.0.1 is wrong ,I used the similar method when I was connecting to my local Api with Xampp . Thanks ! –  Feb 05 '19 at 13:09

0 Answers0