Customizing android NuPlayer for inclusion in Android app - android

Question:
What is the suggested way to customize native components of Android for inclusion in an Android app? By "native components" I mean components for which the native source code is available in AOSP - but which use API's not exposed in the NDK documentation.
Details:
I want to use a simplified version of the Android media framework (actually, all I need is the NuPlayer to play an RTSP stream for my app). I know this sort of customization involves using the native code (frameworks/base/media) from AOSP, modifying what I need; and building this to generate the .so file as per my needs. I then do a System.loadLibrary() plus JNI.
My question is - what is the suggested way to do this?
I cannot use the NDK (rather, I am not supposed to use NDK) since many of the API's used in the media framework are not exposed to the NDK. But then, how do I build my modified media framework code? I do see Android.mk files in there. What do I use to build these?

Your question is self-contradictory: you want to customize native components of Android, without use the NDK. NDK stands for Native Development Kit: I have heard no one developing native components without using Native Development tools. And the NDK is the easiest one to use...
IMHO, your real problem lies in this statement: I cannot use the NDK (rather, I am not supposed to use NDK). Here I ask: why?

Related

Android: What is the difference between SDK and library project

For applications like facebook, they provide SDK . I have used many third party libraries for different requirements. What is the difference between both the cases . That is the code bundled as library or as sdk
A Library is a chunk of code that you can call from your own code, to help you do things more quickly/easily. For example, a Bitmap Processing library will provide facilities for loading and manipulating bitmap images, saving you having to write all that code for yourself.
An SDK (software development kit) is a library (often with extra tool applications, data files and sample code) that aid you in developing code that uses a particular system (e.g. extension code for using features of an operating system (Windows SDK), drawing 3D graphics via a particular system (DirectX SDK), writing add-ins to extend other applications (Office SDK), or writing code to make a device like an Arduino or a mobile phone do what you want)
From this thread
Android SDK -> is the core features and software tools that allow you to create an app for the Android Platform. An SDK contains lots of libraries and tools which you will use to develop your application.
A Library -> is a collection of pre-built compiled code which you can use to extend your application's features. For example, you may need to show some graphics in your application. Instead of creating this from scratch, you may choose to use a pre-built library someone else has developed which will give you the features you need thus saving you some time.
Thanks to Nithish for this explanations
SDK is software development kit which provides a platform/a way to develop software while library project is a project which have some lines of code to solve any desire problem, it may have design or code files.
Generally library project focus only one problem but SDK is complete kit/tool to develop any task, if want some functionality in your code which is not present in SDK than we will go for any library project.
SDK is so that you can build applications for FaceBook. SDK can usually only be used in a more specific context. A library is so that you can take the library and use it on your own applications. A library is meant to be portable.
You can obviously use code from anywhere to anywhere, but I think thats the main difference.

I have sdk. Is ndk neccesarry for eclipse

I have eclipse Kepler and I am having "Android-Sdk-Windows" files. But I cannot able to make an android project in eclipse.. Do i need NDK necessary.
I already have experience with opening project with just "sdk" and eclipse.. But this times How can i enter the "sdk" path instead of "ndk".
Or Teach me what is "sdk" and "ndk"
i tried eclipse->preference->android-> But i can only see NDK location.
Native methods are platform-specific code. They are usually written in languages such as C or C++ and contained in libraries(dll's). It is possible to create a hybrid Java application that benefits from such libraries.
Reasons for Using Native Methods
Gaining access to special capabilities of your device or or Android
OS
Gaining extra speed
Gaining access to a large body of existing legacy code
Typically, good use cases for the NDK are CPU-intensive applications such as game engines, signal processing, and physics simulation
The major disadvantage of native methods is that you won't have cross-platform capability.
What is Android NDK
The Android NDK is a companion tool to the Android SDK that lets
you build performance-critical portions of your apps in native code.
It provides headers and libraries that allow you to build activities,
handle user input, use hardware sensors, access application resources,
and more, when programming in C or C++. If you write native code, your
applications are still packaged into an .apk file and they still run
inside of a virtual machine on the device. The fundamental Android
application model does not change.
Now if you don't know what native code is, then probably you don't need to use native code. Android NDK documentation explains this well:
..., you should understand that the NDK will not benefit most apps. As
a developer, you need to balance its benefits against its drawbacks.
Notably, using native code on Android generally does not result in a
noticable performance improvement, but it always increases your app
complexity. In general, you should only use the NDK if it is essential
to your app—never because you simply prefer to program in C/C++. When
examining whether or not you should develop in native code, think
about your requirements and see if the Android framework APIs provide
the functionality that you need.
Yo do not need the ndk, in order to build an android project. If you are having difficulties with eclipse, I would suggest using Android Studio unless you are dead set on eclipse. I use both, and strongly prefer to use Android Studio whenever I can.
If you decide to stay with eclipse, it is as easy as downloading the ADT plugin by putting the url in the input box under Help->Install New Software, launching and downloading the sdk from the Android sdk manager, restarting eclipse, and then starting a new Android project. Hopefully you do not have to do anything to configure java or anything else.
The ndk is a way of accessing things from a lower level, in order to bypass certain things, or squeeze more performance out of a phone for highly intense operations, or finally to be able to port c/c++ code from different project. i.e. You can write a Opengl ES game in c and reuse most the code for web, ios, and android this way. But that goes beyond the scope of the question, and this answer.
Firstly you should ensure you have installed ADT plugin .

Is it possible to compile a Xamarin project as a library for iOS and Android?

I need to create an API library for Android and iOS. I have experience working with Android projects, but zero experties in iOS. I was wondering if I could create a Project library in Xamarin that compiles as a JAR for Android and as an... I-don't-know-which-type for iOS.
No, that isn't possible. Depending on what you are trying to accomplish there may be alternatives. If you are trying to make a library that can be used by others you could make it a Xamarin component - there is a component store you could put it on if you want it to be generally available, otherwise you can use any normal means of source or object distribution.
If you need to interact with a native app/library then you could make the C# code the "owner" of it and have it call into the native code. This works for both IOs and Android (and is used to work with e.g the play services from google).
No, it is unfortunately not possible to do that.
It seems to me that what you need is a Portable Class Library also known as PCL. It allows you to create a project which can be referenced by all Xamarin supported platforms (such as iOs and Android). There are obviously limitations to the approach like not being able to reference platform specific libraries but in your case (of writing an API) it should suffice.
You can read more in this link
Good Luck!

C++ library for mobile application

I have my own C++ library with source code. It contains functions like this: CreateDvice, FillDevice, CloseDevice and etc. There is no dependency to any third-party libraries.
There is requirement to create application for mobile platform:
Blackberry
iPhone
Android
The application has to use logic provided by this library.
Is there chance to use existing library in mobile application or at least some of them?
Or does it require to re-implement library code for each platform?
For iOS (iPhone/iPad) you can directly compile your library and use it from a regular iOS app written in Objective-C++ and/or C++.
For Android you can directly compile your library using the NDK, then either write your app in Java and call your library via JNI, or write the whole app in C++ using the NDK.
I believe you are out of luck on Blackberry, for this platform you'll need to rewrite your library in Java, as neither apps or libs can be written in C++.
Edit: See my other answer for a completely different approach that may work for you.
Blackberry:
It's technically possible to have ASM on BlackBerry (or Android, iPhone, etc.) but 3rd-party developers are often not allowed (or not able in the case of BlackBerry) to do so.
iPhone:
Absolutely. You can statically link a C++ library. Of course it will have to be compiled with the right instruction set. There are a host of examples out there on how to do this. Translate - you will need the code.
Android:
Absolutely. There is a good book on this by Mark Murphy. Introductory material here:
http://www.androidguys.com/2009/10/14/android-beyond-java-part-one/
Your question is unclear. Do you need a cross-platform library/engine to create a mobile application?
If it is so, Cocos2D would be the best choice. Originally it's a game engine, but it is suitable for applications too. And it supports all the platforms written above.
Instead of compiling your C++ library on each target device that you intend to support, you could opt for creating a service that packs your library. You can install this library on a host you have control, then from each platform the only thing you need to do is invoke this service.
I'm not sure if this thing makes sense for the kind of library that you have, but this would be a way to maintain a single version of your library, and you'll have a guaranteed same behavior on all devices.
Good luck.
Android is not natively Java, it's natively C++. And iOS is also natively C++. So why not just leave the C++ code untouched and drop RIM's current platform (since they are switching to BBX which does support C++ as well).
For Blackberry you can use the C++/Qt Cascades; for iOS you can use C/C++ & Objective-C (a superset of C) and Android can use the C++ NDK. You can use Java on all platforms as long as the Java apps are standalone and the JRE is pre-packaged with the app (iOS). You can interface with C/C++ libs using JNI
If you want to use a Java library on all platforms, that would work.
Android and Blackberry are natively Java.
You can use a tool called XMLVM to cross-compile your Java library to Objective C for use on iOS.
http://xmlvm.org/overview/
It is not 100% perfect, but pretty darn close. We use it extensively to port common Java library code to iOS. Port the C++ library to Java and you are good to go.

JNI tech. on Android or Linux platform when development ,so?

I face a problem while developing a native C/C++ shared library for Android platform. As we all know that Android use Java language for the upper layer development. Now I have ported my Engine code using ASCII C/C++ to Android using its bionic library, yet when need to design the User Interface, I have to use the JNI to call my engine code.
As far as I know, that is the only choice. The problem is my engine own hundreds of export APIs. If I use the JNI tech. I need to wrap these APIs to a new shared library for use, which will cost a lot of time for development and testing.
Can somebody give some suggestions for this situation? I am not familiar with java or JNI tech by the way.
TIPS:
When I searched the internet, I found some open source for JNI generator such as JNative etc. Until now I do not know is it suitable for Android platform or not.
You can easily use SWIG www.swig.org which will generate the JNI bindings for you.
there is nothing android-specific in that operation, so it will work rather out-of-the-box.

Categories

Resources