How to display Device Model and OS Version in Android using Basic4Android

Good day! This is my other tutorial on how to find and display your Android OS Version and your Device Android Model. The version history of the Android mobile operating system began with the release of the Android beta in November 2007. The first commercial version, Android 1.0, was released in September 2008. Today, the latest Android version is the Android KitKat 4.4. The most recent major Android update was KitKat 4.4, which was released to commercial devices on 22 November 2013. On this, you need to create two buttons and named it as "btnDeviceModel" and "btnOSVersion". Next, named your abstract design as "main". Your abstract designer will be like this one below: Designer Declare your variable in the Sub_Global like this:
  1. Sub Globals
  2.         'These global variables will be redeclared each time the activity is created.
  3.         'These variables can only be accessed from this module.
  4.    Dim ph As ICOSPhone
  5.         Dim btnDeviceModel As Button
  6.         Dim btnOSVersion As Button
  7. End Sub
Dim ph As ICOSPhone - ph here is our variable for ICOSPhone in which it has all the necessary libraries in using phone utilities. Dim btnDeviceModel As Button - we use a button to display the Device Model of your phone. Dim btnOSVersion As Button - we use a button to display the Device Model of your phone. Now create a new activity. It should look like this:
  1. Sub Activity_Create(FirstTime As Boolean)
  2.         'Do not forget to load the layout file created with the visual designer. For example:
  3.         Activity.LoadLayout("main")
  4. End Sub
Now your activity when run will look like this: activitycreate Next, type the following code below. That code means to display the phone device model when our btnDeviceModel will click.
  1. Sub btnDeviceModel_Click
  2.         Msgbox(ph.DeviceModel,"Device Model")
  3. End Sub
The ph.DeviceModel here is the method used to display the Device Model. When you click this button, it will display like this image below: devicemodel Next, type the following code below. That code means to display the phone Android OS Version when our btnDeviceModel will click.
  1. Sub btnOSVersion_Click
  2.         Msgbox(ph.OSVersion,"OS Version")
  3. End Sub
The ph.OSVersion here is the method used to display the OS Version of your phone. When you click this btnOSVersion button, it will display like this image below: osversion Here's the full code of this tutorial:
  1. Sub Process_Globals
  2.         'These global variables will be declared once when the application starts.
  3.         'These variables can be accessed from all modules.
  4. End Sub
  5.  
  6. Sub Globals
  7.         'These global variables will be redeclared each time the activity is created.
  8.         'These variables can only be accessed from this module.
  9.    Dim ph As ICOSPhone
  10.         Dim btnDeviceModel As Button
  11.         Dim btnOSVersion As Button
  12. End Sub
  13.  
  14. Sub Activity_Create(FirstTime As Boolean)
  15.         'Do not forget to load the layout file created with the visual designer. For example:
  16.         Activity.LoadLayout("main")
  17. End Sub
  18. Sub Activity_Resume
  19. End Sub
  20.  
  21. Sub Activity_Pause (UserClosed As Boolean)
  22.  
  23. End Sub
Sub btnDeviceModel_Click Msgbox(ph.DeviceModel,"Device Model") End Sub Sub btnOSVersion_Click Msgbox(ph.OSVersion,"OS Version") End Sub For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below. Best Regards, Engr. Lyndon R. Bermoy IT Instructor/System Developer/Android Developer STI College - Surigao City Mobile: 09488225971 E-mail:[email protected] Follow and add me in my Facebook Account: https://www.facebook.com/donzzsky

Add new comment