我正在为我的 Android应用程序使用解析推送通知. 我按照教程和我下载jar文件,然后将其导入我的项目,我已将此代码添加到我的清单中 service android:name="com.parse.PushService" /receiver android:na
我按照教程和我下载jar文件,然后将其导入我的项目,我已将此代码添加到我的清单中
<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>
我还将application.class添加到我的包中,代码是
public class Application extends android.app.Application {
public Application() {
}
@Override
public void onCreate() {
super.onCreate();
// Initialize the Parse SDK.
Parse.initialize(this, "zzxxxxxxxxxxxxxxVv", "wyxxxxxxxCElxxxxxxx");
// Specify a Activity to handle all pushes by default.
PushService.setDefaultPushCallback(this, MainActivity.class);
// Save the current installation.
ParseInstallation.getCurrentInstallation().saveInBackground();
}
}
在我的主要活动中,我这样做
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ParseAnalytics.trackAppOpened(getIntent());
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
Log.e("MainActivity", "oncreate");
setContentView(R.layout.activity_main);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
有人说它在清单中的应用程序中名称attribut有问题,所以我用我的pacakge名称引出了这条线
<application
android:name="com.test.pushnotificationTest.Application"
在解析仪表板中,当我将应用程序安装到新设备而不是我获得新的入口仪表板..但当我尝试发送推送通知我不明白.
我需要添加brodcast接收器吗?但它之前使用相同的代码没有广播
帮帮我们
