question

Aaron Oneal avatar image
Aaron Oneal asked

How to retrieve the device or owner name?

Kindles seem to have an empty hostname. As an alternative, is there a way to retrieve the device or owner name? e.g. "Bob's Kindle". I'm looking for a user friendly way to display devices on the network.
fire tablet
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Bipin@Amazon avatar image
Bipin@Amazon answered
Hi Aaron, To give personal experience , this link is useful http://developer.android.com/training/id-auth/index.html Are looking for Account name: AccountManager am = AccountManager.get(this); // "this" references the current Context Account[] accounts = am.getAccounts(); "Kindle Account name - ? "+accounts[0].name
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Aaron Oneal avatar image
Aaron Oneal answered
Thanks!
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Aaron Oneal avatar image
Aaron Oneal answered
Using the AccountManager approach I was able to retrieve the full name of the account owner, e.g. "Bob Marley" which is a good start for now. But, the device shows the text "Bob's 2nd Kindle" on the top status bar which I would like to match. Is there a way to retrieve the user customized device name as well in order to display a similarly formatted string?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Bipin@Amazon avatar image
Bipin@Amazon answered
How about concatenating with product. Log.i("test",("android.os.Build.PRODUCT: " + android.os.Build.PRODUCT)); this would give -> I/test: android.os.Build.PRODUCT: Kindle Fire " Bob Marley's Kindle Fire " Hope this is useful
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Aaron Oneal avatar image
Aaron Oneal answered
Thanks, but I was hoping to find a way to access the custom Kindle name for when a single account has multiple devices associated with it. That is, Kindle users can set a custom name like "My 2nd Kindle". On a network, this is more useful to display than just the account and device type since 2 or more devices may all have the same account name and build type.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.