I am building fresh new project for Android with using C2DM. I cannot use
import com.google.android.c2dm.C2DMessaging;
because I haven't added c2dm.jar file as a external library. Is it somewhere available for download?
Thanks
I am building fresh new project for Android with using C2DM. I cannot use
import com.google.android.c2dm.C2DMessaging;
because I haven't added c2dm.jar file as a external library. Is it somewhere available for download?
Thanks
I like to use the code provided by Google. You can get it via the Google Eclipse plugin, see https://stackoverflow.com/a/9228455/734687 for a detailled installation and also for a current caveeat.
You really don't need the jar file or need to include it your code. All you need is to define a BroadcastReceiver to listen to com.google.android.c2dm.intent.RECEIVE and com.google.android.c2dm.intent.REGISTRATION events and declare the receiver in your manifest.
Also need to add permissions
<uses-permission android:name="com.shopholler.android.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
Example of defining the receiver in the manifest.
<receiver android:name=".c2dmtest.C2DMMessageReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter >
<action android:name="com.google.android.c2dm.intent.RECEIVE" >
</action>
<category android:name="com.shopholler.android" />
</intent-filter>
</receiver>
Note for C2DM to work you need Android 2.2 + market installed.