How To Add Parse to an Android Studio Project?

前端 未结 8 1692
野趣味
野趣味 2020-12-24 01:22

I\'m trying to use the Parse library in Android Studio. I have used the basic example on their website and added the jar to the libs folder as well as added as a global libr

8条回答
  •  暖寄归人
    2020-12-24 02:01

    donwload parse SDK for android and follow instruction given on below mentioned link: https://parse.com/apps/quickstart#parse_data/mobile/android/native/existing

    Add the SDK to your app in Android Studio Add the following to your build.gradle

    dependencies {
        compile 'com.parse.bolts:bolts-android:1.+'
        compile 'com.parse:parse-android:1.+'
    }
    

    and then

    Add the following to your Application#onCreate():

    Parse.initialize(new Parse.Configuration.Builder(myContext)
        .applicationId("YOUR_APP_ID")
        .server("http://YOUR_PARSE_SERVER:1337/parse")
    
        ...
    
        .build()
    );
    

    Your app must request the INTERNET and ACCESS_NETWORK_STATE permissions, if it isn't doing so already. Add the following lines inside the tag in your AndroidManifest.xml:

    
    
    

    Compile and run!

    After installing the SDK, copy and paste this code into your app, for example in your Activity#onCreate():

    ParseObject testObject = new ParseObject("TestObject");
    testObject.put("foo", "bar");
    testObject.saveInBackground();
    

    You will also have to add an import statement at the top of your file:

    import com.parse.ParseObject;
    

    Run your app. A new object of class TestObject will be sent to the Parse Server and saved.

提交回复
热议问题