You need to implement a Broadcast Receiver that gets notified when the Paackage is beeing replaced:
In your Manifest include:
<receiver android:name="my.package.MyReceiver">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED"/>
<data android:scheme="package" />
</intent-filter>
</receiver>
The class MyReceiver
needs to extend android.content.BroadcastReceiver
To Answer your second question: The SharedPreferences aren't affected by an update through Google Play, as aren't the files in your App's data-Folder.