Parse.com推送通知未收到 [英] Parse.com Push notification fails to be received
本文介绍了Parse.com推送通知未收到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解析发送推送通知,但Android设备无法接收。
我已经很小心,我不知道还有什么我能做得到它的工作接踵而至的解析教程。
请帮忙。谢谢。
我的manifest.xml:
<?XML版本=1.0编码=UTF-8&GT?;
<清单的xmlns:机器人=http://schemas.android.com/apk/res/android
包=org.marsfirst.mars_app
安卓版code =12
机器人:=的versionName1.8.4> <用途-SDK
安卓的minSdkVersion =14
机器人:targetSdkVersion =18/> <使用许可权的android:NAME =android.permission.INTERNET对/>
<使用许可权的android:NAME =android.permission.ACCESS_NETWORK_STATE/>
<使用许可权的android:NAME =android.permission.WAKE_LOCK/>
<使用许可权的android:NAME =android.permission.RECEIVE_BOOT_COMPLETED/>
<使用许可权的android:NAME =android.permission.VIBRATE/>
<使用许可权的android:NAME =android.permission.GET_ACCOUNTS/>
<使用许可权的android:NAME =com.google.android.c2dm.permission.RECEIVE/>
<使用许可权的android:NAME =org.marsfirst.mars_app.pushnotifications.permission.C2D_MESSAGE/>
<许可
机器人:名字=org.marsfirst.mars_app
安卓的ProtectionLevel =签名/> <使用许可权的android:NAME =org.marsfirst.mars_app.pushnotifications.permission.C2D_MESSAGE/> <应用
机器人:allowBackup =真
机器人:图标=@绘制/ ic_launcher
机器人:标签=@字符串/ APP_NAME
机器人:主题=@风格/ AppTheme>
<活动
机器人:名字=org.marsfirst.mars_app.MainActivity
机器人:标签=@字符串/ APP_NAME>
&所述;意图滤光器>
<作用机器人:名字=android.intent.action.MAIN/> <类机器人:名字=android.intent.category.LAUNCHER/>
&所述; /意图滤光器>
< /活性GT;
<活动
机器人:名字=org.marsfirst.mars_app.Signup
机器人:标签=@字符串/注册
机器人:parentActivityName =org.marsfirst.mars_app.MainActivity>
<意图过滤器/> &所述;元数据
机器人:名字=android.support.PARENT_ACTIVITY
机器人:值=org.marsfirst.mars_app.MainActivity/>
< /活性GT;
<活动
机器人:名字=org.marsfirst.mars_app.MainPage
机器人:标签=主页>
&所述;意图滤光器>
<作用机器人:名字=android.intent.action.MAIN/>
&所述; /意图滤光器>
< /活性GT;
<活动
机器人:名字=org.marsfirst.mars_app.Webpage
机器人:标签=网站
机器人:parentActivityName =org.marsfirst.mars_app.MainPage>
<意图过滤器/> &所述;元数据
机器人:名字=android.support.PARENT_ACTIVITY
机器人:值=org.marsfirst.mars_app.MainPage/>
< /活性GT;
<活动
机器人:名字=org.marsfirst.mars_app.TeamNews
机器人:标签=队报
机器人:parentActivityName =org.marsfirst.mars_app.MainPage>
<意图过滤器/> &所述;元数据
机器人:名字=android.support.PARENT_ACTIVITY
机器人:值=org.marsfirst.mars_app.MainPage/>
< /活性GT;
<活动
机器人:名字=org.marsfirst.mars_app.OprPage
机器人:标签=OPR页
机器人:parentActivityName =org.marsfirst.mars_app.MainPage>
<意图过滤器/> &所述;元数据
机器人:名字=android.support.PARENT_ACTIVITY
机器人:值=org.marsfirst.mars_app.MainPage/>
< /活性GT;
<活动
机器人:名字=org.marsfirst.mars_app.MechPage
机器人:标签=机械页
机器人:parentActivityName =org.marsfirst.mars_app.MainPage>
<意图过滤器/> &所述;元数据
机器人:名字=android.support.PARENT_ACTIVITY
机器人:值=org.marsfirst.mars_app.MainPage/>
< /活性GT;
<活动
机器人:名字=org.marsfirst.mars_app.DriveNews
机器人:标签=驱动经济新闻
机器人:parentActivityName =org.marsfirst.mars_app.MainPage>
<意图过滤器/> &所述;元数据
机器人:名字=android.support.PARENT_ACTIVITY
机器人:值=org.marsfirst.mars_app.MainPage/>
< /活性GT;
<活动
机器人:名字=org.marsfirst.mars_app.ProgramingPage
机器人:标签=编程页面
机器人:parentActivityName =org.marsfirst.mars_app.MainPage>
<意图过滤器/> &所述;元数据
机器人:名字=android.support.PARENT_ACTIVITY
机器人:值=org.marsfirst.mars_app.MainPage/>
< /活性GT;
<活动
机器人:名字=org.marsfirst.mars_app.Application
机器人:allowBackup =真
机器人:主题=@风格/ AppTheme>
< /活性GT; <服务机器人:名字=com.parse.PushService/> <接收机器人:名字=com.parse.ParseBroadcastReceiver>
&所述;意图滤光器>
<作用机器人:名字=android.intent.action.BOOT_COMPLETED/>
<作用机器人:名字=android.intent.action.USER_ preSENT/>
&所述; /意图滤光器>
< /接收器>
<接收
机器人:名字=com.parse.GcmBroadcastReceiver
机器人:权限=com.google.android.c2dm.permission.SEND>
&所述;意图滤光器>
<作用机器人:名字=com.google.android.c2dm.intent.RECEIVE/>
<作用机器人:名字=com.google.android.c2dm.intent.REGISTRATION/>
<类机器人:名字=org.marsfirst.mars_app/>
&所述; /意图滤光器>
< /接收器>
< /用途>< /清单>
然后我Application.class
进口com.parse.Parse;
进口com.parse.ParseAnalytics;
进口com.parse.ParseInstallation;
进口com.parse.PushService;进口android.content.Context;
进口android.content.Intent;
进口android.content.res.Configuration;
进口android.support.v7.app.ActionBarActivity;
进口android.widget.Toast;公共类应用扩展android.app.Application { 公共应用程序(){
} @覆盖
公共无效的onCreate(){
super.onCreate(); {
Parse.initialize(这一点,钥匙,重点); PushService.setDefaultPushCallback(Application.this,MainActivity.class);
ParseAnalytics.trackAppOpened(getIntent());
。ParseInstallation.getCurrentInstallation()saveInBackground();
}
} 私人意图getIntent(){
// TODO自动生成方法存根
返回null;
}}
解决方案
我已经成功地实施了解析推这个清单
文件...
<?XML版本=1.0编码=UTF-8&GT?;
<清单的xmlns:机器人=http://schemas.android.com/apk/res/android
包=你的包名
安卓版code =1
机器人:=的versionName1.0> <用途-SDK
安卓的minSdkVersion =15
机器人:targetSdkVersion =16/> <使用许可权的android:NAME =android.permission.INTERNET对/>
<使用许可权的android:NAME =android.permission.ACCESS_NETWORK_STATE/>
<使用许可权的android:NAME =android.permission.RECEIVE_BOOT_COMPLETED/>
<使用许可权的android:NAME =android.permission.VIBRATE/> <应用
机器人:allowBackup =真
机器人:图标=@绘制/ ic_launcher
机器人:标签=@字符串/ APP_NAME
机器人:主题=@风格/ AppTheme>
<活动
机器人:名字=你的包name.YourActivity
机器人:标签=@字符串/ APP_NAME>
&所述;意图滤光器>
<作用机器人:名字=android.intent.action.MAIN/> <类机器人:名字=android.intent.category.LAUNCHER/>
&所述; /意图滤光器>
< /活性GT; <服务机器人:名字=com.parse.PushService/> <接收机器人:名字=com.parse.ParseBroadcastReceiver>
&所述;意图滤光器>
<作用机器人:名字=android.intent.action.BOOT_COMPLETED/>
<作用机器人:名字=android.intent.action.RECEIVE_BOOT_COMPLETED/>
<作用机器人:名字=android.intent.action.USER_ preSENT/>
&所述; /意图滤光器>
< /接收器>
<接收机器人:名字=你的包name.YourCustomReceiver>
&所述;意图滤光器>
<作用机器人:名字=android.intent.action.BOOT_COMPLETED/>
<作用机器人:名字=android.intent.action.USER_ preSENT/>
<作用机器人:名字=你的包name.UPDATE_STATUS/>
&所述; /意图滤光器>
< /接收器>
< /用途> < /清单>
任何进一步的查询,请让我知道..
Parse sends the push notifications but the android devices fails to receive. I have Followed the Parse tutorial very carefully I don't know what else I can do to get it working. Please Help. Thank You.
My manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.marsfirst.mars_app"
android:versionCode="12"
android:versionName="1.8.4" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="18" />
<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.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="org.marsfirst.mars_app.pushnotifications.permission.C2D_MESSAGE" />
<permission
android:name="org.marsfirst.mars_app"
android:protectionLevel="signature" />
<uses-permission android:name="org.marsfirst.mars_app.pushnotifications.permission.C2D_MESSAGE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="org.marsfirst.mars_app.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="org.marsfirst.mars_app.Signup"
android:label="@string/signup"
android:parentActivityName="org.marsfirst.mars_app.MainActivity" >
<intent-filter />
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.marsfirst.mars_app.MainActivity" />
</activity>
<activity
android:name="org.marsfirst.mars_app.MainPage"
android:label="Main Page" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name="org.marsfirst.mars_app.Webpage"
android:label="Website"
android:parentActivityName="org.marsfirst.mars_app.MainPage" >
<intent-filter />
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.marsfirst.mars_app.MainPage" />
</activity>
<activity
android:name="org.marsfirst.mars_app.TeamNews"
android:label="Team News"
android:parentActivityName="org.marsfirst.mars_app.MainPage" >
<intent-filter />
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.marsfirst.mars_app.MainPage" />
</activity>
<activity
android:name="org.marsfirst.mars_app.OprPage"
android:label="OPR Page"
android:parentActivityName="org.marsfirst.mars_app.MainPage" >
<intent-filter />
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.marsfirst.mars_app.MainPage" />
</activity>
<activity
android:name="org.marsfirst.mars_app.MechPage"
android:label="Mechanical Page"
android:parentActivityName="org.marsfirst.mars_app.MainPage" >
<intent-filter />
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.marsfirst.mars_app.MainPage" />
</activity>
<activity
android:name="org.marsfirst.mars_app.DriveNews"
android:label="Drive News"
android:parentActivityName="org.marsfirst.mars_app.MainPage" >
<intent-filter />
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.marsfirst.mars_app.MainPage" />
</activity>
<activity
android:name="org.marsfirst.mars_app.ProgramingPage"
android:label="Programming Page"
android:parentActivityName="org.marsfirst.mars_app.MainPage" >
<intent-filter />
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.marsfirst.mars_app.MainPage" />
</activity>
<activity
android:name="org.marsfirst.mars_app.Application"
android:allowBackup="true"
android:theme="@style/AppTheme">
</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="org.marsfirst.mars_app" />
</intent-filter>
</receiver>
</application>
</manifest>
Then my Application.class
import com.parse.Parse;
import com.parse.ParseAnalytics;
import com.parse.ParseInstallation;
import com.parse.PushService;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.support.v7.app.ActionBarActivity;
import android.widget.Toast;
public class Application extends android.app.Application {
public Application() {
}
@Override
public void onCreate() {
super.onCreate();
{
Parse.initialize(this, "key","key");
PushService.setDefaultPushCallback(Application.this, MainActivity.class);
ParseAnalytics.trackAppOpened(getIntent());
ParseInstallation.getCurrentInstallation().saveInBackground();
}
}
private Intent getIntent() {
// TODO Auto-generated method stub
return null;
}}
解决方案
i have successfully implementing the parse push with this manifest file ...
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="your package name"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="16" />
<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.VIBRATE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="your package name.YourActivity"
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.RECEIVE_BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<receiver android:name="your package name.YourCustomReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
<action android:name="your package name.UPDATE_STATUS" />
</intent-filter>
</receiver>
</application>
</manifest>
for any further query please let me know..
这篇关于Parse.com推送通知未收到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文