Showing posts with label HowTo-Android. Show all posts
Showing posts with label HowTo-Android. Show all posts

Monday, January 11, 2016

Picking your compileSdkVersion, minSdkVersion, and targetSdkVersion

By Admin   Posted at  12:15 PM   targetSdkVersion No comments

Picking your compileSdkVersion, minSdkVersion, and targetSdkVersion

Depending on the time of the year, it might only be a few months after you release an app that a new version of Android is announced. What does that mean for your app though — is everything going to break?
You’ll be happy to know that forward compatibility is a strong focus of Android — existing apps built against prior SDKs should not break when the user updates to a new version of Android. This is wherecompileSdkVersion, minSdkVersion, and targetSdkVersion come in: they control what APIs are available, what the required API level is, and what compatiblity modes are applied, respectively.

compileSdkVersion

compileSdkVersion is your way to tell Gradle what version of the Android SDK to compile your app with. Using the new Android SDK is a requirement to use any of the new APIs added in that level.
It should be emphasized that changing your compileSdkVersion does not change runtime behavior. While new compiler warnings/errors may be present when changing your compileSdkVersion, your compileSdkVersion is not included in your APK: it is purely used at compile time. (You should really fix those warnings though — they were added for a reason!)
Therefore it is strongly recommended that you always compile with the latest SDK. You’ll get all the benefits of new compilation checks on existing code, avoid newly deprecated APIs, and be ready to use new APIs.
Note that if you use the Support Library, compiling with the latest SDK is arequirement for using the latest Support Library releases. For example, to use the 23.1.1 Support Library, you must have a compileSdkVersion of at least 23 (those first numbers need to match!). In general, a new version of the Support Library is released alongside a new platform version, providing compatibility shims to newly added APIs as well as new features.

minSdkVersion

If compileSdkVersion sets the newest APIs available to you, minSdkVersion is the lower bound for your app. The minSdkVersion is one of the signals the Google Play Store uses to determine which of a user’s devices an app can be installed on.
It also plays an important role during development: by default lint runs against your project, warning you when you use any APIs above your minSdkVersion, helping you avoid the runtime issue of attempting to call an API that doesn’t exist. Checking the system version at runtime is a common technique when using APIs only on newer platform versions.
Keep in mind that libraries you use, such as any of the Support Libraries orGoogle Play services, may have their own minSdkVersion — your app’s minSdkVersion must be at least as high as your dependencies’ minSdkVersion — if you have libraries that require 4, 7, and 9, your minSdkVersion must be at least 9. In rare cases where you want to continue to use a library with a higher minSdkVersion than your app (and deal with all edge cases/ensure the library is only used on newer platform versions), you can use the tools:overrideLibrary marker, but make sure to test thoroughly!
When deciding on a minSdkVersion, you should consider the stats on theDashboards, which give you a global look on all devices that visited the Google Play Store in the prior 7 days — that’s your potential audience when putting an app on Google Play. It is ultimately a business decision on whether supporting an additional 3% of devices is worth the development and testing time required to ensure the best experience.
Of course, if a new API is key to your entire app, then that makes the minSdkVersion discussion quite a bit easier. Just remember that even 0.7% of 1.4 billion devices is a lot of devices.

targetSdkVersion

The most interesting of the three, however, is targetSdkVersion.targetSdkVersion is the main way Android provides forward compatibility by not applying behavior changes unless the targetSdkVersion is updated. This allows you to use new APIs (as you did update your compileSdkVersion right?) prior to working through the behavior changes.
Much of the behavior changes that targetSdkVersion implies are documented directly in the VERSION_CODES, but all of the gory details are also listed on the each releases’ platform highlights, nicely linked in the API Levels table.
For example, the Android 6.0 changes talk through how targeting API 23 transitions your app to the runtime permissions model and the Android 4.4 behavior changes detail how targeting API 19 or higher changes how alarms set with set() and setRepeating() work.
With some of the behavior changes being very visible to users (thedeprecation of the menu button, runtime permissions, etc), updating to target the latest SDK should be a high priority for every app. That doesn’t mean you have to use every new feature introduced nor should you blindly update your targetSdkVersion without testing — please, please test before updating your targetSdkVersion! Your users will thank you.

Gradle and SDK versions

So setting the correct compileSdkVersion, minSdkVersion, and targetSdkVersion is important. As you might imagine in a world with Gradleand Android Studio, these values are integrated into the tools system through inclusion in your module’s build.gradle file (also available through the Project Structure option in Android Studio):
android {
  compileSdkVersion 23
  buildToolsVersion “23.0.1”

  defaultConfig {
    applicationId “com.example.checkyourtargetsdk"
    minSdkVersion 7
    targetSdkVersion 23
    versionCode 1
    versionName “1.0”
  }
}
The compileSdkVersion, being a compile time thing (who would have guessed!), is one of the android settings alongside with your build tools version. The other two are slightly differently in that they are declared at thebuild variant level — the defaultConfig is the base for all build variants and where’d you put default values for these, but you could imagine a more complicated system where specific versions of your app have a different minSdkVersion for example.
minSdkVersion and targetSdkVersion also differ from compileSdkVersion in that they are included in your final APK — if you were to look at the generated AndroidManifest.xml, you’d see a tag such as:
You’ll find if you manually put this in your manifest, it’ll be ignored when you build with Gradle (although other build systems might certainly rely on it being there).

Putting it all together

If you made it through the bolded notes, you’ll notice a relationship between the three values:
minSdkVersion <= targetSdkVersion <= compileSdkVersion
This intuitively makes sense — if compileSdkVersion is your ‘maximum’ and minSdkVersion is your ‘minimum’ then your maximum must be at least as high as your minimum and the target must be somewhere in between.
Ideally, the relationship would look more like this in the steady state:
minSdkVersion (lowest possible) <= 
    targetSdkVersion == compileSdkVersion (latest SDK)
You’ll hit the biggest audience with a low minSdkVersion and look and act the best by targeting and compiling with the latest SDK — a great way to #BuildBetterApps.
Author: Ian Lake

Monday, February 3, 2014

What is Android Architecture?

By Admin   Posted at  4:33 PM   Programming Languages 11 comments

                                  Android Architecture

Hi folks,
In our previous Android Tutorials, we have discussed quite a few concepts of Android development.
We have successfully set up android development environment in our last tutorial; I think that it is time to start with Android Architecture before starting basic android programing we must be aware of android architecture and layer's in android stack .
Androidfulcrum.blogspot.in >> Android Tutorials>> Android Architecture

So lets take a take a quick walk through of the Android Architecture.

Android Architecture: Layers in the Android Stack

The Android stack, as the guys over at Google call it, has a number of layers, and each layer groups together several programs. In this tutorial I’ll walk you through the various layers in Android stack and the functions they are responsible for.

Following are the different layers in the Android stack:
  1. Linux Kernel Layer
  2. Libraries Layer
  3. Application Framework Layer
  4. Applications layer


Kernel Layer:

The basic layer is the Linux kernel. The whole Android OS is built on top of the Linux 2.6 Kernel with some further architectural changes made by Google. It is this Linux that interacts with the hardware and contains all the essential hardware drivers.

Android Architecture: Linux Kernel

At the bottom of the Android stack is the Linux Kernel. It never really interacts with the users and developers, but is at the heart of the whole system. Its importance stems from the fact that it provides the following functions in the Android system:

  • Hardware Abstraction
  • Memory Management Programs
  • Security Settings
  • Power Management Software
  • Other Hardware Drivers (Drivers are programs that control hardware devices.)
  • Support for Shared Libraries
  • Network Stack
As the Android is built on a most popular and proven foundation, it made the porting of Android to variety of hardware, a relatively painless task.

Libraries Layer

Android architecture: Android libraries

The next layer in the Android architecture includes Android’s native libraries. Libraries carry a set of instructions to guide the device in handling different types of data. For instance, the playback and recording of various audio and video formats is guided by the Media Framework Library.
This layer enables the device to handle different types of data. These libraries are written in c or c++ language and are specific for a particular hardware.

Some of the important native libraries include the following:

Surface Manager: It is used for compositing window manager with off-screen buffering. Off-screen buffering means you cant directly draw into the screen, but your drawings go to the off-screen buffer. There it is combined with other drawings and form the final screen the user will see. This off screen buffer is the reason behind the transparency of windows.

Media framework: Media framework provides different media codecs allowing the recording and playback of different media formats.

SQLite: SQLite is the database engine used in android for data storage purposes.

WebKit: It is the browser engine used to display HTML content.

OpenGL & SGL: Used to render 2D or 3D graphics content to the screen.

Free Type: Font Rendering.

Open SSL

Android Runtime

Android Runtime consists of Dalvik Virtual machine and Core Java libraries.
Android architecture: Android runtime layer

Dalvik Virtual Machine
It is a type of JVM used in android devices to run apps and is optimized for low processing power and low memory environments. Unlike the JVM, the Dalvik Virtual Machine doesn’t run .class files, instead it runs .dex files. .dex files are built from .class file at the time of compilation and provides hifger efficiency in low resource environments. The Dalvik VM allows multiple instance of Virtual machine to be created simultaneously providing security, isolation, memory management and threading support. It is developed by Dan Bornstein of Google.
Core Java Libraries
These are different from Java SE and Java ME libraries. However these libraries provides most of the functionalities defined in the Java SE libraries.

Application Framework Layer

Applications framework layer
Android applications directly interact with these blocks of the Android architecture. These programs manage the basic functions of phone like resource management, voice call management etc.

Important blocks of Application framework are:

Activity Manager: Manages the activity life cycle of applications.

Content Providers: Manage the data sharing between applications.

Telephony Manager: Manages all voice calls. We use telephony manager if we want to access voice calls in our application.

Location Manager: Location management, using GPS or cell tower.

Resource Manager: Manage the various types of resources we use in our Application.

Application Layer

Applications layer: Android architecture
The applications is the topmost layer of the Android stack. An average user of the Android device would mostly interact with this layer (for basic functions, such as making phone calls, accessing the Web browser etc.) and this is where our applications are gonna fit. Several standard applications comes pre-installed with every device, such as:
  • SMS client app
  • Dialer
  • Web browser
  • Contact manager
  • Games etc.
As a developer we are able to write an app which replace any existing system app. That is, you are not limited in accessing any particular feature. You are practically limitless and can whatever you want to do with the android (as long as the users of your app permits it). Thus Android is opening endless opportunities to the developer.
I hope you are clear with the basic Android architecture now! So, in next tutorial we will see what are the android app components. So, Stay tuned for more android development tutorials.

This tutorial has been written with an aim to teach you and explore a little bit about what is android architecture. #Some of Stats/Info mentioned in this post are taken from Wikipedia. They are subjected to changes as android technology is growing very fast.

How to Set up an Android Development Environment

By Admin   Posted at  11:42 AM   Programming Languages 7 comments
How to Set up an Android Development Environment


Hello Guys,
Welcome back to my second tutorial on android application development series as promised in last tutorial, we will take a look at Ho to set up an android development environment.

Android is based on the Java development language and any beginner-level Java developer can jump right in and start developing applications.

The purpose of this guide is to outline in detail the steps necessary to set up the initial development environment for creating Android applications. The guide will address the installation of the Android Software Development Kit (SDK) and the initial set-up necessary for allowing Android OS emulation.

Most preferred operating systems which are used for development:
  • Microsoft Windows XP or later version.
  • Mac OS X 10.5.8 or later version with Intel chip.
  • Linux including GNU C Library 2.7 or later.
Second thing is that all the required tools to develop Android applications are available at free of cost and can be downloaded from the Web. Following is the list of software's you will need before you start your Android application programming.
  • Java JDK5 or JDK6
  • Android SDK
  • Eclipse IDE for Java Developers (optional)
  • Android Development Tools (ADT) Eclipse Plugin (optional)
So let us have a look how to proceed to set required environment.

Steps:

1. Download an IDE:

For the purpose of this example, will be using Eclipse. You can download the latest version of the software here: http://www.eclipse.org/downloads/packages/release/indigo/r.
You must choose the version that corresponds to your
OS of choice. Install Eclipse. Make sure to take note of the installation directory and workspace for later reference.

2. Download and install the Java Runtime Environment (JRE).

You can find the download file here: http://www.oracle.com/technetwork/java/javase/downloads/jre-6u25-download-346243.html.

3. Install the Android SDK:

  • The SDK starter package includes the Android SDK and AVD Manager. This is a tool that we will now use to download some required SDK components into our development environment.
  • The starter package we downloaded only contains the newest version of the SDK tools. In order to develop Android applications, we will need to download at least one Android platform so we can emulate a phone/tablet via our computer hardware.
  • In the root of the SDK directory, find and execute the SDK Manager.exe file. Note: Right-click and run as administrator to avoid any permission declination.


4. Download and Install the Android Development Tools (ADT) plugin for Eclipse

  • Google provides a custom plugin for Eclipse, called ADT, that aids developers in creating Android applications faster and more efficiently.
  • Open Eclipse and select Help and Install New Software



Now select all the listed plug-ins using Select All button and click Next button which will guide you ahead to install Android Development Tools and other required plugins.

5 - Create Android Virtual Device

Well last to test your Android applications you will need a virtual Android device. So before we start writing our code, let us create an Android virtual device. Launch Android AVD Manager using Eclipse menu options: Window > AVD Manager> which will launch Android AVD Manager. Use New button to create a new Android Virtual Device and enter the following information, before clicking Create AVD button.
If your AVD is created successfully it means your environment is ready for Android application development. Better you re-start your machine and once you are done with this last step, you are ready to proceed for your first Android example but before that we will see few more important concepts related to Android Application Development, in our next tutorial named: What is Android Architecture?

This tutorial has been written with an aim to teach you Set up an Android Development Environment. #Some of Stats/Info mentioned in this post are taken from Wikipedia. They are subjected to changes as android technology is growing very fast.
.

Thursday, January 30, 2014

Android Application Programming Overview

By Admin   Posted at  1:52 PM   Programming Languages 2 comments

Hello Guys,
Welcome to my first tutorial on android application programming. First lets see a quick overview of android itself, then we'll move on to necessary environmental setup. So without wasting our time lets dig in it, here we go:

What is Android?


Android is an operating system based on the Linux kernel, and designed primarily for touchscreen mobile devices such as smartphones and tablet computers. Initially developed by Android, Inc., which Google backed financially and later bought in 2005, Android was unveiled in 2007 along with the founding of the Open Handset Alliance: a consortium of hardware, software, and telecommunication companies devoted to advancing open standards for mobile devices. The first publicly available smartphone running Android, the HTC Dream, was released on October 22, 2008.

It is world's most popular mobile OS:
Android powers more than a billion phones and tablets around the world. It’s customizable, yet easy to use, and since it's made by Google, it works seamlessly with all your favorite Google apps.

Open Source:
Android offers a unified approach to application development for mobile devices which means developers need only develop for Android, and their applications should be able to run on different devices powered by Android. The source code for Android is available under free and open source software licenses. Google publishes most of the code under the Apache License version 2.0 and the rest, Linux kernel changes, under the GNU General Public License version 2.

Features of Android:

Following is a list of features in the Android operating system:




Android Applications:

Android has a growing selection of third party applications, which can be acquired by users either through an app store such as Google Play or theAmazon Appstore, or by downloading and installing
the application's APK file from a third-party site.
The Play Store application allows users to browse, download and update apps published by Google and third-party developers, and is pre-installed on devices that comply with Google's compatibility requirements. The app filters the list of available applications to those that are compatible with the user's device, and developers may restrict their applications to particular carriers or countries for business reasons. Purchases of unwanted applications can be refunded within 15 minutes of the time of download, and some carriers offer direct carrier billing for Google Play application purchases, where the cost of the application is added to the user's monthly bill. As of July 2013, there are more than one million applications available for Android in the Play Store.

So guys this is my very first post on Android Application Programming and Overview of Android OS.
This tutorial has been written with an aim to teach you how to develop and package Android application. I'll start from environment setup for Android application programming and we will also see How to configure Eclips IDE for the same.
#All Stats mentioned in this post are taken from Wikipedia. They are subjected to changes as android technology is growing very fast.

Monday, January 27, 2014

How to Install BackTrack on Android Mobile and Tablet

By Admin   Posted at  2:09 PM   HowTo-Android No comments
Hi Guys,

Lets see How we can Install BackTrack on Android Mobile and Tablet:



BackTrack Linux is a fine example of a specialized Linux distribution. Its only purpose is to test your network, devices, and systems for security vulnerabilities. BackTrack is packed with every security and hacker tool used by security professionals and professional hackers. I
f you're looking for all of the tools in one place, this is it. 

BackTrack is one of my favorite OS. First reason is it is made by world class hackers and second one is all hacking tools are available and last but not list one, it is flavor of Linux butI can use it only on PC. Android is booming now these days... Now you can Install Back Track Linux OS on Android smartphones and tablets. Now it is possible to install and run Backtrack on your Android devices.


Requirements:
(1) Root
(2) 1GHZ processor (recommended)
(3) 512MB Ram (recommended)
(4) Android 1.6 or higher
(5) Back Track 5 (http://goo.gl/CVVHgu)
Kernel will loop device support (this is included in most custom ROM’s)
(6) SD card with at least 3.5GB of free space
(7) Data connection on your device


Following Android Apps:

1.BUSY BOX (https://play.google.com/store/apps/details?id=stericson.busybox&feature=search_result#?t=W251bGwsMSwxLDEsInN0ZXJpY3Nvbi5idXN5Ym94Il0.) : It acts like a installer and uninstaller.it needs root permission to run.it has CPU cores and can run Linux kernels on android. click here

2. Superuser (https://play.google.com/store/apps/details?id=com.noshufou.android.su&feature=search_result#?t=W251bGwsMSwxLDEsImNvbS5ub3NodWZvdS5hbmRyb2lkLnN1Il0.) : This app just grants a superuser power to your phone just like "su " does for Linux. click here

3. Terminal Emulator (https://play.google.com/store/apps/details?id=jackpal.androidterm&feature=search_result#?t=W251bGwsMSwxLDEsImphY2twYWwuYW5kcm9pZHRlcm0iXQ..) : Terminal Emulator is app that runs a terminal console in android. click here

4. Android VNC (https://play.google.com/store/apps/details?id=android.androidVNC&feature=search_result#?t=W251bGwsMSwxLDEsImFuZHJvaWQuYW5kcm9pZFZOQyJd) : Android VNC is a tool for viewing VNC in Android.

How to Install Backtrack on Android Tablet or Phone?


Download the complete set of files you need from here: 

http://goo.gl/CVVHgu

To your phones internal SDcard in a directory called “BT5″ (cAsE sEnSiTiVe)
Launch "Terminal Emulator" from your phone and type (everything after the $: or #: is user input):
$: su
#: cd sdcard
#: cd BT5
#: sh bootbt
#: export USER=root
#: vncpasswd
(make up a password"ex: toortoor")
#: tightvncserver -geometry 1280x720

While Backtrack is loaded (when you see a red “root@localhost“) start the VNC server by typing:root@localhost:~#: startvnc (stopvnc kills it)
Open 'AndroidVNC' and fill the form like this:
Nickname : BT5
Password : toortoor
Address : 127.0.0.1
Port : 5901

Connect it and you will see Backtrack 5 interface. Voila you just did it... Enjoy..!

Remember: Some of the Backtrack tools can’t work properly and do it for your own risk. I hope you can Install Backtrack on Android tablet without any problems, tell me if you get problems.



Back to top ↑
Connect with Us

WhatsApp Share

What they says

one of the best mobile technology blog
one of the best mobile technology blog
one of the best mobile technology blog
one of the best mobile technology blog

Licencing

© 2013 Andropedia : The Android Fulcrum ™. Distributed By Blogger Themes | WP Mythemeshop Converted by Bloggertheme9
Blogger templates. Proudly Powered by Blogger.