Repository navigation
3. Enabling Push Notifications
#Steps for Enabling Push Notifications
##1. Register App with Google Cloud Messaging
To enable Push Notifications, get Sender ID and Server API Key from [Google] (https://developers.google.com/cloud-messaging/android/start)
##2. Register GCM Server API Key with Pyze
Go to your Pyze App Portfolio page and enter Server API Key obtained in #1 above in your App's settings
##3. Enable Push Messaging in your App
Enabling Push messaging in your app required additions to your Manifest File and an additional decleration in code when initializing Pyze
###Manifest File Additions
####Before the Application Tag
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<permission android:name="**myfullpackagename**.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="**myfullpackagename**.permission.C2D_MESSAGE" />
####In the Application Tag
<activity android:name="com.pyze.android.push.PyzePushTrackingActivity"
android:exported="true"/>
<service android:name="com.pyze.android.push.PushRegistrationIntentService" />
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="**myfullpackagename**" />
</intent-filter>
</receiver>
<service
android:name="com.pyze.android.push.PushListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<service
android:name="com.pyze.android.push.PushInstanceIDListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID"/>
</intent-filter>
</service>
###Code Additions
Add the Sender ID obtained in #1 as the argument to the Pyze.enablePush method after the Pyze initialize statement in the Main Activity's onCreate method
public void onCreate(Bundle savedInstanceState) {
Pyze.initialize(getApplication());
Pyze.enablePush("701387964525");
}