Friday, 10 August 2012

Android Application User Interface & Custom GUI Components


Android user interface (UI and GUI) components

The following gives a short overview of the most important user interface Android components groups

Android Application User Interface And Custom GUI Components
android Components

  Activity

An Activity represents the presentation layer of an Android application. A  simplified description is that an Activity represents a screen in your Android application. Compared to desktop development, Activities are equivalent to Forms. 
- Activity is Your application’s presentation layer.
- An Android application can have several Activities.
- An activity provides a user interface for a single screen in your application .
- Activities can move into the background and then be resumed with their state restored .
- You’ll learn more about Activities later in coming articles.

Views and ViewGroups .

An activity contains  views and ViewGroups. A view is a widget that has an appearance on screen. 
Examples of views (GUI graphical user interface components) are buttons, labels, and text boxes. A view derives from the base class android.view.View . Views have attributes which can be used to configure their appearance and behavior.
A ViewGroup is a special view that can contain other views (called children.) The view group is the base class for layouts and views containers. This class also defines the ViewGroup.LayoutParams class which serves as the base class for layout parameters .
-  A ViewGroup is responsible for arranging other Views.
 - ViewGroups can be nested to create complex layouts. You should not nested ViewGroups too deeply as this has a negative impact on the performance.

Intents

A powerful application message passing framework. Intents are used extensively throughout Android. You can use Intents to start and stop Activities and Services, to broadcast messages system-wide or to an explicit Activity, Service, or Broadcast Receiver, or to request an action be performed on a particular piece of data.
- Intents are asynchronous messages which allow the application to request functionality from other components of the Android system.
- Intent example is the application can call a component directly (explicit Intent) or ask the Android system to evaluate registered components based on the Intent data  ) implicit Intents ). 
- For example the application could implement sharing of data via an Intent and all components which allow sharing of data would be available for the user to select. Applications register themselves to an Intent via an IntentFilter.
- Intents allow to combine loosely coupled components to perform certain tasks.

Services

The invisible workers of your application. Service components run without a UI, updating your data sources and Activities, triggering Notifications, and broadcasting Intents. 
They’re used to perform long running tasks, or those that require no user interaction (such as network lookups or tasks that need to continue even when your application’s Activities aren’t active or visible.) 
- Services perform background tasks without providing a user interface. 
- They can notify the user via the notification framework in Android.

ContentProvider

Shareable persistent data storage. Content Providers manage and persist application data and typically interact with SQL databases. They’re also the preferred means to share data across application boundaries. You can configure your application’s Content Providers to allow access from other applications, and you can access the Content Providers exposed by others. 
- Android devices include several native Content Providers that expose useful databases such as the media store and contacts. 
- Your application can share data with other applications.
- Android contains an SQLite database which is frequently used in conjunction with a ContentProvider. 
- The SQLite database would store the data, which would be accessed via the ContentProvider.

BroadcastReceiver

Intent listeners. Broadcast Receivers enable your application to listen for Intents that match the criteria you specify. Broadcast Receivers start your application to react to any received Intent, making them perfect for creating event-driven applications.
- BroadcastReceiver registered to receive system messages and Intents. 
- BroadcastReceiver will get notified by the Android system, if the specified situation happens. 
- BroadcastReceiver could get called once the Android system completed some event .

HomeScreenWidgets

Visual application components that are typically added to the device home screen. 
A special variation of a Broadcast Receiver, widgets enable you to create dynamic, interactive application components for users to embed on their home screens.
-  Widgets are interactive components which are primarily used on the Android home screen.
- They typically display some kind of data and allow the user to perform actions via them. --- - For example a Widget could display a short summary of new emails and if the user selects an email, it could start the email application with the selected email.


Notifications 

 Notifications enable you to alert users to application events without stealing focus or interrupting their current Activity.
 They’re the preferred technique for getting a user’s attention when your application is not visible or active, particularly from within a Service or Broadcast Receiver. For example, when a device receives a text message or an email, the messaging and Gmail applications use Notifications to alert you by flashing lights, playing sounds, displaying icons, and scrolling a text summary. You can trigger 

Other Android user interface (UI and GUI) components 

Android provides many more components but the list above describes the most important ones. Other Android components are Live Folders and Live Wallpapers .  Live Folders display data on the home screen without launching the corresponding application while Live Wallpapers allow to create animated backgrounds.

Android custom components

Android offers a sophisticated and powerful componentized model for building your UI, based on the fundamental layout classes: View and ViewGroup.
For more details about android custom components check this article  :  Android custom components

Monday, 6 August 2012

Android Vs Other Platforms & Feature For Android Users.

android vs ios platforms
In the previous article (Why Developing For Android Mobile Devices? Marketer, Developer Perspective.) we discuss why DEVELOP FOR ANDROID also why develop of general mobile platforms from the developer perspective, in this article we will continue explain why you must develop for android from user perspective and  why android different from other platforms and finally will explained the major difference between j2me and IOS and compare them with an android platform.
First of all let us explore the feature that android provide for the end user.

For end users - android user perspective 

- No license fee
- More than 30K application in the market with 61% are free apps
- Supported by dozens of hardware manufacturers
- Low price smart-phone devices
- Abilities to integrate with Google’s services
- Android Takes Lead in US Smartphone Market
- In January 2011, 31.2% of smartphone market, (7.1% in 2010), 30.4% Blackberry, and 24.7% iPhone

What Android Has That Other Platforms Don’t Have


Many of the features listed in the previous article (what is android? Developer applications guide), such as 3D graphics and native database support, are also available in other native mobile SDKs, as well as becoming available on mobile browsers. 
The following non comprehensive list details some of the features available on Android that may not be available on all modern mobile development platforms:
- Google Maps applications 
 The Map View lets you display, manipulate, and annotate a Google Map within your Activities to build map-based applications.
- Background services and applications 
You can create applications based on an event-driven model, working silently while other applications are being used or while your mobile sits ignored until it rings, flashes, or vibrates to get your attention. 
Android provides the same opportunities for all applications and developers.
- Shared data and inter-process communication 
 Using Intents and Content Providers, Android lets your applications exchange messages, perform processing, and share data between other application. 
- All applications are created equal 
Android doesn’t differentiate between native applications and those developed by third parties. This gives consumers unprecedented power to change the look and feel of their devices by letting them completely replace every native application with a third-party alternative that has access to the same underlying data and hardware.
- Wi-Fi Direct and Android Beam
Using these innovative new inter-device communication APIs, you can include features such as instant media sharing and streaming. 
- Home-screen Widgets, Live Wallpaper, and the quick search box 
 Using Widgets and Live Wallpaper, you can create windows into your application from the phone’s home screen.  
The quick search box lets you integrate search results from your application directly into the phone’s search functionality.

Android vs. J2ME

- Multiple device configurations
- J2ME has 2 classes of micro devices
- Android offers only one
- Ease of understanding
- J2ME has multiple UI model (MIDlets, Xlets, AWT, Swing …)
- Android support for only one, so it would be more easier to understandthan J2ME
- Responsiveness
- Dalvik VM vs. JVM
- Dalvik VM vs. KVM
- Java compatibility
- Android runs .dex bytecode
- Runtime interpretation of Java bytecode is not possible
- Adoption
- Most of mobile phone support for J2ME
- But uniformity, cost, ease of development in Android are the reasons for java developer to program for it
- Java SE support
- Android support for J2SE more complete than J2ME CDC (except AWT & Swing)

Apple vs. Android


- Games 52.2% of app sales in 2010
- 350K apps in iStore, 130K in Android market - 294K in may .
 - Android easiest to write for Tools plus getting published
-  Fragmented hardware

Why Developing For Android Mobile Devices? Marketer, Developer Perspective.

WHY DEVELOP FOR MOBILE?

In market terms, the development of modern mobile Smartphones multifunction devices including a phone but featuring a full featured web browser, cameras, media players, WI-Fi, and location-based services have fundamentally changed the way people interact with their mobile devices and access the Internet which increasing the development trends for  Developing Android Mobile application for a lot of devices.

-  More than 3 billion mobile phone users around the worldwide and many developers.
- 2009 marked the year that more people accessed the Internet for the first time from a mobile phone rather than a PC.
- Access the Internet by mobile phone like android and IOS devices will increase than using personal computers.
- High-speed mobile data and WI-Fi hotspots, has created a huge opportunity for advanced mobile applications.
- Smartphone applications have changed the way people use their phones. This gives you, the application developer a unique opportunity to create dynamic, compelling new applications that become a vital part of people’s lives.

WHY DEVELOP FOR ANDROID?

The first question that every developer is asking himself, before learning, or take training about new technology or spending a time to search a resources is why develop for Android? Why Android platforms and not any other platforms? I'm going to show you the answer of this question into those reasons in this Blog.

From Developer perspective 

ANDROID MARKET SHARE

- The number of Android phones sold every day is larger than that of any other mobile phone operating system (at least in the United States and Europe). Moreover the number of Android phones sold in those regions keeps growing, so after applying some simplest math skills, it becomes evident that unless something extraordinary happens we can clearly say that Android is the platform that's going to have the most users in the future, maybe it will even become a standard for all phones. And that means that you will have more people who can buy or use your product also more developer for Android OS. 
-  Android represents a clean break, a mobile framework based on the reality of modern mobile devices designed by developers, for developers.
-  Simple, powerful, and open SDK which include all tools for the Android mobile developer.
 - Licensing fees except Google market account 25$ for ever.
 - Very good and excellent documentation.
- Huge developer community, Android represents an opportunity to create software that changes how and why people use their mobile phones.
- No certification is required to become an Android developer.
- Google Play provides free, up-front purchase, and in-app billing options for distribution and monetization of your applications.
- There is no approval process for application distribution.  Developers have total control over their brands.
- More than 850,000 new Android devices are activated daily, with many studies showing the largest proportion of new Smartphone sales belonging to Android devices.
As of March 2012, Google Play (formerly Android Market) has expanded its support for application sales to 131 countries, supporting more than 10 billion installs at a growth rate of 1 billion downloads per month.

- JAVA PROGRAMMING LANGUAGE 

Apple products, like the iPhone, use Objective C (all developer talk is complicated language when compares it with other common language) that was invented by Apple. However if you want to develop apps for Android the only thing that you need to know is Java and Android API for Java. Unlike Objective C, Java is a very powerful programming language that has been around for 15 years and thus has millions of pages of articles about it, tutorials, books, courses, learning materials, also very powerful integrated with oracle products etc. As well as a lot of professionals who have experience working with Java and a lot of libraries and other kinds of enhancements. And besides that - the experience that you get from programming for Android you might also use in a lot of other fields.
Remember : Java is the android programming language which needs it to build our applications .

Publishing the app to the Market (Google play ) .

Google offers the Google Play service in which programmers can offer their Android application to Android users. Google phones include the Google Play application which allows installing applications.
Google Play also offers an update service, e.g. If android developer uploads a new version of his application to Google Play, this service will notify existing users that an update is available and allow to install it.
Google Play used to be called Android Market.
To be able to publish the app on the google play you need the following
- Requires Google Developer Account
- $25 fee
- Link to a Merchant Account
- Google Checkout
- Link to your checking account
-  Google gets 30% you get 70% .

Saturday, 4 August 2012

What is Android? Developer Applications Guide

How to develop Android applications ? First You need What is Android?

Google’s Andy Rubin describes Android as: 

The first truly open and comprehensive platform for mobile devices, all of the software to run a mobile phone but without the proprietary obstacles that have hindered mobile innovation.

What I need For developing Android Application? 

To develop Android applications  you needs the following thing :

First of All , you must Know  a Few  about Android operating system which is based on Linux with a Java programming interface.   [ So You must Know Java Programming To write the Android App] .
All Android applications written in Java and converted to the Dalvik executable .dex

Second : you need (Android SDK)  Software Development Kit  .
The SDK provides all necessary tools to develop Android applications also The Android SDK provides you the API libraries  and developer tools necessary to build, test, and debug apps for Android.
We will discuss all tools later step by step which we needed to develop application , but now just keep in mind you need know Java [ if you not java developer , don't worry about it ] and install The SDK .

Features of Android

Storage

Uses SQLite, a lightweight relational database, for data storage

Connectivity

Supports GSM/EDGE, IDEN, CDMA, EV-DO, UMTS, Bluetooth includes A2DP and AVRCP, WiFi, LTE, and WiMAX

Messaging

Supports both SMS and MMS

Web browser

Based on the open-source WebKit, together with Chrome’s V8 JavaScript engine

Media support

Includes support for the following media: H.263, H.264 (in 3GP or MP4
Container), MPEG-4 SP, AMR, AMR-WB (in 3GP container), AAC, HE-AAC (in
MP4 or 3GP container), MP3, MIDI, Ogg Vorbis, WAV, JPEG, PNG, GIF, and
BMP)

Hardware support

Accelerometer Sensor, Camera, Digital Compass, Proximity Sensor, and GPS
Multi-touch
Supports multi-touch screens

Multitasking

Supports multi-tasking applications

Flash support

Android 2.3 supports Flash 10.1

Tethering

Supports sharing of Internet connections as a wired/wireless hotspot

Security

Android is a multi-process system, in which each application (and parts of the system) runs in its own process. Most security between applications and the system is enforced at the process level through standard Linux facilities, such as user and group IDs that are assigned to applications.  On the other word the Android system will create a unique user and group ID for every Android application. Each application file is private to this generated user, e.g. other applications cannot access these files. 

Additional finer-grained security features are provided through a "permission" mechanism that enforces restrictions on the specific operations that a particular process can perform, and per-URI permissions for granting ad-hoc access to specific pieces of data.

The Android market

Google Play - Android Market  .

Google offers the Google Play service in which programmers (Android Developer) can offer their Android application to Android users. Google phones include the Google Play application which allows to install applications.
Google Play also offers an update service, e.g. if a programmer (Android Developer) uploads a new version of his application to Google Play, this service will notify existing users that an update is available and allow to install it. 

Other Feature For Android Market


- Google Market - Part of GMS Apps .

- 3party apps submitted to Google, approved and distributed through the market.

- Both Free and Paid apps.

- Apps now limited to 50 MB; updates possible through Market Monetization through ads available.

- Available in many countries, not all countries have support for paid apps.

- Other Marketplace applications available – Amazon has announced its own Android Marketplace.

- App searches filtered based on Manifest file - eg. if a device does not have trackball, apps using trackball will be filtered out.

- Every app publishes a list of components the app will access and permissions need to be granted before installation.  
- Apps installed on device and SD card - SD Card from Froyo.

Future possibilities :


- Google Android Sales to Overtake iPhone in 2012

- The OHA is committed to making their vision a reality: to deploy the Android platform for every mobile operator, handset manufacturers and developers to build innovative devices

- Intel doesn’t want to lose ownership of the notebook market, so they need to prepare for anything, including Android

- Fujitsu launched an initiative to offer consulting and engineering expertise to help run Android on embedded hardware, which aside from cell phones, mobile internet devices, and portable media players, could include GPS devices, thin-client computers and set-top boxes.

- More Android devices are coming and some will push the envelope even further .


Wednesday, 1 August 2012

Use any credit or debit card with Google Wallet

(cross-posted from the Google Commerce Blog)

Since we released the first version of Google Wallet, the app that makes your phone your wallet, we’ve made it available on six phones from Sprint and Virgin Mobile, as well as the new Nexus 7 tablet. We’ve also partnered with more than 25 national retailers, and thanks to MasterCard PayPass, you can pay with your phone at more than 200,000 retail locations across the U.S.

Today we’re releasing a new, cloud-based version of the Google Wallet app that supports all credit and debit cards from Visa, MasterCard, American Express, and Discover. Now, you can use any card when you shop in-store or online with Google Wallet. With the new version, you can also remotely disable your mobile wallet app from your Google Wallet account on the web.

 


A wallet with all your credit and debit cards
To save a card to Google Wallet, just enter the number into the mobile app, online wallet, or Google Play when making purchases. When you shop in-store, you can use Google Wallet in conjunction with your selected credit or debit card for purchases (more info here). Shortly after making a payment, you’ll see a transaction record on the phone with the merchant name and dollar amount. You can now view a history of all your in-store and online purchases from the online wallet.





To support all credit and debit cards, we changed our technical approach to storing payment cards. The Google Wallet app now stores your payment cards on highly secure Google servers, instead of in the secure storage area on your phone. A wallet ID (virtual card number) is stored in the secure storage area of the phone, and this is used to facilitate transactions at the point of sale. Google instantly charges your selected credit or debit card. This new approach speeds up the integration process for banks so they can add their cards to the Wallet app in just a few weeks. Banks that want to help their customers save cards to Google Wallet, including their custom card art, can apply here — there is no cost.

A wallet you can lock — and remotely disableWe take security very seriously and have always had a dedicated Google Wallet PIN to prevent others from making payments with your Google Wallet. And as always, we encourage Google Wallet customers to set up the phone’s screen lock -- as an extra layer of protection.

Today, we’re adding a Google Wallet security feature that makes it possible for you to remotely disable your mobile wallet on a lost phone. It’s easy. If you lose your phone, just visit the ‘Devices’ section in the online wallet and select the phone with the mobile wallet you wish to disable. When you successfully disable your wallet on a device, Google Wallet will not authorize any transactions attempted with that device*. If the Google Wallet online service can establish a connection to your device, it will remotely reset your mobile wallet, clearing it of card and transaction data. There is no way you can do that with your leather wallet.


The new Google Wallet app is available now on Google Play, and if you have a supported NFC device and are in the United States, we encourage you to give it a try.

Posted by Robin Dua, Head of Product Management, Google Wallet

* For now, Google Prepaid Cards and some Citi MasterCard cards will remain active until Google Wallet can remotely connect and reset your mobile wallet.

Wednesday, 18 July 2012

Getting Your App Ready for Jelly Bean and Nexus 7

[This post is by Nick Butcher, an Android engineer who notices small imperfections, and they annoy him.]



We are pleased to announce that the full SDK for Android 4.1 is now available to developers and can be downloaded through your SDK Manager. You can now develop and publish applications against API level 16 using new Jelly Bean APIs. We are also releasing SDK Tools revision 20.0.1 and NDK revision 8b containing bug fixes only.



For many people, their first taste of Jelly Bean will be on the beautiful Nexus 7. While most applications will run just fine on Nexus 7, who wants their app to be just fine? Here are some tips for optimizing your application to make the most of this device.



Screen



Giving Nexus 7 its name, is the glorious 7” screen. As developers we see this as around 600 * 960 density independent pixels and a density of tvdpi. As Dianne Hackborn has elaborated, this density might be a surprise to you but don’t panic! We actively discourage you from rushing out and creating new assets at this density; Android will scale your existing assets for you. In fact the entire Jelly Bean OS contains only a single tvdpi asset, the remainder are scaled down from hdpi assets.



To be sure the system can successfully scale your hdpi assets for tvdpi, take special care that your 9-patch images are created correctly so that they can be scaled down effectively:

  • Make sure that any stretchable regions are at least 2x2 pixels in size, else they risk disappearing when scaled down.

  • Give one pixel of extra safe space in the graphics before and after stretchable regions else interpolation during scaling may cause the color at the boundaries to change.

The 7” form factor gives you more space to present your content. You can use the sw600dp resource qualifier to provide alternative layouts for this size screen. For example your application may contain a layout for your launch activity:

res/layout/activity_home.xml
To take advantage of the extra space on the 7” screen you might provide an alternative layout:

res/layout-sw600dp/activity_home.xml
The sw600dp qualifier declares that these resources are for devices that have a screen with at least 600dp available on its smallest side.



Furthermore you might even provide a different layout for 10” tablets:

res/layout-sw720dp/activity_home.xml
This technique allows a single application to use defined switching points to respond to a device’s configuration and present an optimized layout of your content.



Similarly if you find that your phone layout works well on a 7” screen but requires slightly larger font or image sizes then you can use a single layout but specify alternative sizes in dimensions files. For example res/values/dimens.xml may contain a font size dimension:

<dimen name="text_size">18sp</dimen>
but you can specify an alternative text size for 7” tablets in res/values-sw600dp/dimens.xml:

<dimen name="text_size">32sp</dimen>
Hardware



Nexus 7 has different hardware features from most phones:

  • No telephony

  • A single front facing camera (apps requiring the android.hardware.camera feature will not be available on Nexus 7)


Be aware of which system features that you declare (or imply) are required to run your application or the Play Store will not make your application available to Nexus 7 users. Always declare hardware features that aren't critical to your app as required="false" then detect at runtime if the feature is present and progressively enhance functionality. For example if your app can use the camera but it isn’t essential to its operation, you would declare it with:

<uses-feature android:name="android.hardware.camera" 
android:required="false"/>

For more details follow Reto Meier’s Five Steps to Hardware Happiness.

Conclusion

Nexus 7 ships with Jelly Bean and its updated suite of system apps are built to take advantage of new Jelly Bean APIs. These apps are the standard against which your application will be judged — make sure that you’re keeping up!

If your application shows notifications then consider utilizing the new richer notification styles. If you are displaying immersive content then control the appearance of the system UI. If you are still using the options menu then move to the Action Bar pattern.

A lot of work has gone into making Jelly Bean buttery smooth; make sure your app is as well. If you haven’t yet opted in to hardware accelerated rendering then now is the time to implement and test this.

For more information on Android 4.1 visit the Android Developers site or join us Live.

Join the discussion on +Android Developers

Tuesday, 10 July 2012

Google I/O and Beyond

[This post is by Reto Meier, Android Developer Relations Tech Lead]



With most of the Android Developer Relations team now fully recovered from Google I/O 2012, I'm happy to announce that all of the videos for the Google I/O 2012 Android Sessions are now available!



I've included in the Google I/O 12 - The Android Sessions playlist (embedded below), as well as (in keeping with our newly redesigned developer site) in playlists for each developer category: Design, develop, and distribute.







Google I/O is always a highlight on the Android Developer Relations team's calendar; it's our best opportunity to talk directly to the Android developer community. Unfortunately I/O only happens once a year, and only a lucky few thousand can join us in person.



That's why we've been exploring more scalable approaches to interacting with developers, and with the launch of Google Developers Live, we have a way for the entire Android Developer community to view and participate in live, interactive developer-focused broadcasts all year round, and all across the world.



This week we resume our weekly interactive development Q&A Office Hours in three time zones (US, EMEA, and APAC).  We know many of you have questions related to specific I/O sessions, so we've invited all the speakers to join us, starting with this Wednesday's Android Developer Office Hours with Chet Haase, Romain Guy, Xavier Ducrohet, and Tor Norbye from the What's New in Jelly Bean and What's new in Android Developer Tools sessions.



On Friday afternoons we broadcast The Friday Review of Apps and The Friday Review of Games, two more relaxed sessions where we review self-nominated apps and games, providing feedback to the developers in the hope of discovering some feature-worthy gems.



Every Android Developer Live broadcast is recorded and available from Google Developers Live, the Android Developers YouTube channel, and directly from developer.android.com. We've also begun to make each of the Office Hours, as well as the Android sessions from Google I/O 2012, available as part of the Android Developers Live audio podcast.



We're really excited to use Google Developers Live to interact more regularly with you, the most important members of the Android ecosystem, and will be looking to expand our lineup to include regular interviews with app developers and Android engineers.



Got great ideas for how we can expand our live program? Let us know on Google+.