Skip to content

Instantly share code, notes, and snippets.

Bearer 86mHCatynfXKhN4UKPwRmqYc81ZIkNKG0psu64ZDpxjU3ZkuezT2GVBi_NYzCiQjpj99FPRoiLavsORagu1Y5nsdQkoaHBZBhX02mTmWSlbzd482ecTtVen5pARc1K3D_fHpum4zeGVtFp6Vi1bHu6Bl5T6fnq6XRry_izK_Db-0PBPN5K2Po15HoxRwPJUa
public class CustomFcmMessageListenerService extends FirebaseMessagingService {
@Override
public void onMessageReceived(final RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
Log.i("UID",SPUtils.getSharedStringData(this,BundleKey.Uid));
//if user already logout, don't trigger push notification
if(SPUtils.getSharedStringData(this,BundleKey.Uid).equals("")){
return;
}
private void calculateRoomsRequired(int adults, int children, int infants) {
int counter = 0;
if(adults + children + infants == 0) {
showError("we need atleast a pax to proceed");
return;
}
if(adults + children + infants > MAX_HEADCOUNT) {
showError("Booking exceeds maximum guests");
@irshu355
irshu355 / firebaseToFirestore
Last active September 21, 2018 04:09
Sample of how to export data from your existing firebase realtime database to firestorm.
var config = {
apiKey: "xxxxxxxxx",
authDomain: "xxxxxxx",
databaseURL: "https://xxxxxxx.firebaseio.com",
projectId: "xxxxxxx",
storageBucket: "xxxxxx.appspot.com",
messagingSenderId: "xxxxxxxxxx"
};
firebase.initializeApp(config);
@irshu355
irshu355 / InternationalDiallingCodes
Created August 30, 2018 05:54
International dialling codes to java HashMap
diallingCodes.put("AF", "Afghanistan:+93");
diallingCodes.put("AX", "Aland Islands:+358");
diallingCodes.put("AL", "Albania:+355");
diallingCodes.put("DZ", "Algeria:+213");
diallingCodes.put("AS", "AmericanSamoa:+1684");
diallingCodes.put("AD", "Andorra:+376");
diallingCodes.put("AO", "Angola:+244");
diallingCodes.put("AI", "Anguilla:+1264");
diallingCodes.put("AQ", "Antarctica:+672");
diallingCodes.put("AG", "Antigua and Barbuda:+1268");
package com.github.irshulx.glitchtext;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
@irshu355
irshu355 / ErrorInterceptor.java
Created May 3, 2017 08:22
Resend network request on network error using OkHttp3
public class ErrorInterceptor implements Interceptor {
ICacheManager cacheManager;
Response response = null;
int tryCount = 0;
int maxLimit = 3;
int waitThreshold = 5000;
@Inject
public ErrorInterceptor() {
}