Function before calling ondeviceready