简体   繁体   中英

connecting android app with php and mysql

I am trying to connect an android app to a php script on a local wamp server so that i can authenticate the user.Everything is fine except that the android app cannot connect to the server.What might be the problem?No error is displayed. Here is the code block from where am trying to connect to the server.

try{
            response=CustomHttpClient.executeHttpPost("http://10.0.2.2/login.php",postParameters);
            res=response.toString();
            res=res.replaceAll("\\s+","");
            if(res.equals("0")) {
                userverified=false;
            }
            else {
                String usern=username.getText().toString().trim();
                //session.createLoginSession(usern,res);
                userverified=true;

            }
        }
        catch(Exception e){
            flag=true;
            //error.setText(e.toString());
            }

The result is the exception being called. The exception is java.net.socket Exception:Permission denied

我忘了在清单文件中包含权限。一个人需要在清单中包含使用互联网的权限。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM