How to use bindings with RoboVM and LibGDX? - android

I want to add adMob and Google Play Game Services to my app for iOS and android. I know I can do this using bindings. I have been searching online and that is what I have found. However, being new to programming, I cannot find a clear cut tutorial on how to use this, I do not know what a binding is nor how to install RoboVM or what it is. Would anyone be able to help me out on how to use RoboVM to accomplish this with simple and easy to follow steps.

RoboVM is deprecated in favor of RoboPods.
https://github.com/robovm/robovm-robopods/tree/master
Follow the instructions on the site, just add the line of code for the jar you want to include. Add the link under iOS section of your build.gradle located in your project directory.
Then just refresh Gradle. For eclipse, right click project, gradle>refresh all. You now have the jar in your Gradle Dependencies. Now you're just missing the code to show Admob ads and Google Play Game Services.

Related

Is it better to upload an android library to GitHub than keeping it inside the project?

I'm really new with android developing. But I know how to upload a library to GitHub and include it in an android project. Recently, I'm working on some android apps, and I realized that I need to use some layouts and classes for all the apps. So, I created an android library and kept that inside all the project files. Then I came to know that I can simply upload that library to GitHub and use it for all the projects. But I'm not sure if it's a good idea. Is there any advantage if I upload it to GitHub?
In general, using a source control (git or other ones) is always a good idea given that your local filesystem can crash or you may want to revisit certain revisions you made to your project. Github is very popular and hosts several highly used projects, so it is no doubt a good place to upload. However, you must know that if you don't have their paid account, the project will be public (at this time, free accounts don't have a way to create private projects). Are you developing as hobby and do you mind if others see / take the code and reuse (hopefully under the licensing terms you specify)? Or is that something you're doing for an employer? In that case you should consult with the employer if this is OK.
Now as for sharing this module across projects, I don't think github has a secret sauce here. You could always build your library once and drop it in as dependency into all your apps, without having to copy its source code into each project. You may also want to look into integration with maven / gradle build systems, which Android Studio uses. For example, third party libraries often are available as downloadable libraries from maven central, and you can add a couple of lines to your build.gradle to go fetch a specific version of your library from maven central, rather than manually adding that library jar to the project that is using it. If your library code is on github, there are ways to publish to maven central from github ( http://datumedge.blogspot.com/2012/05/publishing-from-github-to-maven-central.html ) but I don't have experience with that step.

Add library dependency for my SDK in Xamarin

I have SDK (.jar file) written in Java. I created an Android Java Bindings Library following that description. I used the generated JNI files from the jar to write the API for my Xamarin plugin. I dont have experience with Xamarin, so I would like to ask you these questions:
My SDK.jar file depends on the Google Play Services.jar file. How and where I have to add it? I want to make the plugin to add the Google Play Services automatically to the project where it's installed my plugin. Like Google Play Services plugin adds Support library when it's added.
Could someone explain to me what's the difference between Components and Packages? I have these folders and I dont know in which one I have to add the Google Play Services Plugin and what's the difference.
How to get the current activity from my API files? I dont use Xamarin.Forms. Should I?
Thanks in advance
To clarify:
Answer for 2:
Components are Xamarin Components whereby packages are mostly nuget packages. User is not forced to publish component on Xamarin Component store, but many do. Some don't because Xamarin Component must have accompanying samples, documentation and screenshots, so for the large number of users effort to implement component is substantial. That is the reason a lot of authors just publish their SDKs on nuget.
Xamarin Components are tested before publishing by Xamarin Components Team and the reason is mainly correctness and quality (something like Apple's app submission process). This should help users to have minimal/starter samples that show how the SDK/component work and some documentation.
Some authors publish their components in steps: first nuget and when samples and docs are ready then Xamarin Component which references nuget dependencies mentioned in 1st step. This is called empty-shell (or just shell component). User can install it either as nuget or as component into some application or library.
Packages (nuget) are installed via Nuget Package Manager in Visual Studio or Xamarin studio. While components are added to you project. Samples and docs can be found in Components/ folder in solution root.
Plugins are special form of component used mostly for cross platform Xamarin.Forms (but not only) applications and they utilize special technique called bait-and-switch for loading platform specific dlls (from nugets).
Google Play Services (GPS) are not plugins, because they are Android only, so no need for plugin (ios and Windows parts). I think there is only Game Service on iOS, but not sure.
GPS come in 2 flavors as nuget packages and as components (empty shell).
Here are the answers of my 2 questions:
in component.yaml file before publishing the plugin: http://developer.xamarin.com/guides/cross-platform/advanced/submitting_components/components_and_nuget/
Don't have the answer yet...
Can't get it from API files if you dont send it as a parameter, but then your API is not compatible with the iOS API. Because of this I separated the plugin: one for Android and another for iOS.

Mobile Backend Starter Java - on Android Studio

Has anyone managed to extend "Mobile Backend Starter Java" on Android Studio
https://github.com/GoogleCloudPlatform/solutions-mobile-backend-starter-java
Frustratingly any documentation that exists seems out of date or only for Eclipse".
I want to use Gradle and not Maven , Android Studio and not Eclipse
I followed the Tutorial
https://developers.google.com/cloud/samples/mbs/
but the extend page left me confused
https://developers.google.com/cloud/samples/mbs/extend_backend
I would like to know if anyone has tried this
I thought about going from the other direction creating an app and then Google Cloud Tools and App Engine Backend with Google Cloud Messaging but I do not see a deploy , I did see this, Deploy Google App Engine backend from Android Studio
but have not tried yet
There is a project on GitHub which you can use as module. It provides you with the basic client libraries. You can use it as starting point. See https://github.com/thagikura/mobile-backend-starter-android-client-with-AndroidStudio and follow the instructions there.

should I check in the Google Play services library project to source version control for GCM support?

I already added the support for GCM at our android app, however one thing bothers me is about the Google Play services library project. Based on this link Set Up Google Play Services SDK, I should do the following at step 4:
Make a copy of the Google Play services library project.
If you are using Eclipse, import the library project into your workspace. Click File > Import, select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it.
We are using eclipse. So to allow other developer to build our app project without doing any manual work, I checked in the Google Play services library project into our version control (SVN) and add that project as part of our app project.
However I am not sure whether I should check that project into our source version control or not. One thing I also found out that google-play-services_lib.jar file is modified today, however I didn't do anything to that jar and I don't have any idea how it got updated. Should I check in the new version of the jar file? Again this still goes back to whether I should check in the Google Play services library project in the first place.
Could someone with GCM experience shed some lights what's the best approach here?
Update 1 at Jan 16:
Per the answer below, we could add a Google play services jar file to our app project, however based on this link, Implementing GCM Client, it has the following:
Caution: When you add the Play Services library to your project, be sure to add it with resources, as described in Setup Google Play Services SDK. The key point is that you must reference the library—simply adding a .jar file to your Eclipse project will not work. You must follow the directions for referencing a library, or your app won't be able to access the library's resources, and it won't run properly
So that would means that we could not just simple add the jar file.
Your library compiles first whenever you compile your application, as library projects create jar your Google Play Services jar will be updated on every run.
As the library incluse resources you cant create the jar and add them in to your java build path there two possible ways to get rid of this :
Move to Android Studio which uses .aar files which contains all your andorid resources in archive. Read more from refrence.
Prevent libray project to compile each and every time you run the app in eclipse. Click Here to know how to do that.

Check-in Android project having dependencies to SVN

I have added google play services lib as a dependent library to my Android project as shown.
I need to checkin the code to SVN . Do i need to checkin the google play services project as well? Or Is there any way i can package the google play services project along with my Android project?
Any help will be appreciated.
The Google Play Services should be used as an Android Library Project. So you shouldn't pack it in any way. Usually I don't like committing external libraries in the versioning control system, and I prefer letting everybody clone and import the library projects locally. You could though add the library project into a different folder, and commit it to your source control if you find it more convenient.
Another alternative would be to use Maven for dependency management.

Categories

Resources