找不到任何注册的设备还没有Android的 [英] Can't find any registered devices yet Android
问题描述
我创建了解析帐户并下载了SDK,取而代之的API密钥和秘密密钥。
我尝试运行应用程序和ParseStarterProject没有错误为Android运行。
但是,当我尝试发送推送消息我得到的消息找不到任何注册的设备还没有。如何注册我的设备parse.com.Please建议。
I have created the Parse account and downloaded the SDK and replaced the API Key and Secret Key. I try to run the application and the ParseStarterProject runs with no errors for Android. But when I try to send a push message I get the message "Can't find any registered devices yet".How do I register my device in parse.com.Please suggest.
我只有这在我的主要ParseStarterProjectActivity.java
I have only this in my main ParseStarterProjectActivity.java
public class ParseStarterProjectActivity extends Activity {
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ParseAnalytics.trackAppOpenedInBackground(getIntent());
}
}
公共类ParseApplication扩展应用{
public class ParseApplication extends Application {
@覆盖
公共无效的onCreate(){
super.onCreate();
@Override public void onCreate() { super.onCreate();
// Initialize Crash Reporting.
ParseCrashReporting.enable(this);
// Enable Local Datastore.
Parse.enableLocalDatastore(this);
// Add your initialization code here
Parse.initialize(this, "xxxxxxxxxxxxxx", "xxxxxxxx");
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
// Optionally enable public read access.
// defaultACL.setPublicReadAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
}
}
} }
推荐答案
尝试添加以下内容到code,应低于你ParseApplication扩展应用程序的活动。
Try adding this to your code, it should be below in your ParseApplication extends Application activity.
ParsePush.subscribeInBackground("", new SaveCallback() {
@Override
public void done(ParseException e) {
if (e == null) {
Log.d("com.parse.push", "successfully subscribed to the broadcast channel.");
} else {
Log.e("com.parse.push", "failed to subscribe for push", e);
}
}
});
这篇关于找不到任何注册的设备还没有Android的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!