Re: [android-developers] figure out country in a device without SIM card
On Tue, Feb 15, 2011 at 10:15 AM, Leszek Koltunski lkoltun...@gmail.com wrote: Hello Android gurus, In my game I've got a 'global leaderboard' where people submit their high scores and check how others are doing. There I display a little flag to show where a particular player is from. To figure that out, I use public String getIso() { TelephonyManager tM =((TelephonyManager) mMain.getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE)); return tM.getSimCountryIso(); } That works nicely on any phone; however, recently people started using the new fad, tablets. Those generally do not have a SIM card, so whenever such user contacts my server I can see that getSimCountryIso() must have returned NULL ( or maybe an empty string ) and I am unable to figure out the country. Any tips? How about system locale and maybe if you are ambitious GeoIP? -- Daniel Drozdzewski -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] figure out country in a device without SIM card
Locale.getDefault(); -- Kostya 15.02.2011 13:15, Leszek Koltunski пишет: Hello Android gurus, In my game I've got a 'global leaderboard' where people submit their high scores and check how others are doing. There I display a little flag to show where a particular player is from. To figure that out, I use public String getIso() { TelephonyManager tM =((TelephonyManager) mMain.getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE)); return tM.getSimCountryIso(); } That works nicely on any phone; however, recently people started using the new fad, tablets. Those generally do not have a SIM card, so whenever such user contacts my server I can see that getSimCountryIso() must have returned NULL ( or maybe an empty string ) and I am unable to figure out the country. Any tips? L. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kostya Vasilyev -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] figure out country in a device without SIM card
On 15 February 2011 11:20, Kostya Vasilyev kmans...@gmail.com wrote: Locale.getDefault(); This is not a solution. I do use different locale than i should in the country i am in. Moreover, some phones does not offer certain locales so users are forced to stick with english for example. I'd go for geoIP type of solution or simply let user choose the country on registration. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en