无法找到任何已注册的Android设备

时间:2015-02-22 13:33:01

标签: android parse-platform

我创建了Parse帐户并下载了SDK并替换了API密钥和密钥。 我尝试运行应用程序,ParseStarterProject运行时没有Android错误。 但是当我尝试发送推送消息时,我收到消息"无法找到任何已注册的设备"。如何在parse.com中注册我的设备。请建议。

我的主要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扩展了Application {

@覆盖   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);

} }

1 个答案:

答案 0 :(得分:1)

尝试将此添加到您的代码中,它应该在您的ParseApplication扩展应用程序活动中。

 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);
            }
        }
    });