Step 1

Enter your contact information.

Step 2

Enter your project information.

Step 3

Choose the PHP programmers you want to hire.

Compare Free PHP Quotes





Country



Titanium Mobile Android Development: Device Information

*Attention PHP Programmers* - Add A Free Listing! Get more clients.

Win a new Compaq Presario Notebook!

In this series of tutorials we use Appcelerator’s Titanium Mobile platform to create Android applications. This tutorial walks you through developing and packaging an application which shows information about the device the app is running on. Full source and packaged application is available on github.

The Application

The application will show the following pieces of information:

The User Interface

The user interface is made up of one Window and seven Labels.

The Application

The application displays many instances of Titanium’s Label class. We apply some basic styling such as the height of the label, distance from the top of the window, color and font size. We get all the system information we need through the Titanium.Platform and Titanium.Network classes. Note that if we didn’t set a top attribute on each label then they would all appear one on top of the other. After instantiating the Window and Labels we need to attach each label onto the instance of Window so that they are displayed. This is done using the add method on the instance of Window.

Resources/app.js

Titanium.UI.setBackgroundColor('#000');

var window = Titanium.UI.createWindow({
    title:'Query7 Device Information',
    backgroundColor:'#F3F1E9',
});

var label_title = Titanium.UI.createLabel({

    height:40,
    top:0,
    left:0,
    width: '100%',
    backgroundColor: '#3F464F',
    color: '#F3F1E9',
    textAlign: 'center',
    text: 'Query7 Device Information',

});

var label_platform_name = Titanium.UI.createLabel({

    height: 40,
    top:50,
    color: '#31363E',
    font: {fontSize:15},
    text: 'Device: ' + Titanium.Platform.model,

});

var label_memory_usage = Titanium.UI.createLabel({

    height:40,
    top:100,
    color: '#31363E',
    font: {fontSize:15},
    text: 'Free RAM: ' + Math.round(Titanium.Platform.availableMemory / 1024) + 'mb',

});

if(Titanium.Network.online)
{
    text_internet_status = 'Internet via ' + Titanium.Network.networkTypeName;
}
else
{
    text_internet_status = 'No Internet Access';
}

var label_internet_status = Titanium.UI.createLabel({

    height:40,
    top:150,
    color: '#31363E',
    font: {fontSize:15},
    text: text_internet_status,

});

var label_mac_address = Titanium.UI.createLabel({

    height:40,
    top:200,
    color: '#31363E',
    font: {fontSize:15},
    text: 'MAC Address: ' + Titanium.Platform.macaddress,

});

var label_cpu_info = Titanium.UI.createLabel({

     height:40,
     top:250,
    color: '#31363E',
    font: {fontSize:15},
    text: Titanium.Platform.ostype + ' CPU',

});

var label_version = Titanium.UI.createLabel({

    height:40,
    top:300,
    color: '#31363E',
    font: {fontSize:15},
    text: 'Android: ' + Titanium.Platform.version,

});

window.add(label_title);
window.add(label_platform_name);
window.add(label_memory_usage);
window.add(label_internet_status);
window.add(label_mac_address);
window.add(label_cpu_info);
window.add(label_version);

window.open();

Updating Free RAM

While our application is running the level of available memory will constantly be changing. We can easily update the level of Free RAM displayed in our application using the JavaScript function setInterval(). As shown below, we reassign the text attribute of label_memory_usage (which was set above) every 120 milliseconds.

setInterval(function()
{
	label_memory_usage.text = 'Free RAM: ' + Math.round(Titanium.Platform.availableMemory / 1024) + 'mb'
},120);

Packaging

Every time you test your application in the Android emulator, a local unsigned package of your application is created. You can copy this .apk from path/to/app/build/android/bin/ directly on to your mobile device to see how your app handles. This is fully useable. However if you intend to publish your application onto the Android Market then read how to sign and package your application here.

If you have any comments, questions or requests for tutorials, please ask below.

Source http://query7.com/?p=1324
Mon, 21 Mar 2011 07:00:08 GMT
Tags: Android, Titanium Mobile, Web Development,

*Attention PHP Programmers* - Add A Free Listing! Get more clients.


Android


Titanium Mobile Android Development: Installation

In this series of tutorials we use Appcelerator’s Titanium Mobile platform to create Android applications. This tutorial goes over the installation and configuration of the Android SDK and Titanium Mobil

Titanium Mobile Android Development: Soundboard App

In this series of tutorials we use Appcelerator’s Titanium Mobile platform to create Android applications. This tutorial walks you through developing and packaging a soundboard application. Full source and packaged application is available on Titanium Mobile Android Development: First Application

In this series of tutorials we use Appcelerator’s Titanium Mobile platform to create Android applications. This tutorial walks you through developing and packaging your first Titanium application. Full source and packaged application is available on

Titanium Mobile


Web Development


Using Proxies with cURL in PHP

If you are new to using PHP and cURL please refer to the PHP cURL tutorial. It covers why you should using cURL (as opposed to file_get_contents) and goes over how to make cURL requests with a custom class.

This Week in Web – PHP Namespaces, NodeTuts, Kohana

Interview with Matthew Weier O’Phinney

Kevin Schroeder, tech evangelist at Zend, recently interviewed Zend Framework lead Matthew Weier O’Phinney. The two talk about Weier O’

Members:
Mesa
Hamilton Arts Profile
Hamilton Arts

Let Hamilton Arts assist you with your web design needs. We can assure you that our design will not only impress but also work within your budget.

Mesa, Arizona US
New Port Richey
CQuinnDesign Profile
CQuinnDesign

We provide affordable php website design & SEO services to our clients. Our HTML is search engine friendly and builds a solid foundation for your SEO & marketing campaign. WE provide free estimates.

New Port Richey, Florida US
Franklin
Spectrum Nashville Profile
Spectrum Nashville

Spectrum Nashville is committed to providing reasonable, excellent business technology solutions that simply work.

Franklin, Tennessee US
Lahore
id4brands Profile
id4brands

I am Graphics Designer, I have Experience in this Field more than 10 years. i mostly work in print field. Products Catalog, e-catalog, brochures, flyers, brands names. logos. business cards.

Lahore, Punjab PK
Chelsea
Ann Arbor Software Profile
Ann Arbor Software

Chelsea, Michigan US
Design Leads


PHP Programmers Valid HTML 4.0 Transitional Valid CSS!

Google Pools WebM Video Supporters for Patent Protection

Google has announced the new WebM Community Cross License (CCL) initiative. The new group is designe



Internet Explorer Market Share Surges, as IE 9 Wins Hearts and Minds

The browser wars are back and Internet Explorer 9 is gaining converts. For the second time this year



Sync Your Browsing Life With New Chrome 16

The latest version of Google's web browser syncs your data between PCs, bringing your bookmarks, app



Mozilla Plans Faster Firefox Development Model

Firefox 4, the latest incarnation of Mozilla’s popular web browser, will arrive in final form



CSS 3 Box Shadow Showcases Browser Differences

The CSS 3 box-shadow property allows for drop shadows and other gradient-based effects without the n



Article Tags
PHP Programmers Articles
Browsers| Web Standards| CSS| HTML5| Web Basics| firefox| Programming| Web Services| Mobile| JavaScript| Web Development| Multimedia| Visual Design| chrome| Google| responsive design| This Week in Web| CSS 3| Opera| Web Apps|
Friends:
Live Help Chat Software
Web Design Quote
Web Design