Android: How to execute some code only when I update the app on market?

view full story

http://stackoverflow.com – I need to know if there's a way to run a piece of code in my app only first time when the user installs my new updates from market(google play) ? I need to run the code once each time I upload a new version of my app ? Thanks for reading. (HowTos)