Skip to content

Is there any way to use AndroidJavaObject.Call() function? #925

Open
@Raonshi

Description

@Raonshi

@juicycleff

Hi. When I making a flutter application with unity, I hot a problem.

My Unity project made by other team (I can not control the unity source code). Also, I have to implement some IPC protocol to communicate unity and flutter. this protocol have to return some value which unity need.

I can't share my code because of security policy. instead, I can share some similar code. like this.

/* Unity Code */
AndroidJavaClass jc = AndroidJavaClass("com.my.flutter.android.module");
stirng result = jc.Call("requestSomeEncodedJson"); // Important line. I have to return the result.
/* Flutter Code */

// This function called by unity
String requestSomeEncodedJson(String param1, int param2) {
  String result = "";
  /* Implements business logic */
  return jsonEncode(result);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions