Hi all
My subscription request being sent twice and I only want 1 callback how do i resolve this?
Code:
ParseLiveQueryClient parseLiveQueryClient = null;
try {
parseLiveQueryClient = ParseLiveQueryClient.Factory.getClient(new URI("URL"));
} catch (URISyntaxException e) {
e.printStackTrace();
}
if (parseLiveQueryClient != null) {
ParseQuery<ParseObject> parseQuery = new ParseQuery("Post");
SubscriptionHandling<ParseObject> subscriptionHandling = parseLiveQueryClient.subscribe(parseQuery);
subscriptionHandling.handleEvent(SubscriptionHandling.Event.CREATE, new SubscriptionHandling.HandleEventCallback<ParseObject>() {
@Override
public void onEvent(ParseQuery<ParseObject> query, final ParseObject object) {
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
public void run() {
Log.d(TAG, "run: LiveQuery Incoming");
Date date = object.getCreatedAt();
DateFormat df = new SimpleDateFormat("EEE, HH:mm:ss d MMM yyyy ");
String reportDate = df.format(date);
ParseFile file = (ParseFile) object.get("IMG");
}
});
}
});
}