Fixed Compatibility Issue

Changed some unsupported switch statements to if-else statements and
updated min and target sdk version