Method to get long from preference
long value of desired preference
preference's name
preference's value when the value is null