How to get server key for FCM notification

Click the settings icon next to your project name at the top left of the new Firebase Console
Click Project settings
Click on the Cloud Messaging tab
The key is right under Server Key
If your key is not correct it will return Error 401.

Please refer attached Image



How to save a image , from a base64 data string in php

We can save a base64 string as an image (.png or .jpg) on my server using file_put_contents function.

Show dynamic alert in android

public static void createErrorAlert(Context context,String title, String msg, String btntxt){
AlertDialog.Builder builder = new AlertDialog.Builder(context);
if(title != “”)
.setPositiveButton(btntxt, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
AlertDialog alert = builder.create();;

How to disable future date in calender in android application?

int       intMaxYear =  cyear – 10;
int    intMaxMonth = cmonth;
int    intMaxDay =  cday;

int    intMinYear =  cyear – 150;
int    intMinMonth = cmonth;
int    intMinDay =  cday;

DatePickerDialog   datePickerDialog = new DatePickerDialogWithMaxMinRange(
this, mDateSetListener,intMinYear,intMinMonth,intMinDay,intMaxYear,intMaxMonth,intMaxDay);
return datePickerDialog;

public class DatePickerDialogWithMaxMinRange extends DatePickerDialog {

static int maxYear;
static int maxMonth;
static int maxDay;

int minYear;
int minMonth;
int minDay;

public DatePickerDialogWithMaxMinRange(Context context,  OnDateSetListener callBack,int minYear,int minMonth,int minDay,int maxYear,int maxMonth,int maxDay) {
super(context,callBack, maxYear, maxMonth, maxDay);
this.minDay = minDay;
this.minMonth = minMonth;
this.minYear = minYear;
DatePickerDialogWithMaxMinRange.maxDay = maxDay;
DatePickerDialogWithMaxMinRange.maxMonth = maxMonth;
DatePickerDialogWithMaxMinRange.maxYear = maxYear;

public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
super.onDateChanged(view, year, monthOfYear, dayOfMonth);

if (year > maxYear ||monthOfYear > maxMonth && year == maxYear||
dayOfMonth > maxDay && year == maxYear && monthOfYear == maxMonth){
view.updateDate(maxYear, maxMonth, maxDay);
}else if(year < minYear ||monthOfYear < minMonth && year == minYear||
dayOfMonth < minDay && year == minYear && monthOfYear == minMonth){
view.updateDate(minYear, minMonth, minDay );