I want to communicate between Nao V3 and Android application, I use Naoqi 2.1.4.13 and Java. I want to connect them together and interact. For example : The user clic on the "Connect" button and this will connect the robot to the interface and then the user select on the application the Tai Chi danse and this will launch the Tai Chi behavior. I have the Java API and I can communicate with the robot with a Java class and a main function without the interface. But I want to do it with the interface. The problem is that my android project on android studio doesn't have a public static void main(String[]args) function, just a protected void onCreate(Bundle savedInstanceState) function. Can you help me with my problem please ?
I already tried to communicate without the main function one the MainActivity java class of my Android application. But it doesn't work.
I try :
private Application app = null;
private Session session = null;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
app = new Application(null);
}
following this example.
and I have this error who appear :
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapplication1/com.example.myapplication1.MainActivity}:
java.lang.RuntimeException: Creating application with null args
Caused by: java.lang.RuntimeException: Creating application with null args
at com.aldebaran.qi.Application.<init>(Application.java:59)
at com.example.myapplication1.MainActivity.onCreate(MainActivity.java:35)
at android.app.Activity.performCreate(Activity.java:6662)
When I try in a java class without launching the application it's working:
public static void main(String[] args) throws Exception{
Application app = new Application(args);
Session session = new Session();
session.connect("tcp://" + NAO_IP + ":9559").sync(500, TimeUnit.MILLISECONDS);
Object tts = null;
ALBehaviorManager alBehaviorManager = new ALBehaviorManager(session);}