使用EtceteraAndroid插件和Urban Airship统一GCM

时间:2012-11-21 10:08:38

标签: android push-notification urbanairship.com

我正在尝试在团结3.5中使用Android游戏上使用推送通知。这些是我做的步骤:

我通过prime31购买了名为EtceteraAndroid的资产,并在其门户网站上创建了urbanairship应用程序。然后我修改airshipconfig文件,如下所示:

gcmSender = My_Proj_number此处 运输= gcm developmentAppKey = devkey developmentAppSecret = dev密钥 productionAppKey = devkey productionAppSecret = dev密钥(因为我没有Urban Airship的发布帐号) inProduction = false

  • 我创建了Google帐户并在那里启用了GCM,将服务器API密钥复制到UrbanAirship GCM API密钥
  • 我添加了一些Using GCM, Urban Airship to send Push Notification
  • 中提到的权限
  • 在内部代码中,我调用启用Urbanair推送功能,该功能可在EtceteraAndroid插件中使用。
  • 我在我的Android设备上构建并运行apk。
  • 我没有在UrbanAirship门户网站上找到任何APPID,因此我的Android设备上没有通知:(

任何建议都将受到赞赏。

1 个答案:

答案 0 :(得分:0)

我目前正在尝试解决与Urban Airship插件相关的问题。

根据Prime 31的说法,看起来事情应该只是开箱即用。但正如您可能已经注意到的那样,GCM支持已经被弃用,Prime的插件仍然依赖于C2DM。

Perhaps you should also post on the following forum thread因为这是关于这个主题的讨论。

话虽如此,即使没有GCM帐户正确,我也可以让我的APID做出回应。但我无法接收任何推送通知。更具体地说,androidManifest.xml的某些部分需要保持不变。这是我的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"/>

如果你设法让推送通知工作,请告诉我,因为我无法让这部分工作!干杯!