OpenFeint with cocos2d-x (iOS and Android) - java

Apparently OpenFeint supports both iOS and Android. Great.
But how do I integrate it with cocos2d-x Android? The SDK is, apparently a .jar and such. Cocos2d-x uses c++.
I don't get this tutorial: http://blog.molioapp.com/2011/11/openfeint-and-admob-integrated-with.html
I copy & paste the code and immediately I get errors (JavaVM *gJavaVM;? There is no identifier called that way!)
Are there any other steps not mentioned in that tutorial I missed?

Yes. In order to build a C++ library for Android you need to use the NDK. Getting that set up is pretty involved so I am just going to link you to a separate tutorial that has already covered it.
http://developer.android.com/sdk/ndk/index.html#installing
That is the Google documentation on getting up and running. There are other resources for this as well if you have trouble.

Related

how similar is the language used for android SDK to java?

is there a point starting with java basisc or should I go for android-based examples and tutorials?
They are basically the same. But, I recommend going with android based examples since android has unique app cycle and app format.
Android SDK is build in and using Java.
They are for all intents and purposes the same.
However Android is coded using it's own specific library methods and syntax, hence it's a better idea to skip directly to Android. Knowing Java makes it easier but is not a necessity to code in Android.
You will require the JDK since it does need Java to run.

Using existing java code in Android Studio or eclipse

I am developing a word game. My aim is to have 90% of the code in pure Java, which is then referenced by Android Studio for an android app, by GWT to make a web solution and exported into objective C for iOS for the small amount of UI coding needed.
I have written all the code and I am only able to do this by manually copying the java classes between the projects. Clearly it must be possible as this seems such an obvious use case, but there does not seem to be a straightforward solution.
I realise I may be missing something. I have searched extensively, in particular the following:
Import source java project in Android project
Android studio add external project to build.gradle
Any help would be much appreciated.

Python for Android Apps

I've learnt python recently and I want to make an app for android. But everywhere on the net, it seems Java and Eclipse are the only ones that can be used.
So, my question is:
1) Can I use python to make an android app?
2) What kind of platform should I use to make an app with python?
Thanks guys!
If you're just looking to run Python scripts, try QPython.
If you're looking to make your Python code run like a native app, or just something more robust than the above, try SL4A.
If you're looking to effectively use Python as a library, and compile an .apk with the Python library included, try Kivy: github.com/kivy/python-for-android.
That said, you'd likely get a lot of benefit from learning Java, and not just for programming natively in Android (which would give you access to a much wider feature set and make your app run more efficiently).
Check out the Scripting Layer For Android, aka SL4A.
Here is a blog for getting started. The blog promises more entries in the series but there don't seem to be any. Still, it is a great starting point. There's quite a few parts to pull together so be patient and check the bottom of that blog entry for dozens of useful links.
If you want to contain everything to the Android device, including the IDE (pretty slick), check this out.
Here's a book from APress that could help with more advanced concepts: Pro Android Python with SL4A

Porting C code to Android

I am at the very start of a project where we are trying to write an application for an android smartphone that will call a shared library written in C.
It seems that the way to do this is to use the Android NDK to build the library in a binary format compatible with the smartphone hardware then use JNI to call the shared library from Java. Possibly using SWIG along the way to facilitate with the JNI wrapper functions.
But before I go down this route, am I missing any, potentially much simpler, approaches to getting a C app to run on a smartphone? What got me thinking that there may be other alternatives was the Canonical project looking to run ubuntu on a smartphone (http://www.ubuntu.com/devices/android) but it doesn't seem to be available yet.
Any lateral thoughts on this topic gratefully received
As far as I know, the NDK is the preferred route to follow when using native code in android. You can also build a java wrapper library around your C code, separate from your Android project, and include that .jar in your Android app. This uses standard Java instead of Google's NDK, and I have used several libraries built in this manner in android with very little effort.

Resources for Android absolute beginner

I am a complete Android and C in general noob,
I have done a lot of web programming (which I am imagining is largely irrelevant here), some javascript (not jQuery just raw JS), I have also developed a .net app and done a course in java programming at uni last semester,
I know that Android uses Java in some places and C in others, I have looked at the SDK documentation here: http://developer.android.com/guide/topics/appwidgets/index.html
My aim is to build a simple dashboard widget that pulls data on a minute-by-minute basis from a JSON/JSONP API, I have thus far struggled to find any decent tutorials for real Android noobs such as myself, especially in the app widget category, If anyone knows of any good resources (online or books are fine) consisting of basic good practises, start-up guides and quick tutorials to get me up to speed would be great as I have absolutely no idea where to start (especially in the C end of things), I have found the SDK documentation does have some good stuff but it isn't exactly what I am after (built on very old builds of Android and thus most of the cool new features aren't integrated or taken into account).
Any recommendations would be very much appreciated!
On a side note, If all goes well with Android I would also be looking to move onto iOS so Objective-C start-up and tutorials would be great (Visual Quick Pro guide style would be perfect!)
I personally started reading and understanding the Android Application Fundamentals. Then I downloaded the Android ADT (Development Toolkit), configured it on Eclipse as well as the SDK (including samples).
Once that's set up, I started with the ApiDemos. You find its source code directly in the downloaded SDK <sdk-install-location>/samples/android-9/ApiDemos. Try to debug the code in the IDE, modify it and see how it reacts.
Finally, have fun :)
Well, I started with the Android developer documentation:
http://developer.android.com/guide/index.html
If that isn't as organized as you'd like for a complete beginner, you might want to try the FAQ since they have a lot of good tutorial links there, which happen to be very thorough:
http://developer.android.com/resources/faq/index.html
Once you get the basics, which the tutorials will do for you, the first link to the developer guide will be where you'll spend most of your time. There are even links in the guide for getting started with your IDE of choice, or getting started using no IDE at all.
To get a more specific answer, you'll have to ask a more specific question.

Categories