Skip to content

Instantly share code, notes, and snippets.

@nuriyevn
Created April 26, 2021 09:55
Show Gist options
  • Select an option

  • Save nuriyevn/0b642d8d8ed8cd2959b4dba78c74a8c0 to your computer and use it in GitHub Desktop.

Select an option

Save nuriyevn/0b642d8d8ed8cd2959b4dba78c74a8c0 to your computer and use it in GitHub Desktop.

Revisions

  1. nuriyevn created this gist Apr 26, 2021.
    43 changes: 43 additions & 0 deletions StarterApplication.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    public class StarterApplication extends Application {

    public static final String TAG = "Starter";
    @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("myappID")
    .clientKey("tDjVOpOd4xMg")
    .server("https://ec2-18-216-250-74.us-east-2.compute.amazonaws.com/parse/")
    .build()
    );

    //ParseUser.enableAutomaticUser();

    ParseACL defaultACL = new ParseACL();
    defaultACL.setPublicReadAccess(true);
    defaultACL.setPublicWriteAccess(true);
    ParseACL.setDefaultACL(defaultACL, true);

    if (ParseUser.getCurrentUser() == null)
    {
    ParseAnonymousUtils.logIn(new LogInCallback() {
    @Override
    public void done(ParseUser user, ParseException e) {
    if (e == null)
    Log.i(TAG, "Anon ok");
    else
    Log.i(TAG, "Anon not ok");
    }
    });
    }
    else {
    Log.i(TAG, "username = " + ParseUser.getCurrentUser().getUsername().toString());
    }

    }
    }