简体   繁体   English

未在Parse Server上创建Android App中的ParseObjects

[英]ParseObjects from Android App not created on Parse Server

I have deployed Parse Server on Heroku. 我已经在Heroku上部署了Parse Server。 The Mongo Lab and setup and everything is working fine. Mongo实验室和设置,一切正常。 The server is successfully deployed on the parse server but I am not able to connect my android app to the parse server deployed on heroku. 该服务器已成功部署在解析服务器上,但是我无法将我的Android应用程序连接到部署在heroku上的解析服务器。

I have configured the below details in my parse server index.js 我在解析服务器index.js中配置了以下详细信息

var api = new ParseServer({
  serverURL: "https://parseservertest12.herokuapp.com",
  databaseURI: databaseUri || 'mongodb://heroku_jhwmv6c9:khhmh38a4u95krh1gbajni59rs@ds021034.mlab.com:21034/heroku_jhwmv6c9',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || 'myAppId',
  masterKey: process.env.MASTER_KEY || 'myMasterKey' //Add your master key here. Keep it secret!
});

Check my Heroku Creditentials 检查我的Heroku信用

Here is my Application.java Class 这是我的Application.java类

Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
            .applicationId("myAppId")
            .clientKey("myMasterKey")
            .server("https://parseservertest12.herokuapp.com/parse")
    .build()
    );

      ParseObject gameScore = new ParseObject("GameScore");
      gameScore.put("score", 1337);
      gameScore.put("playerName", "Sean Plott");
      gameScore.put("cheatMode", false);
      gameScore.saveInBackground(new SaveCallback() {
          public void done(ParseException e) {
              if (e == null) {
                  Log.i("Parse", "Save Succeeded");
              } else {
                  Log.i("Parse", "Save Failed");
              }
          }
      });


      ParseUser.enableAutomaticUser();
    ParseACL defaultACL = new ParseACL();
    // Optionally enable public read access.
    // defaultACL.setPublicReadAccess(true);
    ParseACL.setDefaultACL(defaultACL, true);
  }

This is my AndroidManifest.xml 这是我的AndroidManifest.xml

 <application
        android:name=".StarterApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <meta-data
            android:name="com.parse.APPLICATION_ID"
            android:value="@string/parse_app_id" />
        <meta-data
            android:name="com.parse.CLIENT_KEY"
            android:value="@string/parse_client_key" />

This is the Strings.xml 这是Strings.xml

<string name="parse_app_id">myAppId</string>
    <string name="parse_client_key">myMasterKey</string>

I have tried resolving this issue a lot of times and referred to many online solutions but my method and everything seems correct but I am still not able to connect the android application to my parse server. 我已经尝试解决此问题很多次,并提到了许多在线解决方案,但是我的方法和一切似乎都正确,但是我仍然无法将android应用程序连接到我的解析服务器。 My application is ready on the Android device but connecting to the parse server has caused me alot of delay please help me resolve this issue. 我的应用程序已在Android设备上准备就绪,但连接到解析服务器导致我延迟很多,请帮助我解决此问题。

Running parse server with the VERBOSE=1 environment variable will help you debug this issue. 使用VERBOSE = 1环境变量运行解析服务器将帮助您调试此问题。

Also, can you try replacing your serverURL with https://parseservertest12.herokuapp.com/parse/ (adding a trailing / ). 另外,您是否可以尝试使用https://parseservertest12.herokuapp.com/parse/替换serverURL(添加尾随/ )。 In the android app. 在android应用中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM