I see many answer for this question but most of the answers using deprecated code & many using ping method to check active internet connection on android that results of getting wrong result on some devices like Samsung. I need a code that could be small & efficient.