Advertisement
deadman96385

Untitled

Jul 26th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.53 KB | None | 0 0
  1.     private void initParse() {
  2.         Log.d(TAG, "initParse");
  3.         Parse.initialize(new Builder(this).server(BuildConfig.SERVER_URL).applicationId(BuildConfig.APP_ID).clientKey(BuildConfig.CLIENT_KEY).enableLocalDataStore().build());
  4.         ParseUser.logInInBackground("blocks", "blocks-emergency", new C07741());
  5.     }
  6.  
  7.     private void sendNotification(final long timestamp, String serial, String name, Location location, boolean cancelled) {
  8.         Log.d(TAG, "sendNotification t:" + timestamp + " c:" + cancelled);
  9.         Calendar calendar = Calendar.getInstance();
  10.         calendar.setTimeInMillis(timestamp);
  11.         ParseObject notificationObject = new ParseObject(cancelled ? CLASS_EMERGENCY_CANCELLED_NOTIFICATION : CLASS_EMERGENCY_NOTIFICATION);
  12.         notificationObject.put(NOTIFICATION_SERIAL_NUMBER, serial);
  13.         notificationObject.put(NOTIFICATION_NAME, name);
  14.         notificationObject.put(NOTIFICATION_TIME, mFormatter.format(calendar.getTime()));
  15.         notificationObject.put(NOTIFICATION_LOCATION, String.format(getString(C0256R.string.location_format), new Object[]{Double.valueOf(location.getLatitude()), Double.valueOf(location.getLongitude())}));
  16.         notificationObject.saveInBackground(new SaveCallback() {
  17.             public void done(ParseException e) {
  18.                 Log.d(MainApplication.TAG, "sendNotification done t:" + timestamp);
  19.                 MainApplication.mIsEmergencyOccurred = false;
  20.                 MainApplication.mIsEmergencyCancelled = false;
  21.             }
  22.         });
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement