system.getInfo("name") always returns "unknown" on Android devices?

We are in the process of creating a multiplayer game, and to make thing’s easier for now we are using the device name to identify the player

my\_name = system.getInfo( "name" )

On iOS this works fine, and will return something along the lines of “Alan’s iPad”.

On Android however, it always returns “unknown”, so no one can tell which player they are.

My build.settings file is set up as follows, and as far as I am aware only the phone state permission should be needed to get the phone name:

settings = { orientation = { default = "landscapeRight", supported = {"landscapeRight", "landscapeLeft"} }, iphone = { plist= { UIStatusBarHidden=true, UIApplicationExitsOnSuspend = true, }, }, android = { versionCode = "1", }, androidPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.READ\_PHONE\_STATE" }, } 

Have I missed something? Or do Android devices not have a name?

I noticed that when I first plugged my HTC Sensation into my Mac, it always showed the name as “unknown” there too.

Hi @AlanPlantPot,

I’m pretty sure Android just doesn’t return this kind of “naming” schema like Apple does, i.e. “Joe’s iPad”, which is why Corona’s “system.getInfo” doesn’t return it on Android. You can, of course, try to use the other information as a kind of identifier, like “model”, but on Android that can return some very odd (formatted/spelled) device/model names.

Regards,

Brent Sorrentino

I had a feeling that was the case. No worries, I’ve added a textfield for the user to input their name now anyway.

Hi @AlanPlantPot,

I’m pretty sure Android just doesn’t return this kind of “naming” schema like Apple does, i.e. “Joe’s iPad”, which is why Corona’s “system.getInfo” doesn’t return it on Android. You can, of course, try to use the other information as a kind of identifier, like “model”, but on Android that can return some very odd (formatted/spelled) device/model names.

Regards,

Brent Sorrentino

I had a feeling that was the case. No worries, I’ve added a textfield for the user to input their name now anyway.