About sending structured data between C/C++ and JAVA Code

by mak » Fri, 24 Jul 2009 13:44:53 GMT


Sponsored Links
 Hi All,

I have requirement as below:
1. I have application which creates server, executing it  and
listening on some port on Andorid.  This app is ANDROID Java Service.

2. Client to this Server is written using C/C++ Code. I am able to
communicate with server data as strings, int separately, But I need to
send Structured data packet to Server.

Questions :
1. How Can I send structured data structure between Java and C/C++
Code   ?
2. I am afraid that I can't use JNI Interfaces as both should be
talking to each other on Socket is mandatory for me. So JNI is not
feasible for me. Any other possible way.
3. How about using Serialization on Androdi ? Any inputs on it


Appreciate your input on it.

Regards,
_-_Mayank Rana_-_
--~--~---------~--~----~------------~-------~--~----~

-~----------~----~----~----~------~----~------~--~---



Other Threads

1. Big problem with extra data in intent

Hi,

I want to send RINGER_MODE update to an activity using an alarm
manager and a BroadcastReceiver.

So, in the file which is listening to
"android.media.EXTRA_RINGER_MODE", I have this :

if(intent.getAction().equals("android.media.RINGER_MODE_CHANGED")) {
                                myAudio.setRingerMode(intent.getIntExtra
("android.media.EXTRA_RINGER_MODE", -1));
                                System.out.println("Changement de son: "  + 
Intent.getIntExtra
("android.media.EXTRA_RINGER_MODE", -1));
                                System.out.println("bla : " + getRingerMode());
                                sendRingerModeChangedBroadcast(getRingerMode());
                        }

...

Intent i = new Intent("com.tests.AudioInfo.RINGER_MODE_CHANGED");
                        i.putExtra("myMode", newMode);
                        PendingIntent broadcastSender = 
PendingIntent.getBroadcast(context,
0, i, 0);
                        am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,
SystemClock.elapsedRealtime(), broadcastSender);
                        System.out.println("here: " + i.getIntExtra("myMode", 
55));
...


And then in another file which receives it, I have :

public void onReceive(Context context, Intent intent) {
...
   else if(intent.getAction().equals
("com.tests.AudioInfo.RINGER_MODE_CHANGED")) {
                                int newMode = intent.getIntExtra("myMode", 55);
                                System.out.println("there: " + newMode);
                                System.out.println("Ringer mode changed: " + 
intent.getIntExtra
("myMode", 55));
   }


So in "here:" and "there:" I should have the same value.
It works when this function is called for the first time but after,
"here:" is always followed by the new values whereas "there:" is
followed by the first value.
So the line int newMode = intent.getIntExtra("myMode", 55);  does not
work anymore.

Could you explain to me why?

--~--~---------~--~----~------------~-------~--~----~

2. Interrupted audio playback.

Hello,

the game I am working on uses SoundPool for sound effects and
MediaPlayer for background music playback.
Input happens enirely through the touch screen, with a 20 mS delay
after each processed MotionEvent.
Sometimes (very rarely) it happens that the background music gets
interrupted for a fraction of a second during input.
Do you have any ideas how to ensure MediaPlayer continues audio
playback during touch screen input?

All audio files are in ogg format with various sample and bit rates.
Would it be an advantage if all audio files would share the same
samplerate and/or bitrate?

Do you have any other ideas how to improve audo playback performance?

Any advice is welcome!
Thanks in advance,
Mike.

--~--~---------~--~----~------------~-------~--~----~

3. How to use CursorJoiner to join two table?

4. How to extract ICON from an APK file?

5. How to record the audio from mic in raw pcm format into a buffer, using the native libraries directly?

6. R.drawable.my_icon Missing

7. How to configure the sampling rate/period while audio capture?