How to get libcap (Linux capabilities library) for Android? - android

Are the Linux capabilities (libcap.so) library available for use with Android? If not, how can I compile it?
I would like to use the capabilities-related API in sys/capabilities.h, which is included with the NDK. But when I try to call functions like cap_get_proc(), I get "undefined reference" error.

I would imagine that using this api would go way, way beyond the contract in the Android framework. It might work on some devices, but not on others.
In fact, there's no guarantee, afaik, that Android even runs under Linux. For example, the new Blackberry devices run Blackberry's proprietary OS, but still run Android apps.
Finally, the version of Linux that most Android devices run is a highly-stripped-down version. They didn't include any features that the Android API doesn't need. If Android doesn't need libcap, then it's probably not included.
Perhaps you could tell us exactly what it is you're trying to do.

Here is the link - https://github.com/scopichmu/libcap-for-Android. This is original libcap (was cloned from https://kernel.googlesource.com/pub/scm/linux/kernel/git/morgan/libcap) with supporting of android ndk build. You can build now libcap.so, setcap and getcap for android.

Lots of discussion out there on this topic... google around a bit:
http://permalink.gmane.org/gmane.comp.handhelds.android.ndk/4075

Here someone compiled it and described:
http://blog.umitproject.org/2011/05/libpcap-for-android.html

Related

Using cUrl with android on devices with different architectures

I would like to use native library cUrl in my android project, but i'm afraid that there could be problems with different architectures.
I'm new to NDK, so it would be great, if you'll help me with that question.
Thanks in advance
If you are going to include a native library in your Android application, you need to build it for all possible architectures like arm, x86. If you don't your application won't work on devices that you don't provide builds for and also they won't be visible in Google Play for those devices. However within those architecture builds you are safe.
Android NDK provides all the necessary support to get you covered in this scenario, so you should start from reading there.

Port .NET dll to different platforms

I have a dll based on .NET 2.0 with full source code access.
So I can build it in VS2010.
I need to port this to Android/iOS/MacOS.
As a result I expect some equivalent of dll for each platform.
So another programmer can link (doesn't matter how) this equivalent to his own project at one of that targeted platform.
For example I ran MonoDevelop on Mac and don't see how I can build my .NET project and to receive such equivalent of dll.
So I need help to find solution and understand what to do to receive requierd result.
There are CLI implementations, primarily Mono, that work on both iOS and droid. The simplest tools here are MonoTouch and Mono for Android, both available from Xamarin. With these tools, you can build and test your dll targetting the relevant frameworks. Another programmer, again using the MonoTouch or Mono for Android tools, can reference those dlls, and build their application, with all the tools necessary to package and deploy (side-loading or via, say, the device's store) an application using that library. This deployment will typically also include all the runtime/framework pieces needed by the application.
MonoTouch makes use of the MonoDevelop IDE, so will be familiar to you as a MonoDevelop user. Mono for Android can do that (i.e. be hosted inside MonoDevelop), but can also be used inside Visual Studio.
Running .NET code requires a .NET runtime to be installed. Neither Android nor iOS devices come with such a runtime preinstalled.
In theory, you could install the Mono Runtime (a open-source .NET alternative) on an Android device or a jailbroken iPhone/iPad. However, as I understand it, you're looking for a way to create a library to give developers, so this isn't a good solution.
However, what could work is creating a library with MonoTouch. MonoTouch compiles your .NET code to a binary that iOS devices can use - regardless if they're jailbroken or not, without needing a runtime installed.
If you follow best practices, you might port your library successfully, such as
http://sharpsnmplib.codeplex.com/discussions/390251
However, it purely depends on the characteristics of your library, which you does not mention yet.

Developing native C applications android without the NDK?

OK this is a strange one:
Is there a way someone can develop native C applications or libraries for Android without using the Android NDK?
What was happening before the NDK was released?
(It's not there for too long, I think it was released only one or two years ago).
Apparently, you can -- a friend of mine is a real Android guru and he managed to build a GCC-based native toolchain entirely by hand. He also fixed some missing parts in Android's libc. The main idea is the following: GCC has builtin support for the arm-elf-linux target, so with an appropriate build script, you can configure it to build for Android. However, you have to root the phone to run the resulting binaries. One even cooler thing is that because GCC is a self-hosting compiler, with the arm-linux-elf toolchain, you can recompile GCC once again and have the toolchain on the phone itself.
Before the NDK was released, the only officially supported way of developing Android applications was to use the Android SDK and writing your applications in Java.
As others have mentioned, it's possible to cross-compile some applications as completely stand-alone and run them on a rooted phone. The downsides of this should be obvious: very few people will be able to run your application (they also need to be root, plus you won't be able to get your application up on the Play store); and you might even run into compatibility problems yourself across different devices e.g. if you rely on dynamic linking against various libraries (which you might need to do in order to keep the size of the binary down).
TL;DR: it's possible, but severly limited, and not recommended.
You can compile your C code with an Android-compatible toolchain (such as CodeSourcery) and run it on a non-rooted phone, from its command line (for example through an SSH connection like SSHDroid).

using java packages not listed in Android API

I'm new to Android development and I wonder if I can use some Java packages (for instance javax.xml.bind, org.springframework or org.jooq) on Android platform despite the fact they are not listed on packages list of Android API. Is it possible when I simply import them as external JARs? At this moment I don't care if they are big, just if they can work on Android.
Thanks for help.
It Depends.
Android is built on a subset of Java 1.6. If the library uses references to classes that Android doesn't have, I believe the ADT plugin will give you an error about system level libraries WON'T work on Android. Something to that effect.
I wouldn't recommend it. The guys at Android included libraries that they knew worked with their system (and probably modified them).
Just importing a Java library that isn't part of the Android API and isn't written specifically for Android probably won't end well.
There are a lot of differences between mobile and Desktop computing.
As recommended by TeamMCS, try to import your librairies in your Android project. That's what we done with a SOAP client library and we saw that it depends on other Java librairies; librairies that are present in the standard JRE (i.e. Sun JRE on computer) but not provided with the Android OS.

How to create Android apps using Delphi

I have been asked to research on how to make an android app using Delphi, Now I am not sure that this can be done. I have not come across tutorials on the same. Somebody please clarify on this issue.
Delphi cannot create Android apps at present. This is being worked on for a future release.
Update: As of the release of XE5, Delphi now supports Android development for certain ARM hardware using the mobile Delphi compiler.
Free Pascal is now able to produce code for the Java platform - so it might be feasible to create Delphi code which can be compiled to Java bytecode with FPC and then converted for the Dalvik VM.
The FPC backend for the Java Virtual Machine (JVM) generates Java byte
code that conforms to the specifications of the JDK 1.5 (and later).
While not all FPC language features work when targeting the JVM, most
do (or will in the future) and we have done our best to introduce as
few differences as possible.
This FPC JVM backend is not related to Project Cooper by RemObjects,
nor does FPC now support the Oxygene language.
Two choices to follow at present - check out Delphi for Android which is in design/beta phase: http://lenniedevilliers.blogspot.com/
Or, use Prism http://www.embarcadero.com/products/prism (and check out their Oxygen for Java coming soon http://www.remobjects.com/oxygene/java.aspx which is in Beta)
With DWS as backend script compiler and the soon to come Smart Mobile Studio (aka OP4JS) component library and RAD interface it will be possible to make apps running with HTML5 in android applications (and iOS or any other html5 compatible system).
By using object pascal, all Delphi and freepascal users will have a short learning curve and a high code reuse factor.
There are some samples using only the DWS backend here :
taming-the-flock-with-object-pascal
taming-html5-verlets-with-object-pascal
Update :
More samples can now be found on their homepage.
First steps with native Android applications made with Lazarus/FPC are here.
One way is to use a combination of Delphi, Sencha and PhoneGap by leveraging the Raudus framework. You can try the RaudusEmployee.apk example on your phone and see if this method will work for you.
http://www.raudus.com/samples/
This is not a native application, but similar to many new HTML5 applications.
Delphi XE5 is now released with Android support.
http://www.embarcadero.com/products/rad-studio/create-android-apps

Categories

Resources