Installation - Mozgoid/unity-gcm GitHub Wiki
- Download unitypackage from here
- Import
unity-gcm.unitypackage
into your Unity project - Open
Assets/Plugins/Android/AndroidManifest.xml
and replaceINPUT_YOUR_BUNDLE_IDENTIFIER
with your bundle identifier- The default bundle identifier "com.Company.ProductName" is not available!
- Get Project Number in Google API Console
- Follow the Google's documentation
- Integrate parse plugin https://parse.com/docs/unity_guide
- Add object with script ParseNotifications to scene and change some values in it (like project number and bundle id).
- Set up parse for ios and android
- Send your push.
You can send simple message from parse. Also you can custumize it by sending json with fields
- ticker
- content_title
- alert
You can do this by switching message type on parse's new notification page from plain text to json and sending something like this:
{
"alert" : "Your message",
"ticker" : "ticker",
"content_title" : "content_title",
"otherField" : "thi string will not appear but you can try to cath it from your game"
}
In order to use your AndroidManifest.xml, copy and paste the following two blocks into your AndroidManifest.xml (Of course replace INPUT_YOUR_BUNDLE_IDENTIFIER with your bundle identifier)
<!-- Android GCM Plugin -->
<permission android:name="INPUT_YOUR_BUNDLE_IDENTIFIER.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="INPUT_YOUR_BUNDLE_IDENTIFIER.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- Android GCM Plugin -->
<!-- Android GCM Plugin -->
<receiver android:name="com.kskkbys.unitygcmplugin.UnityGCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="INPUT_YOUR_BUNDLE_IDENTIFIER" />
</intent-filter>
</receiver>
<service android:name="com.kskkbys.unitygcmplugin.UnityGCMIntentService" />
<!-- Android GCM Plugin -->