2016-04-25 8 views
1

私のandroidプログラムを解析サーバーダッシュボードに接続しようとしていますか? 私は成功したダッシュボードを作成している、私はどこにでも探しているが、そのようなそこに私が行っているDと同じことを言って試してみましたが、ここで は私のandroidプロジェクトをparse-dashboardとローカルで接続できません

****StarterApplication.java**** 

    package com.parse.starter; 

    import android.app.Application; 
    import android.util.Log; 

    import com.parse.Parse; 
    import com.parse.ParseACL; 
    import com.parse.ParseException; 
    import com.parse.ParseObject; 
    import com.parse.ParseUser; 
    import com.parse.SaveCallback; 


    public class StarterApplication extends Application { 

     @Override 
     public void onCreate() { 
     super.onCreate(); 

     // Enable Local Datastore. 
     Parse.enableLocalDatastore(this); 

     // Add your initialization code here 
     Parse.initialize(new Parse.Configuration.Builder(getApplicationContext()) 
       .applicationId("instagram99n990nm900b") //application id 
       .clientKey("instagjusohjwjikkjjoeoeh") //master key 
       .server("https://instagram914.herokuapp.com/parse/") //serverURl 
     .build() 
     ); 

      ParseObject gameScore = new ParseObject("GameScore"); 
      gameScore.put("score", 1337); 
      gameScore.put("playerName", "Sean Plott"); 
      gameScore.put("cheatMode", false); 
      gameScore.saveInBackground(); 
      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); 
     } 
    } 

    **MainActivity.java** 

    import android.os.Bundle; 
    import android.support.v7.app.ActionBarActivity; 
    import android.view.Menu; 
    import android.view.MenuItem; 

    import com.parse.ParseAnalytics; 


    public class MainActivity extends ActionBarActivity { 

     @Override 
     protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 

     ParseAnalytics.trackAppOpenedInBackground(getIntent()); 
     } 

     @Override 
     public boolean onCreateOptionsMenu(Menu menu) { 
     // Inflate the menu; this adds items to the action bar if it is present. 
     getMenuInflater().inflate(R.menu.menu_main, menu); 
     return true; 
     } 

     @Override 
     public boolean onOptionsItemSelected(MenuItem item) { 
     // Handle action bar item clicks here. The action bar will 
     // automatically handle clicks on the Home/Up button, so long 
     // as you specify a parent activity in AndroidManifest.xml. 
     int id = item.getItemId(); 

     //noinspection SimplifiableIfStatement 
     if (id == R.id.action_settings) { 
      return true; 
     } 

     return super.onOptionsItemSelected(item); 
     } 
    } 
+0

進歩がありますか? – Sam

答えて

0

u..`私のコード 感謝があなたのマニフェストにこれを追加でファイル -

<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" /> 
+0

Vyasに感謝します...しかし、私はすでにそれが私のマニフェストファイルを持っています.... –

0

適切な手順がありますが、Parse Logicを書き込む前にParseに読み書き権限を設定する必要があります。それは以下のように見えます

1)//ローカルデータストアを有効にします。

Parse.enableLocalDatastore(this); 

2)

ParseACL p_ACL = new ParseACL(); 
p_ACL.setPublicReadAccess(true);   
p_ACL.setPublicWriteAccess(true); 

ParseACL.setDefaultACL(p_ACL,true); 

今すぐMainActivityであなたの解析ロジックを適用し解析するための許可を読み取りを設定し、書き込み//ここに初期化コード

Parse.initialize(new Parse.Configuration.Builder(getApplicationContext()) 
      .applicationId("instagram99n990nm900b") //application id 
      .clientKey("instagjusohjwjikkjjoeoeh") // client key is optional.....    .server("https://instagram914.herokuapp.com/parse/") //serverURl 
      .build()); 

3)を追加します//。 javaファイル

関連する問題