0

Here what i have three application:

  1. UI application (Java)
  2. Native application A (Cpp)
  3. Native application B (Cpp)

Now UI application call Native application A start. So is there any way to call B start from A? Because B is external part of A, it's needed to be individual process.

Update: Call app like this:

std::system("am start -n com.package.name/.activity")

it's work in ADB, but not work in Native application.

New idea: Because B application just need to do a simple file transfer job(OTA file download). So I think i need to make B application become a service. And make it start when system boot. Then A application not invoke B but broadcast an intent to B.Like this:

std::system("am broadcast -a my_start_action -n com.package.name/.activity")

But still not work.

JustWe
  • 3,419
  • 3
  • 26
  • 63

2 Answers2

0

You should use JNI callback to ask application A send start intent to application B.

JNI callback :

JNI - How to callback from C++ or C to Java?

send start intent to application B:

Open another application from your own (intent)

Community
  • 1
  • 1
Dzung Le
  • 11
  • 3
0

Since A and B are native Linux process, you can start B from A by using

system or fork/exec api.

In the code of A system("/path/to/b")

Or in code of A fork() a process, and them exec("/path/to/b", ...)

alijandro
  • 9,944
  • 2
  • 45
  • 61