解析推送通知即使收到也不显示

时间:2015-02-09 05:44:35

标签: android unity3d parse-platform push-notification

我在我的Unity应用程序中使用解析推送通知服务,但即使收到{实际通知声音是从解析应用程序仪表板发送推送时播放}也不显示。 // Android Manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.debug.testplugin"
  android:versionCode="1"
  android:versionName="1.0">
  <uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="com.debug.testplugin.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
<uses-permission android:name="com.debug.testplugin.permission.C2D_MESSAGE" />
<application android:label="@string/app_name">
    <activity android:name="com.debug.testplugin.UTestPlugin"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <service android:name="com.parse.PushService" />
    <receiver android:name="com.parse.ParseBroadcastReceiver">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <action android:name="android.intent.action.USER_PRESENT" />
        </intent-filter>
        </receiver>
        <receiver android:name="com.parse.GcmBroadcastReceiver"
            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="com.debug.testplugin" />
        </intent-filter>
    </receiver>
    <service android:name="com.parse.PushService" />    
    <receiver android:name="com.parse.ParsePushBroadcastReceiver" android:exported="false">
        <intent-filter>
            <action android:name="com.parse.push.intent.RECEIVE" />
            <action android:name="com.parse.push.intent.DELETE" />
            <action android:name="com.parse.push.intent.OPEN" />
        </intent-filter>
    </receiver>
</application>
</manifest>

//代码

package com.debug.testplugin;

import com.unity3d.player.UnityPlayerActivity;
import android.content.Context;
import android.os.Bundle;
import android.util.Config;
import android.util.Log;

//parse
import com.parse.Parse;
import com.parse.ParseException;
import com.parse.ParsePush;
import com.parse.SaveCallback;

public class UTestPlugin extends UnityPlayerActivity
{
private static final String TAG = "PluginTest_Unity";
private static int number = 0;

@Override
protected void onCreate(Bundle myBundle) {
    super.onCreate(myBundle);
    Log.d(TAG, "OnCreate");
    Parse.initialize(this, "z4DFYspyWzDtdM4dsVtMfoczswFtv5114vOwY2cO", "SgwzT7WDpk8zmtd2borGy4gDCNdsXGU6muul2a9x");
    ParsePush.subscribeInBackground("", new SaveCallback() {
         @Override
          public void done(ParseException e) {
            if (e == null) {
              Log.d(TAG, "successfully subscribed to the broadcast channel.");
            } else {
              Log.e(TAG, "failed to subscribe for push", e);
            }
          }
    });

}
@Override
protected void onResume() {
    Log.d(TAG, "onResume");
    super.onResume();
}
@Override
protected void onPause()
{
    super.onPause();
}
@Override
protected void onStop() {
   Log.d(TAG, "onStop");
   super.onStop();
}
public static int getNumber()
{
    number++;
    return number;
}
}

0 个答案:

没有答案