TobiTobsen
Lurker
Hey!
I'm happy to be a new member in this community!
I'm testing a few things and I'm trying to send OSC data (via UDP) by using a java library.
When I'm using the Android emulator, how does he connect to the network? Or what settings do I have to do to send and receive the data?
What I did is to allow the software to use network by writing this to the AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
Here is some easy code, trying to send data to IP 192.168.60.11 and port 3333
And my OSCInterface
I'm happy to be a new member in this community!
I'm testing a few things and I'm trying to send OSC data (via UDP) by using a java library.
When I'm using the Android emulator, how does he connect to the network? Or what settings do I have to do to send and receive the data?
What I did is to allow the software to use network by writing this to the AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
Here is some easy code, trying to send data to IP 192.168.60.11 and port 3333
Code:
package com.example.helloandroid;
import com.illposed.osc.OSCMessage;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class HelloAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView (this);
tv.setText("Hello Android");
setContentView(tv);
/*
* Preparing OSC data
*/
OSCInterface oscInterface = new OSCInterface("192.168.60.11", 3333);
Object [] data = new Object [2];
data[0] = (int)111;
data[1] = (int) 222;
String oscAdd = "/data";
/*
* Sending data
*/
System.out.println("Sending OSC DATA");
oscInterface.sendSingleMessage(new OSCMessage(oscAdd ,data));
}
}
And my OSCInterface
Code:
package com.example.helloandroid;
import java.io.IOException;
import java.net.InetAddress;
import java.net.SocketException;
import java.net.UnknownHostException;
import com.illposed.osc.OSCMessage;
import com.illposed.osc.OSCPortOut;
/**
* Dies Klasse stellt die OSC Schnittstelle nach au