Update my app automatically

how to update my app automatically without app store?
and update my app when there is internet.?
i know about deploy but i dont know how to code it properly.can anyone help me?
any suggestions guys?
tnx in advance.