Our tablet application created with Rhomobile is working quite solid now and we continue to improve it with new features. However, we now also want to deploy the same application on smartphones. HTML and CSS have great options for that, designwise, but we also need to know what kind of device we are working with in the Ruby code. Is there a reliable way to determine this for any platform?
In a quick search I found a sollution to check for the device name. This sadly wont be an option for us, since our customers mostly bring their own devices and we dont want to keep track of all devices that these people use.
We use the RhoStudio Suite 2 and have no option to upgrade as of yet.
So far we have tried the following options with no success on the LG Nexus 4:
- Checking the property: System.get_property( "screen_width" ) (Rhomobile | System APIhttp://docs.rhomobile.com/v/2.2/rhodesapi/system-api)
This returns 768, the width in resolution of the phone.
- Checking the property: System.get_property( "real_screen_width" ) (Rhomobile | System API)
This also returns 768, the resolution width of the phone.
Could anyone help us to detect wether we are using a Smartphone or a Tablet when starting our application? (Bonus points if there can be made a diffrence between 7inch and 10inch tablets).