我想在我的应用程序中使用推送通知。但我不知道我必须在哪个活动中添加它。我有大约7项活动。
我尝试添加到不同的活动但它不起作用。有没有人帮我或建议我如何使用?
public class ParseApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// Add your initialization code here
Parse.initialize(this, "", "");
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
// If you would like all objects to be private by default, remove this line.
defaultACL.setPublicReadAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
}
public class ParseStarterProjectActivity extends Activity {
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// To track statistics around application
ParseAnalytics.trackAppOpened(getIntent());
// inform the Parse Cloud that it is ready for notifications
PushService.setDefaultPushCallback(this, ParseStarterProjectActivity.class);
ParseInstallation.getCurrentInstallation().saveInBackground();
}
答案 0 :(得分:0)
Parse.initialize(this,“”,“”);在该字段中输入您的两个键
在应用程序中定义应用程序类
定义所有必需的权限
将解析.jar导入您的项目