Question regarding the blog post: "device detection on steroids"

Hello, it’s me again.

I’ve been diving down into a lot of the older blog posts to see how I could start converting/making my app conform to tvos, ios and windows soon from my android oriented code and stumbled upon this.

https://coronalabs.com/blog/2012/12/11/device-detection-on-steroids/

Now when this guide was created, did the corona api have the platformName?  I’m trying to see if it’s worth it to update the old script. Because the getInfo ‘model’ doesn’t work for windows as it states in the docs.  I would still have to target nook/kindle/ipad looking at the daily build available outputs for platformName being pretty general.

Now i saw rob posted it, so hopefully he can chime in and let me know what’s the best way to go about this and if it’s even worth it at the point in time now. 

thanks so much.

Hi @noriega,

Yes, we still have the “platformName” option for “system.getInfo()”. Periodically we update this with new return possibilities (for new platforms), so it’s always best to consult the latest documentation, not necessarily a blog post from 2012. :slight_smile:

https://docs.coronalabs.com/daily/api/library/system/getInfo.html

Take care,

Brent

oh yes. that’s what i have been doing, consulting the latest documentation.  just stumbled upon the blog as well and thought it was a good idea to ask just to see if there was an easier way for a (somewhat complex) project i’ve been working on.

I wanted to formulate a sort of device detection utility for various lua module files i have already developed.  I hope to have it put on github hopefully soon so that others can use it as well.

thanks for the help bret :slight_smile:

platformName basically returns you the operating system. This can be fine to make OS related decisions. I chose to go with the “model” string because I wanted to know if I was on an iPhone or iPad. The platformName option doesn’t provide that.  Also Android is great for some decisions, but when I developed it, it was important to know if you were on a Kindle Fire because of their 20px softbar at the bottom of the screen. You also needed to know if you were on a Nook if you were doing IAP and were using Fortumo plugin.

Tutorials are not designed to produce perfect drop-in code, but more to inspire you on how to do things. We can’t foresee how you’re going to implement things in your app and what rules you need to follow. All we can do give you a solid starting point on concepts.

Rob

Hi @noriega,

Yes, we still have the “platformName” option for “system.getInfo()”. Periodically we update this with new return possibilities (for new platforms), so it’s always best to consult the latest documentation, not necessarily a blog post from 2012. :slight_smile:

https://docs.coronalabs.com/daily/api/library/system/getInfo.html

Take care,

Brent

oh yes. that’s what i have been doing, consulting the latest documentation.  just stumbled upon the blog as well and thought it was a good idea to ask just to see if there was an easier way for a (somewhat complex) project i’ve been working on.

I wanted to formulate a sort of device detection utility for various lua module files i have already developed.  I hope to have it put on github hopefully soon so that others can use it as well.

thanks for the help bret :slight_smile:

platformName basically returns you the operating system. This can be fine to make OS related decisions. I chose to go with the “model” string because I wanted to know if I was on an iPhone or iPad. The platformName option doesn’t provide that.  Also Android is great for some decisions, but when I developed it, it was important to know if you were on a Kindle Fire because of their 20px softbar at the bottom of the screen. You also needed to know if you were on a Nook if you were doing IAP and were using Fortumo plugin.

Tutorials are not designed to produce perfect drop-in code, but more to inspire you on how to do things. We can’t foresee how you’re going to implement things in your app and what rules you need to follow. All we can do give you a solid starting point on concepts.

Rob