No, you don't need to. Messages are not sent by the device unless you want a 2 way communication.
So, if you only need to receive push messages, reception of a message is managed by onReceive() and after that for GcmIntentService() public class using method onHandleIntent() but your device has to meet some basic configurations before:
a) Must to be registered to Google and in your 3rd party app server
b) The device must to be connected to Internet
c) The device must to have intalled Google Play Services
To send a message you need a 3rd party server app to store registration_ids and to send message to Google's endpoint who takes the job to send the message under specific conditions to all registration_ids you provided.
This is an example of my build.gradle including Google Play Services to have access to GoogleCloudMessaging class:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.14.1'
}
}
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
dependencies {
compile project(':libraries:AmbilWarna')
compile files('libs/libGoogleAnalyticsServices.jar')
compile files('libs/commons-net-3.3.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.android.support:support-v4:21.0.0'
compile 'com.android.support:cardview-v7:21.0.0'
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'org.jsoup:jsoup:1.8.1@jar'
compile 'joda-time:joda-time:2.4@jar'
compile 'com.google.android.gms:play-services:6.1.71'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
compile 'ch.acra:acra:4.5.0'
compile 'net.rdrei.android.dirchooser:library:2.1@aar'
compile 'com.uwetrottmann:trakt-java:3.3.1'
}
def getVersionCode = { ->
try {
def code = new ByteArrayOutputStream()
exec {
commandLine 'git', 'log', '--oneline'
standardOutput = code
}
return code.toString().split("\n").size()
}
catch (ignored) {
return -1;
}
}
android {
signingConfigs {
release {
keyAlias '***'
keyPassword '+++'
storeFile file('/home/***')
storePassword '***'
}
}
compileSdkVersion 21
buildToolsVersion '21.1'
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
defaultConfig {
versionCode 30000+getVersionCode()
versionName "3.0." + getVersionCode()
signingConfig signingConfigs.release
}
lintOptions {
abortOnError false
}
productFlavors {
}
}
More detailed info of all topic(please ignore XMPP and gcm.send methods):
Full GCM Client implementation