[英]GCM in unity using EtceteraAndroid plugin and Urban Airship
I'm trying to use push notifications on Android game made in unity 3.5. 我正在尝试在Unity 3.5中制作的Android游戏上使用推送通知。 These are the steps I made: 这些是我执行的步骤:
I purchased asset called EtceteraAndroid by prime31 and create urbanairship app on its portal. 我通过prime31购买了名为EtceteraAndroid的资产,并在其门户上创建了Urbanairship应用。 Then I modify airshipconfig file like this: 然后我修改airshipconfig文件,如下所示:
gcmSender = My_Proj_number here transport = gcm developmentAppKey = devkey developmentAppSecret = dev secret key productionAppKey = devkey productionAppSecret = dev secret key (as I have no publishing account of Urban Airship) inProduction = false gcmSender = My_Proj_number在这里传输= gcm developmentAppKey = devkey developmentAppSecret =开发人员秘密密钥productionAppKey = devkey productionAppSecret =开发人员秘密密钥(因为我没有Urban Airship的发布帐户)inProduction = false
Any suggestion will be appreciated. 任何建议将不胜感激。
I'm currently trying to sort out issues relating to the Urban Airship plugin as well. 我目前正在尝试解决与Urban Airship插件有关的问题。
According to Prime 31, it would seem like things should just work out of the box. 根据《 Prime 31》,似乎事情应该开箱即用。 but as you might have already noticed, GCM support has been deprecated and Prime's plugin still relies on C2DM. 但您可能已经注意到,GCM支持已被弃用,Prime的插件仍依赖C2DM。
Perhaps you should also post on the following forum thread as this is where discussions have been happening on this topic.. 也许您也应该在以下论坛主题中发帖,因为这是有关该主题的讨论所在。
Having said that, I can get my APID to respond, even without the GCM account being correct. 话虽如此,即使GCM帐户不正确,我也可以让我的APID做出响应。 But I cannot receive any push notifications. 但是我无法收到任何推送通知。 More specifically, there are certain parts of the androidManifest.xml that need to be kept the same. 更具体地说,androidManifest.xml的某些部分需要保持相同。 This is my androidManifest.xml configuration: 这是我的androidManifest.xml配置:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.myCompany.myGame" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0">
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true"/>
<!-- The com.prime31.EtceteraApplication should be there -->
<application android:name="com.prime31.EtceteraApplication"
android:icon="@drawable/app_icon"
android:label="@string/app_name"
android:debuggable="true">
<!-- These activities should be in there -->
<activity android:name="com.unity3d.player.UnityPlayerProxyActivity"
android:label="@string/app_name"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:label="@string/app_name"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
</activity>
<activity android:name="com.unity3d.player.UnityPlayerNativeActivity"
android:label="@string/app_name"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<meta-data android:name="android.app.lib_name" android:value="unity" />
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
</activity>
<activity android:name="com.unity3d.player.VideoPlayer"
android:label="@string/app_name"
android:screenOrientation="behind"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
</activity>
<!-- ACTIVITIES -->
<activity android:name="com.prime31.EtceteraProxyActivity"></activity>
<activity android:name="com.prime31.WebViewActivity" android:configChanges="orientation"></activity>
<activity android:name="com.prime31.P31VideoPlayerActivity" android:configChanges="keyboard|keyboardHidden|orientation"></activity>
<receiver android:name="com.urbanairship.CoreReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.ACTION_SHUTDOWN" />
</intent-filter>
</receiver>
<receiver android:name="com.urbanairship.push.c2dm.C2DMPushReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.myCompany.myGame" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.myCompany.myGame" />
</intent-filter>
</receiver>
<service android:name="com.urbanairship.push.PushService" android:process=":com.urbanairship.push.process" />
<receiver android:name="com.prime31.P31UAIntentReceiver" />
</application>
<uses-feature android:glEsVersion="0x00010001" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.BROADCAST_STICKY"/>
<permission android:name="com.myCompany.myGame.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
<uses-permission android:name="com.myCompany.myGame.permission.C2D_MESSAGE"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
If you manage to get push notifications to work, please let me know since I can't get that part to work! 如果您设法使推送通知正常工作,请告诉我,因为我无法正常工作! Cheers! 干杯!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.