Add gcm.jar in Eclipse IDE (Google Cloud Messaging) - android

I have a problem as:
I didn't find where can I get this Jar file gcm.jar? also where Can I put it ?.
Note I used Android 4.1.

Start SDK Manager and scroll down to the section "Extras" and make sure you have installed Google Cloud Messaging for Android Library, if not, install the package.
The package will be installed in the directory "your-android-sdk\extras\google\gcm\"
Client code (for example to be used in Android app):
gcm\gcm-client\
Server code (where the Client connects to and registers it's regId):
gcm\gcm-server\
To add the gcm client-jar (gcm.jar) to your Android-project, copy it to the "libs"-folder in your Eclipse project and right click on the file and select Build Path --> Add to Build Path.

The GCM Helper libraries (gcm.jar) has been deprecated.
The documentation for the library (https://developer.android.com/google/gcm/helper.html)
now displays a messaging stating:
The information in this document has been superseded by GCM Server and GCM Client. Please use the GoogleCloudMessaging API instead of the GCM client helper library. The GCM server helper library is still valid.
Implementing a GCM server is documented here: https://developer.android.com/google/gcm/server.html
Implementing a GCM client is now documented here: developer.android.com/google/gcm/client.html (sorry, can't post as a link because I don't have enough rep).

As on today's date, SDK Manager now has the option to "Show obsolete packages" (Packages->Show obsolete packages). This allows you to install GCM through the SDK Manager itself.

Go to this link
https://dl-ssl.google.com/android/repository/gcm_r03.zip
when download completes extract the zip file, you will get three directories with names client side, server side and samples.
now open your SDK folder and create a folder named "extras/android" and paste all three folders here DONE!!
now whenever make a new project in project classpath using add external jar add gcm.jar.
refer

Just for the Recored: I followed the steps provided by chrkad but I found the .jar file in the DIST folder and NOT in the JAR folder. After I found that out I saw that Peter Gluck postet that before.
I hope that this could save some time to ppl having this issue! (took me 20 minutes)

Seems like this package is now obsolete. In order to see it in SDK Manager I had to check "Show obsolete packages" in the "Packages" menu
See details from answer
https://stackoverflow.com/a/23092848/4255980

Related

Integrate Flurry SDK and plugin for Unity

I want to add Flurry SDK to my project, but I have a question.
If you go to Flurry's GitHub, if you want to use the push function, it tells you to edit "AndroidManifest.
After installing the Firebase SDK, the "AndroidManifest.xml" file is installed. Delete this file and rename the file "Assets/Plugins/Android/AndroidManifest_Flurry-template.xml" provided by Flurry to "AndroidManifest.xml". Guernsey?
Or I want to know if it is necessary to copy and paste only meta-data in "Flurry AndroidManifest_Flurry-template.xml" to "AndroidManifest.xml" installed when installing Firebase.
Thanks.
If you want to do the merge as the docs also mentioned, then you need to remove the Firebase's part. Keeping those parts will introduce push conflict between Flurry Push and Firebase Messaging.
Yes, you can merge your settings in the same file "AndroidManifest.xml" whenever they won't have any conflict.

Unity android plugin for FCM

I'm trying to add Google FCM push notification function to Unity project. I'm surprised that there are no resources about Google FCM for Unity. There are only old Google GCM resources. This is my step-by-step progress below.
Make Android Studio project and register it to a FCM console project
Add google-service.json to '/app' and configure build.gradle (project and module)
Add MyFirebaseInstanceIDService, MyFirebaseMessagingService java classes and onTokenRefresh, sendRegistrationToServer, onMessageReceived, sendNotification methods according to sample example in FCM document
Add services for the classes to AndroidManifest.xml
After that, I tested the Android Studio project on mobile, and FCM console push notification works well. Then, I started to configure the Android Studio project for Unity.
Change 'application' to 'library' in build.gradle (module) and add deleteOldJar, exportJar for AndroidPlugin.jar
Add classes.jar of Unity to Android Studio library and module setting
Remove 'android:icon ...', 'android:theme ...' in AndroidManifest.xml
Export jar and add AndroidPlugin.jar, AndroidManifest.xml to 'Plugins/Android' in Unity
Then, I tested the Unity project on mobile. It is built without exception, but FCM console push notification didn't work. (I made test log for confirming that the Android Studio libray is well plugined for Unity, the log worked well)
Maybe, there are somethings to add to 'Plugins/Android' except AndroidManifest.xml and AndroidPlugin.jar like references below.
Google firebase analytics plugin for unity - StackOverflow
http://joxi.ru/Q2KeQD7C3zdYrj
But, I couldn't find my answer. Please let me know what I have to do or add.
Sorry for bad english and long explanation. Many thanks :)
I used Unity SDK in OneSignal.
It is very simple, easy, and cool SDK for push notification.
Reference link below.
https://onesignal.com/
This approach will not be feasible.
Jar files do not contain resources, and as such, the json file will be missing from the jar build. Alternatively, aar files, which would in theory contain the resources, are interpreted by Unity3D as pure plugin and ignores the resources or at least some, specially when using gradle. But Unity is getting better at it.
Try https://firebase.google.com/docs/unity/setup. It's new and I got the sample project to work already.
Just to add: the new Plugin of Firebase for Unity3D worked liked a charm. Use cases like pure system try notification don't need a single line of additional programming on the client side. Data Messages are very easily implemented as well.

GCMRegistrar cannot be resolved

I'm trying to implement Push Notification. I have a problem with import com.google.android.gcm.GCMRegistrar it cannot be resolved.
I did install Google Play Services and add google-play-services_lib to my projects folder.
But the problem remains. I tried to find gcm.jar as I saw solutions that worked for others, but I don't have this .jar.
Is there something else that I'm missing?
First of all download Google Cloud Messaging for Android Library. For this goto Android SDK Manager->Extras->Google Cloud Messaging for Android Library check and install it.
See the below image:
Now, after downloading this libary you'll see gcm folder is available into path D:\.....\android-sdk\extras\google
Now You'll find gcm.jar into path D:\....\android-sdk\extras\google\gcm\samples\gcm-demo-client\libs.
Now, add this gcm.jar file into your project
GCMRegistrar GCM API is deprecated.It is recommended to refer updated documentation on Google developer Site
Our Google overlords have decried that gcm.jar is deprecated as of Summer 2013 so whatever example code you're working off that requires GCMRegistrar.java is a bit outdated. Of course, just adding gcm.jar works well as stated in the other answers.
If you want to follow Google's commands for whatever reason, CommonsWare has an updated GCM example project that basically just copies the needed classes from gcm.jar and renames them with a 'compat' suffix:
https://github.com/commonsguy/cw-omnibus/tree/master/Push/GCMClient2/src/com/commonsware/android/gcm/client

Deploying SDK Addon component

Based on PlatformLibrary sample code in the SDK, I have created a small hello world library, the eventual goal of the library is to add capability for 3rd part developers to develop for my custom Android image.
I am currently stuck at the point on how to deploy the same so that developers can start using it, I am unable to find any pointers, please help if you have any information.
Ok, I figured out based on for 4.0.3
Create a new sample device, based on the the existing one located at
<SDK-ROOT>/device/sample
build the sdk-addon
<SDK-ROOT>$ . build/envsetup.sh
<SDK-ROOT>$ make -j8 PRODUCT-<your-sdk-addon-name>-sdk_addon
Once the SDK is build you will get the sdk addon archive located at
<SDK-ROOT>/out/host/linux-x86/sdk-addon/<sdkname>.zip
I copied the ZIP to the http server directory, so that it has a link I can refer in Android SDK manager.
Created new SDK XML configuration file and put it in the http server (I used the one located at http://android-sdk-addons.motodevupdate.com/addons.xml for reference)
Went to Android SDK manager, added path to new add on XML created on #5 and OK
Install the new SDK On listed in the android SDK manager, after the installation is done, you can get check the add-ons directory of ur developer SDK to find the add-on.
Also bits and pieces from marakana.com/s/remixing_android,1044/index.html helped.
Looks like you resolved your own issue, but just FYI - to simplify/automate your step #5 above, you can use the mk_sdk_repo_xml.sh script provided under platform/development/build/tools to build the add-on repository.
This is actually used by the phony 'sdk_repo' target (platform/development/build/tools/sdk_repo.mk), so you can take a look to see what the intended usage is. It has the benefit of managing all the packaging/checksum generation etc for you.
Note that it's supposed to provide some automagic behaviour based on the ADDON_SDK_ZIP which is defined by the sdk_addon build task, but that never worked on our customized gingerbread platform, so I ended up putting in an explicit call like this:
$(shell $(TOPDIR)development/build/tools/mk_sdk_repo_xml.sh \
$(TOPDIR)out/host/linux-x86/sdk_addon/addon.xml \
$(TOPDIR)sdk/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-addon-1.xsd \
add-on any $(TOPDIR)out/host/linux-x86/sdk_addon/LIBRARY_NAME-eng-linux-x86.zip:sdk-repo-any-addon-LIBRARY_NAME.zip )
I figured out based on 4.4.2 and Andrdoid Studio 1.4, and it doesn't need put sdk add on xml to web server.
1.Create a new sample device, based on the the existing one located at
<ANDROID-ROOT>/device/<your-sdk-addon-name>
2.build the sdk-addon
<ANDROID-ROOT>$ . build/envsetup.sh
<ANDROID-ROOT>$ make -j8 PRODUCT-<your-sdk-addon-name>-sdk_addon
3.Once the SDK is build you will get the sdk addon archive located at
<ANDROID-ROOT>/out/host/linux-x86/sdk-addon/<sdkname>.zip
4.Extract .zip to
<SDK-ROOT>\add-ons\<your-sdk-addon-name>
5.Copy
<ANDROID-ROOT>\device\<your-sdk-addon-name>\sdk_addon\manifest.ini
to
<SDK-ROOT>\add-ons\<your-sdk-addon-name>
Create new file source.properties to <SDK-ROOT>\add-ons\<your-sdk-addon-name>
Addon.NameId=your-sdk-addon-name
Pkg.Desc=Provides the oem APIs to 3rd party apk developer
Addon.VendorId=your-sdk-addon-vendor-name
Archive.Arch=ANY
Addon.NameDisplay=your-sdk-addon-name
Addon.VendorDisplay=your-sdk-addon-vendor-name
Archive.Os=ANY
Pkg.Revision=1
AndroidVersion.ApiLevel=19
Open SDK Manager, your will see your SDK add on listed
New a Android Studio project, edit build.gradle file:
android {
compileSdkVersion "<your-sdk-addon-vendor-name>:<your-sdk-addon-name>:<sdk-api-level>"
...
}
Build the project, your add on jar will be loaded to External Libraries in Android Studio

How to add javadoc for android to Netbeans

I just started using Net Beans. I am wanting to try my hand at developing android apps. I got the android sdk downloaded and everything is working well. I can create little apps and run them in the emulator. However, the intelisense popup for the android methods says that the Javadoc isn't found. Is there a way to add it?
The best way as below steps in NetBeans 7:
Tools --> Ant Libraries.
New library --> Name it Android.
Classpath --> Add JAR/Folder --> {SDK Folder}\platforms\android-16\android.jar
(in short find android.jar and use it's path, for me I'm using 16 version).
Javadoc --> Add ZIP/Folder --> {SDK Folder}\docs\references
(important note: you may get error in above step, so search will not work. To solve it, copy the file index.html inside [references folder] to a new file and called index-all.html. Then re-add the path in step 4).
Source: Here
Take a look at the Android Sources provided by adt-addons. This eclipse plugin will download all of the sources and attach them automatically.
If you aren't using Eclipse, you can still download the source zips from the jar at http://adt-addons.googlecode.com/svn/trunk/source/com.android.ide.eclipse.source.update/plugins/
Extract the jar file and inside you'll find source zips for each platform revision. Attach these to your IDE.
Otherwise, you can check out the sources manually from git but this is a rather lengthy and arduous process to achieve the above.
You can download various javadocs from
http://www.jarvana.com/jarvana/browse/com/google/android/android/2.3.3/
Just drop the javadocs jar files to android-sdk-{macosx,windows,linux}/docs
Not sure what your setup is like, but the JavaDoc is stored in /docs/reference
For my setup I had to create a zip of that folder and add it as JavaDoc to the Android library.
If you use the nbandroidsupport plugin you can download the javadoc from Android SDK Manager, you can found the package in the latest android's API (in my case Android 5.1.1) the name of package is "Documentation for Android SDK".
Once you have installed the package restart your netbeans. In my case the javadoc is not showing sometimes pressing ctrl+space on the method therefore you can show the javadoc pressing ctrl+shift+space.
Note: this method applies to any API version.

Categories

Resources