Google I/O 2011: Android Protips: Advanced Topics for Expert Android App Developers
Why Stack Overflow recommends it
Stack Overflow users link it when answering Android questions about battery-friendly location updates, connectivity monitoring, unique installation IDs, backup and version checks.
Recommended by 10 people across 6 different months, 2011 to 2014.
What it is
A Google I/O 2011 session by Android developer advocate Reto Meier aimed at experienced Android developers. It covers advanced coding tips, design patterns and lesser-known API features for turning a working app into a polished product, including location updates, connectivity changes, backup and installation tracking.
What people said
Strong rec Peter Knego · 2011-05 · Stack Overflow · on “Where to initialize GPS to stay on for longer than the activities”
A simple way: Create a Service and register it to listen to LocationManager updates. If you want to send data even when phone goes to sleep then take a look at WAKE LOCK. However this will use GPS and network and will drain battery. People don't like such apps - I know I wouldn't use it. To make things more user-friendly: Use passive location provider. This leeches location data when other apps use Gps. Use Gps directly only when you dont get data for a longer period. Cache location data. Register with sync manager to update data when other app also update data. Use DownloadManager to upload data files: DM is smart, it automatically retries on error, even if device is restarted. If files are
Recommends omermuhammed · 2011-05 · Stack Overflow · on “Using android version programmatically”
This has been addressed here [LINK] on Android developer website. And take a look at Google I/O 2011, it has a good session on this, look at 6 minute mark of Android Protips: Advanced Topics for Expert Android App Developers [this video] session.
Recommends Kenny · 2011-06 · Stack Overflow · on “How to monitor connectivity changes when nothing else is running”
Take a look at the video below from google io 2011, around about 28mins it covers connectivity changes, and helped me out alot when i was doing this. [this video] You would probably need to use an Intent to monitor the connectivity changes, setup a pending intent to broadcast whenever the connectivity changes then setup a broadcast receiver to process the change. (the video show something similar but with location changes at around 22 mins)
Recommends olamotte · 2011-06 · Stack Overflow · on “Any way programatically to check the version of android platform”
The Build Class is easy to use : Build [LINK] if(Integer.decode(Build.VERSION.SDK) >=8) { // shiny APIS } else { // old APIS } check the excellent presentation by Reto Meier and the Parallel Activity pattern : here [this video]
Recommends thaussma · 2011-07 · Stack Overflow · on “Using paired Google accounts as your Android app login”
1) The AccountManager (gdocs) [LINK] allows to add and "use" (google) accounts on the device (Those that are listed in the settings). Go to 34:00 in the google io talk Android Pro Tips [this video] there small introduction. Actually all tips in this session are great. 2) With a SharedPreferencesBackupHelper [LINK] the settings of your app will be backed up online and automatically restored after a device switch. The preferences are tied to a google account. This service is useful for small amounts of data - some preferences. The data is as secure as the google account or the device and I think it's not encrypted. 3) see 1)
Recommends softarn · 2011-07 · Stack Overflow · on “How to identify an app user so he cannot pretend to be someone else”
What you want to do is to track installations. This can be done by getting a unique id and then saving it using shared preferences. You could put this into a folder on the SD-card but I don't think I'm the only one getting annoyed by this kind of behaviour in apps. Rather than putting a file on the SD-card want to backup the file using BackupManger and uploading it to the cloud. You can find info about the BackupManager here: Data backup [LINK] and a short part of this video on tracking installations here, 16:30 min in: Google I/O 2011: Pro tips [this video] I really recommend you (all) to watch the video as it goes through many rookie and pro misstakes. When reading about the BackupManager you'l
Recommends aromero · 2012-07 · Stack Overflow · on “Android LocationListener stop receiving location updates”
The activity in the background will be eventually destroyed, you don't have any guarantee that once stopped it will continue receiving location updates. Activities in Android are not supposed to be used like this. You can use a service with a wake lock as suggested, but keeping the device awake will quickly drain your battery. I recommend you this talk [this video] by Reto Meier (IO 2011), where he talks about different strategies to have a fresh location. Here is the code [LINK] .
Recommends android developer · 2012-08 · Stack Overflow · on “How to avoide android ANR”
better read this [LINK] article and watch google IO videos (like this [LINK] one and this [this video] one) . if you don't have time for this , simply remember this simple rule: long operations (like internet operations , DB operations , IO operations , and anything that could simply take longer than 5 seconds ) could cause ANR if they occur on the UI thread. for updating the UI , you must use the UI thread . if you need to do it after/during the long operation , use classes such as : Handler [LINK] , AsyncTask [LINK] , View.post [LINK] , Activity.runOnUiThread [LINK] .
Recommends Christoph Haefner · 2012-08 · Stack Overflow · on “Android: How reliable is getMacAddress() as unique identifier”
In this video [this video] from last year Google I/O, Reto Meier talked about exactly that problem off identifieng a device correctly. For the solution you will have to watch the video, because I don't remember it anymore. But I do remember his concerns about the "MacAddress"-Solution. The problem about this solution his that it addresses a particular device and not a particular "installation", think of the problem when a user, who installed your app, sells his phone to another person which will also install your app. With the MacAddress you have no chance to distinct between those two ...
Recommends Ernir Erlingsson · 2014-02 · Stack Overflow · on “Device ID Giving null Value”
You shouldn't really use the ANDROID_ID, you have no real guarantee that it will give you a unique identifier for the device and it is known that some older devices give the value null , or as in Moto's case, the same static value across multiple devices. This value also changes when the phone is reset to the factory default, and is super easy to change on a rooted device. The correct way is to generate your own UUID via. String uudid = UUID.randomUUID() You then save this in your App, for example through a SharedPreference . You can then use Google's Android backup storage to retain this identifier even if the user uninstalls your App. More information on Backup here: [LINK] If you don't ta