Figured it out.
As, I was compiling with Android 6.0. It requires user to grant permission from user.
So,following code should be inserted and checked if user grants app permission or not.Then if user grants permission to read and write manifest will be updated and volia !!!