Re: [android-developers] IPC Mechanism in android

2011-03-29 Thread Kostya Vasilyev
You can just read the native program's standard output. Take a look at Java
Process class.
29.03.2011 6:20 пользователь arvind arv2...@gmail.com написал:
 Hi All,

 I have an NDK application(written in C++) packaged as an executable
 and deployed in android. I also have a Java apk file in the
 application layer. Now my NDK app does some processing and outputs a
 string of data in the format name = value. Basically the output from
 NDK looks like this:
 name1 = value1
 name2 = value2... Now i want each of these name value pairs to be
 passed to java application one by one. Currently i am writing the
 output from NDK to a file in sdcard and the java app reads from the
 file. But i want to use an IPC mechanism which is devoid of explicit
 file writing and reading and instead use something like sending and
 listening to a socket. I am not sure what is the best way of passing
 message between native code and java. Also i am not using JNI
 interface as i have some issue with root permissions as the C++ Native
 code runs as root userid and Java apk runs in application level and i
 can't combine both of them. Please give me suggestions on how to
 perform IPC between native code and java apk. I am using android
 developer phone 1 as the device.

 Thanks,
 aravind

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] IPC Mechanism in android

2011-03-29 Thread Bob Kerns
That works if you start the native program from the Java program. It doesn't 
work if it needs to run independently.

I like Frank's approach. Generally, minimizing the amount of C++ code in an 
application will make things better. In fact, I would argue you never want 
to make a native C++ application, but rather write what you must in C++, 
expose it in small pieces via JNI, and package it as a Java application. In 
some cases, the C++ part might be the major piece, but you'll be better off 
with that thin bit of Java around your C++. Even if you don't see a need 
today, at some point in the future, there may some bit of functionality 
easily provided via Java, that you'll be happy to make use of. 

On Tuesday, March 29, 2011 12:48:44 AM UTC-7, Kostya Vasilyev wrote:

 You can just read the native program's standard output. Take a look at Java 
 Process class.
 29.03.2011 6:20 пользователь arvind arv...@gmail.com написал:
  Hi All,
  
  I have an NDK application(written in C++) packaged as an executable
  and deployed in android. I also have a Java apk file in the
  application layer. Now my NDK app does some processing and outputs a
  string of data in the format name = value. Basically the output from
  NDK looks like this:
  name1 = value1
  name2 = value2... Now i want each of these name value pairs to be
  passed to java application one by one. Currently i am writing the
  output from NDK to a file in sdcard and the java app reads from the
  file. But i want to use an IPC mechanism which is devoid of explicit
  file writing and reading and instead use something like sending and
  listening to a socket. I am not sure what is the best way of passing
  message between native code and java. Also i am not using JNI
  interface as i have some issue with root permissions as the C++ Native
  code runs as root userid and Java apk runs in application level and i
  can't combine both of them. Please give me suggestions on how to
  perform IPC between native code and java apk. I am using android
  developer phone 1 as the device.
  
  Thanks,
  aravind
  
  -- 
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-d...@googlegroups.com
  To unsubscribe from this group, send email to
  android-develop...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] IPC Mechanism in android

2011-03-29 Thread Dianne Hackborn
Good lord, please don't run a big piece of C++ code as root.  We designed
things to have very very little code running as root, to keep the exploit
surface area small.

Also we strongly strongly discourage people from writing their apps with
such a structure, where they for a separate process.  The system is not
designed to be used this way, and it won't manage these separate processes
correctly.  Currently it doesn't do much with them, but probably in the
future it will get more aggressive about killing and cleaning them out of
the system.

On Sat, Mar 26, 2011 at 5:43 PM, arvind arv2...@gmail.com wrote:

 Hi All,

 I have an NDK application(written in C++) packaged as an executable
 and deployed in android. I also have a Java apk file in the
 application layer. Now my NDK app does some processing and outputs a
 string of data in the format name = value. Basically the output from
 NDK looks like this:
 name1 = value1
 name2 = value2... Now i want each of these name value pairs to be
 passed to java application one by one. Currently i am writing the
 output from NDK to a file in sdcard and the java app reads from the
 file. But i want to use an IPC mechanism which is devoid of explicit
 file writing and reading and instead use something like sending and
 listening to a socket. I am not sure what is the best way of passing
 message between native code and java. Also i am not using JNI
 interface as i have some issue with root permissions as the C++ Native
 code runs as root userid and Java apk runs in application level and i
 can't combine both of them. Please give me suggestions on how to
 perform IPC between native code and java apk. I am using android
 developer phone 1 as the device.

 Thanks,
 aravind

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] IPC Mechanism in android

2011-03-28 Thread arvind
Hi All,

I have an NDK application(written in C++) packaged as an executable
and deployed in android. I also have a Java apk file in the
application layer. Now my NDK app does some processing and outputs a
string of data in the format name = value. Basically the output from
NDK looks like this:
name1 = value1
name2 = value2... Now i want each of these name value pairs to be
passed to java application one by one. Currently i am writing the
output from NDK to a file in sdcard and the java app reads from the
file. But i want to use an IPC mechanism which is devoid of explicit
file writing and reading and instead use something like sending and
listening to a socket. I am not sure what is the best way of passing
message between native code and java. Also i am not using JNI
interface as i have some issue with root permissions as the C++ Native
code runs as root userid and Java apk runs in application level and i
can't combine both of them. Please give me suggestions on how to
perform IPC between native code and java apk. I am using android
developer phone 1 as the device.

Thanks,
aravind

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en