[英]Unity3D, Parse.com not sending push notifications to Android Devices
I am using the parse.com to save an installation (on Android devices) of my Unity3D Games. 我正在使用parse.com保存Unity3D Games的安装(在Android设备上)。 I want to use parse.com push service to manage push notifications.
我想使用parse.com推送服务来管理推送通知。 I am able to save all installations on parse Database in parse core .
我能够将所有安装保存在parse核心的 parse数据库中。
When I try to send push notifications to my Android devices, it shows the result 0 pushes sent. 当我尝试向我的Android设备发送推送通知时,它显示发送0次推送的结果。
Does anybody know what might be causing this? 有人知道这可能是什么造成的吗?
My Manifest is settled according to guide provided in the documentation. 我的清单是根据文档中提供的指南进行结算的。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="18" android:versionName="1.1.7" package="com.imptrax.sniperoverkill3dassassinshooting" android:installLocation="preferExternal">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true" />
<permission android:name="com.imptrax.sniperoverkill3dassassinshooting.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.imptrax.sniperoverkill3dassassinshooting.permission.C2D_MESSAGE" />
<application android:icon="@drawable/app_icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar" android:debuggable="false" android:isGame="true" android:banner="@drawable/app_banner">
<activity android:label="@string/app_name" android:name="com.unity3d.player.UnityPlayerActivity" android:screenOrientation="landscape" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
<activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:name="com.facebook.unity.FBUnityLoginActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
</activity>
<activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:name="com.facebook.unity.FBUnityDialogsActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
</activity>
<activity android:configChanges="keyboardHidden|orientation" android:name="com.facebook.LoginActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
</activity>
<activity android:exported="true" android:name="com.facebook.unity.FBUnityDeepLinkingActivity">
</activity>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="\ 1550186055254706" />
<activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:name="com.google.android.gms.ads.AdActivity" />
<!-- Required by Chartboost -->
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<activity android:configChanges="orientation|keyboard|keyboardHidden" android:launchMode="singleTop" android:name="com.chartboost.sdk.CBDialogActivity" android:theme="@android:style/Theme.Translucent" android:windowSoftInputMode="adjustResize">
</activity>
<activity android:configChanges="orientation|layoutDirection|keyboard|keyboardHidden|screenLayout|uiMode|screenSize" android:excludeFromRecents="true" android:name="com.chartboost.sdk.CBImpressionActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity android:configChanges="orientation|layoutDirection|keyboard|keyboardHidden|screenLayout|uiMode|screenSize" android:name="com.prime31.GoogleIABProxyActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<service android:name="com.parse.ParsePushService" />
<receiver android:name="com.parse.ParsePushBroadcastReceiver" 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" />
<!--
IMPORTANT: Change "com.parse.starter" to match your app's package name.
-->
<category android:name="com.imptrax.sniperoverkill3dassassinshooting" />
</intent-filter>
</receiver>
</application>
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-feature android:glEsVersion="0x00020000" />
<supports-gl-texture android:name="GL_OES_compressed_ETC1_RGB8_texture" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
</manifest>
Its my piece of code to register for push notifications written in C# for Unity 这是我的代码,用于注册用C#for Unity编写的推送通知
void Start() {
var installation = ParseInstallation.CurrentInstallation;
installation.SaveAsync();
ParsePush.ParsePushNotificationReceived += (sender, args) =>
{
#if UNITY_ANDROID
AndroidJavaClass parseUnityHelper = new AndroidJavaClass("com.parse.ParseUnityHelper");
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
// Call default behavior.
parseUnityHelper.CallStatic("handleParsePushNotificationReceived", currentActivity, args.StringPayload);
#endif
};
}
Change your package in permissions and in your uses-permission tag 在许可权和使用许可标签中更改软件包
As you have specified a pakage name in your manifest tag copy that and place it like this 正如您在清单标签副本中指定的包装名称一样,将其放置为
com.unity3d.player.permission......
both in permission and uses-permission 在许可和使用许可中
check if that helps 检查是否有帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.