[Android Q&A, Help & Troubleshooting] Nolimited:
Hi!

I don't know if this is the right place for this, but i couldn't find any better

I'm trying to make an Android app what can sent and receive data (Via socket) from/to a VB.net server on my PC.

But the thing is that i can get permission to use the Wifi on my phone.

I've added " <uses-permission android:name="android.permission.INTERNET"/>"

to my manifest outside the <application> tag, but if i go in to "Settings -> Apps -> manage apps " on my phone and go in to the app, there is no permission's at all, and my logcat says "Access denied"

Here is the full logcat:

10-25 02:50:56.284: W/KeyCharacterMap(6248): No keyboard for id 0
10-25 02:50:56.284: W/KeyCharacterMap(6248): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
10-25 02:51:04.576: D/ClientActivity(6248): C: Connecting...
10-25 02:51:04.576: E/ClientActivity(6248): C: Error
10-25 02:51:04.576: E/ClientActivity(6248): java.net.SocketException: Permission denied
10-25 02:51:04.576: E/ClientActivity(6248):	at org.apache.harmony.luni.platform.OSNetworkSystem.socket(Native Method)
10-25 02:51:04.576: E/ClientActivity(6248):	at dalvik.system.BlockGuard$WrappedNetworkSystem.socket(BlockGuard.java:335)
10-25 02:51:04.576: E/ClientActivity(6248):	at org.apache.harmony.luni.net.PlainSocketImpl.create(PlainSocketImpl.java:216)
10-25 02:51:04.576: E/ClientActivity(6248):	at java.net.Socket.startupSocket(Socket.java:698)
10-25 02:51:04.576: E/ClientActivity(6248):	at java.net.Socket.<init>(Socket.java:263)
10-25 02:51:04.576: E/ClientActivity(6248):	at com.edu4java.android.tutorial1.Pontus$ClientThread.run(Pontus.java:57)
10-25 02:51:04.576: E/ClientActivity(6248):	at java.lang.Thread.run(Thread.java:1019)

Here is my complete manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.android.app"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Pontus"
android:label="@string/app_name">

<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

</application>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>

and here is my code for the activity

import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.Socket;
import java.net.SocketAddress;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.view.View.onclickListener;
import android.widget.*;

public class Pontus extends Activity {
/** Called when the activity is first created. */
private EditText serverIp;

private Button connectPhones;
private String serverIpAddress = "";
private boolean connected = false;

private Handler handler = new Handler();

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

serverIp = (EditText) findViewById(R.id.editText1);
connectPhones = (Button) findViewById(R.id.button1);
connectPhones.setonclickListener(connectListener);
}

private onclickListener connectListener = new onclickListener() {

public void onclick(View v) {
/* Check that I'm not already connected */
if (!connected) {
serverIpAddress = serverIp.getText().toString();
if (!serverIpAddress.equals("")) {
/* Creating the new thread and starting it */
Thread cThread = new Thread(new ClientThread());
cThread.start();
}
}
}
};

public class ClientThread implements Runnable {

public void run() {
try {
/* Settings up the socket and connecting */
InetAddress serverAddr = InetAddress.getByName(serverIpAddress);
Log.d("ClientActivity", "C: Connecting...");
Socket socket = new Socket(serverAddr, 4040);
if (socket.isConnected()){
Toast.makeText(null, "ture", 1000);
}

/* While connected, send some text */
connected = true;
while (connected) {
try {
Log.d("ClientActivity", "C: Sending command.");
PrintWriter out = new PrintWriter(
new BufferedWriter(new OutputStreamWriter(
socket.getOutputStream())), true);
/* Send some text */
out.println("Hey Server!");
Log.d("ClientActivity", "C: Sent.");
} catch (Exception e) {
/* Print exception */
Log.e("ClientActivity", "S: Error", e);
}
}
/* Close socket */
socket.close();
Log.d("ClientActivity", "C: Closed.");
} catch (Exception e) {
/* Print exception */
Log.e("ClientActivity", "C: Error", e);
connected = false;
}
}
}

}

I hope someone can help me.

Thanks in advance :)

Here is a printscreen show no permission on the app (All text in Swedish)