Skip to content

lastminutelabs/Device-Aware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ActAsDeviceAware
================

This plugin is rails wrapper around dotmobis http://deviceatlas.com ruby library. It allows you to integrate the Device Atlas database into your action controllers. Device Atlas is a database of mobile handsets properties. For each view requests you can check properties such as display widths and heights, maximum image dimensions etc and scale content appropriately. 

This plugin requires that json and rubyzip gems are available on your system.


Example
=======

1. gem install json

2. gem install rubyzip

3. Make sure that 'lib/data' directory was created in your rails app, the plugin stores the json data file there. 

4. Edit the rake task file and replace the dummy value for license key with your own key. You need to register with deviceatlas.com

5. run the rake task 'deviceatlas_update', which will download the latest json data file from deviceatlas.com

6. include ActsAsDeviceAware in your desired controller, for example like this:
	class WelcomeController < ApplicationController
	  include ActsAsDeviceAware
	
7. Format you views given the known device properties using the variable @device_atlas_data, for example
	<% if !@device_atlas_data["vendor"].nil? &&  
		  !@device_atlas_data["developerPlatformVersion"].nil? && 
		   @device_atlas_data["vendor"] == 'Sony Ericsson' && 
		   @device_atlas_data["developerPlatformVersion"].to_f >= 7 %>
		<p>Your using a Sony Ericsson that can determine its cell tower data in j2me.</p>
	<% end %>

Copyright (c) 2008-2009 lastminute.com , released under the MIT license

About

rails plugin for device atlas database

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published