Lesson Plan: Unit - 07
Subject: P15A2AAD - Android Application Development
Topic of Study: Working with Flash and Telephony Utilities
Grade/Level: Master of Computer Applications
Objective: Working with Flash and Telephony Utilities
Time Allotment: 55 Minutes
Subject: P15A2AAD - Android Application Development
Topic of Study: Working with Flash and Telephony Utilities
Grade/Level: Master of Computer Applications
Objective: Working with Flash and Telephony Utilities
Time Allotment: 55 Minutes
- Working with Flash and Telephony Utilities
- For those web developers wanting to bring their Flash applications to mobile, Android is the only smart phone platform currently supporting desktop Flash 10.1.
- Let’s look at some of the facts:
- Flash applications and websites out there that can now be accessed from Android devices.
- Native Android applications are always going to perform better.
- Deciding to build Flash applications for the Android platform instead of native Java applications is a design decision that should not be taken lightly.
- You can’t expect all Flash applications to just be loaded up work.
- Android devices with Android 2.2 and higher can run Flash applications.
- In order to run Flash, the Android device must have Adobe’s Flash Player for Android installed.
- Users can download the Adobe’s Flash Player for Android application from the Android Market.
- Users can enable or disable it, and you can control whether plug-ins are enabled or not within your screens that use the WebView control.
- Building AIR Applications for Android
- Adobe has created tools for developing cross platform applications using their AIR tool suite in ActionScript 3.
- It is Adobe’s web scripting language for web and Flash applications.
- The company recently announced Adobe AIR for Android, which enables developers to create AIR applications that can be compiled into native Android APK files that can then be published like any other Android application.
- Working withTelephony Utilities
- The Android SDK provides a number of useful utilities for applications to integrate phone features available on the device.
- Phones typically support a Short Message Service (SMS), which is popular for texting.
- Because many Android devices are phones, applications frequently deal with phone numbers and the contacts database.
- Gaining Permission to Access Phone State Information:
- How to determine telephony state of the device, including the ability to request the hook state of the phone, information of the phone service, and utilities for handling and verifying phone numbers.
- The TelephonyManager object within the android.telephony package is a great place to start.
- The READ_PHONE_STATE permission is required to retrieve information such as the call state, handset phone number, and device identifiers or serial numbers.
- The ACCESS_COARSE_LOCATION permission is required for cellular location information.
- Requesting Call State:
- You can use the TelephonyManager object to retrieve the state of the phone and some in-formation about the phone service itself, such as the phone number of the handset.
- One important method is getCallState() can determine the voice call status of the handset.
- You can request an instance of TelephonyManager using the getSystemService() method, like this:
- Exa.
- TelephonyManager telManager = (TelephonyManager)
- getSystemService(Context.TELEPHONY_SERVICE);
- Requesting Service Information:
- The following code retrieves several pieces of service information:
- String opName = telManager.getNetworkOperatorName();
- Log.i(“telephony”, “operator name “ + opName);
- String phoneNumber = telManager.getLine1Number();
- Log.i(“telephony”, “phone number “ + phoneNumber);
- String providerName = telManager.getSimOperatorName();
- Log.i(“telephony”, “provider name “ + providerName);
- Working with Phone Numbers:
- The Android SDK includes a set of helpful utility functions that simplify handling of phone number strings.
- Exa. uses the formatNumber()method:
- String formattedNumber= PhoneNumberUtils.formatNumber(“999*******”);
- Log.i(“telephony”, formattedNumber);
- Phone numbers can also be compared using a call to the PhoneNumberUtils.compare() method.
- PhoneNumberUtils.isEmergencyNumber(), which enables your application to warn users before they call an emergency number.