本文整理汇总了Java中com.parse.ParsePush.setQuery方法的典型用法代码示例。如果您正苦于以下问题:Java ParsePush.setQuery方法的具体用法?Java ParsePush.setQuery怎么用?Java ParsePush.setQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.parse.ParsePush
的用法示例。
在下文中一共展示了ParsePush.setQuery方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUnresponseStatus
import com.parse.ParsePush; //导入方法依赖的package包/类
@Subscribe
public void getUnresponseStatus(String status) {
Util.dismissLoadingDialog();
if (status.equals(DataExchange.STATUS_SUCCESS)) {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.you_unrespond), Toast.LENGTH_LONG).show();
PushService.unsubscribe(getApplicationContext(), DataExchange.PREFIX_FOR_CHANNEL_NAME + currentEvent.getHash());
ParsePush push = new ParsePush();
ParseQuery pushQuery = ParseInstallation.getQuery();
pushQuery.whereNotEqualTo("installationId", ParseInstallation.getCurrentInstallation().getInstallationId());
pushQuery.whereEqualTo("channels", DataExchange.PREFIX_FOR_CHANNEL_NAME + currentEvent.getHash());
push.setQuery(pushQuery);
try {
JSONObject data = new JSONObject("{\"action\": \"com.stepout.main.CustomReceiver.SHOW_EVENT\", \"message\": \"" + getString(R.string.user_do_not_attend_event, currentEvent.getRespondentsHash().size()) + "\", \"" + DataExchange.EVENT_HASH_FOR_VIEW_EVENT_ACTIVITY_KEY + "\": \"" + currentEvent.getHash() + "\", \"author\": \"" + currentEvent.getAuthorHash() + "\"}");
push.setData(data);
} catch (JSONException e) {
e.printStackTrace();
}
push.sendInBackground();
Intent intentDeletion = new Intent(this, MapsActivity.class);
startActivity(intentDeletion);
} else if (status.equals(DataExchange.STATUS_FAIL)) {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.some_error), Toast.LENGTH_LONG).show();
}
}
示例2: removeEventStatus
import com.parse.ParsePush; //导入方法依赖的package包/类
@Subscribe
public void removeEventStatus(String status) {
Util.dismissLoadingDialog();
if (status.equals(DataExchange.STATUS_REMOVE_SUCCESS)) {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.remove_success), Toast.LENGTH_LONG).show();
PushService.unsubscribe(getApplicationContext(), DataExchange.PREFIX_FOR_CHANNEL_NAME + currentEvent.getHash());
ParsePush push = new ParsePush();
ParseQuery pushQuery = ParseInstallation.getQuery();
pushQuery.whereNotEqualTo("installationId", ParseInstallation.getCurrentInstallation().getInstallationId());
pushQuery.whereEqualTo("channels", DataExchange.PREFIX_FOR_CHANNEL_NAME + currentEvent.getHash());
push.setQuery(pushQuery);
push.setMessage(getString(R.string.author_deleted_event, android.text.format.DateFormat.format("dd.MM.yy hh:mm", currentEvent.getDate())));
push.sendInBackground();
Intent intent = new Intent(this, MapsActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
} else if (status.equals(DataExchange.STATUS_REMOVE_FAIL)) {
isRemovingProcess = false;
Toast.makeText(getApplicationContext(), getResources().getString(R.string.some_error), Toast.LENGTH_LONG).show();
}
}
示例3: notifySOS
import com.parse.ParsePush; //导入方法依赖的package包/类
public void notifySOS() {
Log.d("AcceptedSOS","notifying");
// Find users near a given location
ParseQuery<ParseUser> userQuery = ParseUser.getQuery();
userQuery.whereEqualTo("username", senderId);
// Find devices associated with these users
ParseQuery<ParseInstallation> pushQuery = ParseInstallation.getQuery();
pushQuery.whereMatchesQuery("user", userQuery);
JSONObject jo = new JSONObject();
try {
jo.put("title", "Someone is coming to help you!");
jo.put("alert", "Ya! I'm coming!");
jo.put("sosId", SOSid);
jo.put("chatChannel", channelId);
jo.put("username", ParseUser.getCurrentUser().getUsername());
jo.put("type", "helping");
jo.put("displayname", displayname);
} catch (JSONException e) {
e.printStackTrace();
}
// Send push notification to query
ParsePush push = new ParsePush();
push.setQuery(pushQuery); // Set our Installation query
push.setData(jo);
push.sendInBackground();
}
示例4: sendPushNotifications
import com.parse.ParsePush; //导入方法依赖的package包/类
protected void sendPushNotifications() {
ParseQuery<ParseInstallation> query = ParseInstallation.getQuery();
query.whereContainedIn(ParseConstants.KEY_USER_ID, getRecipientIds());
// send push notification
ParsePush push = new ParsePush();
push.setQuery(query);
push.setMessage(getString(R.string.push_message,
ParseUser.getCurrentUser().getUsername()));
push.sendInBackground();
}
示例5: onSendClicked
import com.parse.ParsePush; //导入方法依赖的package包/类
public void onSendClicked(View view) {
Message message = new Message();
message.setFromObjectId(m_me.objectId);
message.setToObjectId(m_other.objectId);
message.setText(etMessage.getText().toString());
message.saveInBackground();
messagesAdapter.add(message);
lvMessages.setSelection(lvMessages.getCount() - 1);
try {
ChatNotification notification = new ChatNotification();
notification.from = m_me;
notification.to = m_other;
notification.text = etMessage.getText().toString();
String jsonString = new Gson().toJson(notification);
JSONObject jsonObject = new JSONObject(jsonString);
ParseQuery pushQuery = ParseInstallation.getQuery();
pushQuery.whereEqualTo("channels", "");
ParsePush push = new ParsePush();
push.setQuery(pushQuery);
push.setData(jsonObject);
push.sendInBackground();
} catch (JSONException e) {
e.printStackTrace();
}
etMessage.setText("");
}
示例6: sendPush
import com.parse.ParsePush; //导入方法依赖的package包/类
/**
* Sends a push notification to the recipient of a message. The push notification has the
* following fields (in a JSONObject):
*
* isChat - always true
* messageId - objectId of the message
* messageStr - The message's string representation
* fromUserId - objectId of the current user
* fromUserName - username of the current user
* title - title of the push notification ("New message from [username]")
* alert - the notification's message (the message string)
*
* @param message The message to push
*/
private void sendPush(Message message){
ParsePush push = new ParsePush();
ParseQuery<ParseInstallation> installationQuery = ParseInstallation.getQuery();
JSONObject pushData = new JSONObject();
installationQuery.whereEqualTo("user", otherUser);
try{
pushData.put("isChat", true);
pushData.put("messageId", message.getObjectId());
pushData.put("messageStr", message.getMessage());
pushData.put("fromUserId", ParseUser.getCurrentUser().getObjectId());
pushData.put("fromUserName", ParseUser.getCurrentUser().getUsername());
pushData.put("title", String.format(
"New message from %s", ParseUser.getCurrentUser().getUsername()
));
pushData.put("alert", message.getMessage());
} catch(JSONException e){
Log.d(TAG, e.getMessage());
updateToast("JSON exception occurred", Toast.LENGTH_LONG);
}
push.setQuery(installationQuery);
push.setData(pushData);
push.sendInBackground();
}
示例7: sendPushNotifications
import com.parse.ParsePush; //导入方法依赖的package包/类
protected void sendPushNotifications(){
//Parse installation object is used to associate users and send pushes only to intended users.
ParseQuery<ParseInstallation> query = ParseInstallation.getQuery();
query.whereContainedIn(ParseConstants.KEY_USER_ID, getRecipientIds());
//send the push notification
ParsePush push = new ParsePush();
push.setQuery(query);
push.setMessage(getString(R.string.push_message,
ParseUser.getCurrentUser().getUsername()));
push.sendInBackground();
}
示例8: sendPushNotifications
import com.parse.ParsePush; //导入方法依赖的package包/类
public void sendPushNotifications()
{
ParseQuery<ParseInstallation> pushQuery = ParseInstallation.getQuery();
pushQuery.whereContainedIn(Constants.USER_ID, getRecipientIds());
ParsePush push = new ParsePush();
push.setQuery(pushQuery);
push.setMessage(getString(R.string.message_notification,ParseUser.getCurrentUser().getUsername()));
push.sendInBackground();
}
示例9: updateEventStatus
import com.parse.ParsePush; //导入方法依赖的package包/类
@Subscribe
public void updateEventStatus(String status) {
if (status.equals(DataExchange.STATUS_UPDATE_EVENT_SUCCESS)) {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.event_saved), Toast.LENGTH_LONG).show();
ParsePush push = new ParsePush();
ParseQuery pushQuery = ParseInstallation.getQuery();
pushQuery.whereNotEqualTo("installationId", ParseInstallation.getCurrentInstallation().getInstallationId());
pushQuery.whereEqualTo("channels", DataExchange.PREFIX_FOR_CHANNEL_NAME + currentEvent.getHash());
push.setQuery(pushQuery);
try {
JSONObject data = new JSONObject("{\"action\": \"com.stepout.main.CustomReceiver.SHOW_EVENT\", \"message\": \"" + getString(R.string.author_updated_event, currentEvent.getRespondentsHash().size()) + "\", \"" + DataExchange.EVENT_HASH_FOR_VIEW_EVENT_ACTIVITY_KEY + "\": \"" + currentEvent.getHash() + "\", \"author\": \"" + currentEvent.getAuthorHash() + "\"}");
push.setData(data);
} catch (JSONException e) {
e.printStackTrace();
}
push.sendInBackground();
} else if(status.equals(DataExchange.STATUS_UPDATE_EVENT_FAIL)) {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.some_error), Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this, ViewEventAsAuthorActivity.class);
intent.putExtra(DataExchange.EVENT_HASH_FOR_VIEW_EVENT_ACTIVITY_KEY, currentEvent.getHash());
startActivity(intent);
Util.dismissLoadingDialog();
isSavingProcess = false;
}