Skip to content

rommansabbir/ParseLiveQuery-Android

Repository files navigation

ParseLiveQuery-Android

Documentation

Installation


Step 1. Add the JitPack repository to your build file

	allprojects {
		repositories {
			maven { url 'https://jitpack.io' }
		}
	}

Step 2. Add the dependency

	dependencies {
          implementation 'com.github.rommansabbir:ParseLiveQuery-Android:Tag'
	}

Version available

Releases
v1.0.1
v1.0

Usages

For Java:

public class MainActivity extends AppCompatActivity implements ParseLiveQuery.ParseLiveQueryInterface {
    private ParseLiveQuery parseLiveQuery;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        /**
         * Instantiate ParseLiveQuery
         */
        parseLiveQuery = new ParseLiveQuery(this);

        /**
         * Create a usual parse query, add some constraint if you want
         * Don't execute the query
         */
        ParseQuery<ParseObject> liveQuery = ParseQuery.getQuery("CLASS_NAME");
        liveQuery.whereGreaterThan("AGE", 25);

        /**
         * Add live event listener to your query
         * Provide the name of your app, pass the liveQuery to the live event listener
         * @APP_NAME
         * @liveQuery
         */
        parseLiveQuery.addLiveEventListener("YOUR_APP_NAME_HERE", liveQuery);

    }

    @Override
    public void onEventListenerSuccess(ParseObject retrievedObject) {
        //TODO implement your logic here

    }

    @Override
    public void onEventListenerFailure(String errorMessage) {
        //TODO implement your logic here
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        /**
         * Destroy the callback after it usages
         */
        parseLiveQuery.destroyCallback();
    }
}

Contact me

Portfolio | LinkedIn | Twitter | Facebook

About

A simple library for Parse LiveQuery in Android

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages