When your run your binary, you run it as "adb" user. This one is normally in group of few groups granted of permissions. (It may depends on the device however). So when you launch a binary it runs with the permission of adb user. So it doesn't necessarily have correct permission. When an apk run, it run in a sandboxed environement as a generated user. This user is associated to group granted of permission requested in the manifest. That's why, when the binary run from the apk context (and so as the sandboxed user), it will be granted with correct permissions. So it's not really a matter of your program. It's a matter of the user running it. If user doesn't have rights (adb user), it will produce problems at runtime when trying to use something with restricted permissions. If user has good rights (granted by android thanks to the apk manifest), the same program will work properly because will have rights to use things with restricted permissions. Best regards, R?gis 2012/9/5 Saeed Abbassi <saeed144 at gmail.com> > Thanks R?gis > > I simply meant compiling a c/cpp program using android-ndk and running it > on an Android device, > I knew about permissions in an java/apk developing environment, and > totally agree with you about the proper approach Google is taking on this, > > what I didn't know was that how these permission could affect C programs > running on a (non-root) android phone, (yes on linux in fact), > > I should search more, > Thanks for your comment, > Saeed > > 2012/9/5 R?gis Montoya <r3gis.3r at gmail.com> > >> I don't get what you call a "NDK application". >> The way to deploy android application is through apk files with manifest. >> Running a binary as adb user is not really an android application but a >> linux binary running this particular linux, but not an application for the >> top operating system. >> >> So, you have to specify in the manifest of your application the >> permission required to run the application. Then your application can >> contains a native binary/library but will always have a Manifest file to >> produce the apk that can be installed and deployed. >> >> When the apk file is installed it asks the user if he accepts this app to >> use these permissions. >> Once installed, the apk will run in a sandboxed env that is granted with >> permissions requested by the manifest of the apk. >> It's about security and to avoid an app to do unwanted things. It's based >> behind on users permissions and sandboxed env. But all you have to know to >> begin is that an android application is an apk that have a manifest in >> which you must request for needed permissions. >> Instead of a crappy security approach based on the fact nobody can >> publish if not validated by the phone manufacturer, Android approach is >> based on unix permissions and make the platform security more robust and >> safer for users that care about permissions they grant to apps. >> >> Also, if you want to use rtp stream don't forget to get the network >> permission too. >> >> BTW, about permission a page you might want to read : >> http://code.google.com/p/csipsimple/wiki/PermissionsUse . It list >> permissions required by CSipSimple and why each is requested. >> You might have a subset of these permission in your app to get pjsip part >> working properly on android. You can also have a look to android docs to >> get all permissions possible. >> >> >> 2012/9/5 Saeed Abbassi <saeed144 at gmail.com> >> >>> I found it, >>> it actually is stated in the code, >>> >>> pjmedia/src/pjmedia-audiodev/opensl_dev.c >>> 628 /* Create audio recorder >>> 629 * (requires the RECORD_AUDIO permission) >>> 630 */ >>> >>> >>> My device did not have root permission, (I'm running pure NDK without >>> SDK, so I cannot pass the permission to the application.) >>> With the emulator, the streamutil do not crash at all. >>> >>> I gonna use this rtp streamer in a java wrapper, and pass the permission >>> to it, >>> >>> yet the another question arises, >>> what happens if I don't have a java wrapper and need such permission in >>> my NDK application? >>> >>> May be I should be asking in some other forum. >>> >>> Good luck to all, >>> Saeed >>> >>> >>> ---------- Forwarded message ---------- >>> From: Saeed Abbassi <saeed144@xxxxxxxxx> >>> Date: 2012/9/5 >>> Subject: Streamutil application on Android >>> To: pjsip at lists.pjsip.org >>> >>> >>> Dear all, >>> >>> In trying to compile and run PJSIP on Android, I have tested streamutil >>> of >>> ./pjsip-apps/bin/samples/arm-unknown-linux-androideabi/streamutil >>> >>> cross-compiled in linux (using ndk-8) and run on Motorola Defy+ >>> >>> This test application works OK in send-only mode, >>> >>> [./streamutil --local-port=4000 --remote=192.168.0.200:4000--play-file=test1.wav --send-only >>> ] >>> >>> but in --recv-only it crashes with the following log >>> >>> [ 13:42:49.525 os_core_unix.c !pjlib 2.0-svn for POSIX initialized >>> 13:42:49.527 opensl_dev.c OpenSL sound library initialized >>> 13:42:49.527 pjlib select() I/O Queue created (0xe04d4) >>> 13:42:49.529 strm0xe548c VAD temporarily disabled >>> 13:42:49.529 rtp.c pjmedia_rtp_session_init: ses=0xecfdc, >>> default_pt=0, ssrc=0x146630ef >>> 13:42:49.529 rtp.c pjmedia_rtp_session_init: ses=0xed5f0, >>> default_pt=0, ssrc=0x146630ef >>> 13:42:49.529 stream.c Stream strm0xe548c created >>> 13:42:49.529 opensl_dev.c Creating OpenSL stream >>> 13:42:49.551 opensl_dev.c Recording stream type 1, SDK : 10 >>> 13:42:49.553 opensl_dev.c Cannot realize recorder : 9 >>> 13:42:49.553 opensl_dev.c Stopping stream >>> 13:42:49.553 opensl_dev.c OpenSL stream stopped >>> 13:42:49.553 opensl_dev.c OpenSL stream destroyed >>> [1] + Stopped (signal) ./streamutil >>> ] >>> >>> What am I doing wrong? >>> >>> It also does not work in send-recv or in send-only and without given >>> wave file. >>> >>> Thanks for your attention >>> and bravo for the great project, >>> >>> Saeed >>> >>> >>> _______________________________________________ >>> Visit our blog: http://blog.pjsip.org >>> >>> pjsip mailing list >>> pjsip at lists.pjsip.org >>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >>> >>> >> >> _______________________________________________ >> Visit our blog: http://blog.pjsip.org >> >> pjsip mailing list >> pjsip at lists.pjsip.org >> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >> >> > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip at lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20120905/d138c06d/attachment-0001.html>