tag:blogger.com,1999:blog-32564102305332493702024-03-12T18:29:09.010-07:00Android SnippetsAll the code in my blogs are the courtesy of various developers across the globe. This blog is just an effort to put all the code snippets in one place.Pallavi Majgaokarhttp://www.blogger.com/profile/02103762738935055535noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-3256410230533249370.post-77167000867867238482013-03-09T04:34:00.000-08:002013-03-12T05:06:39.332-07:00Restrict accidental In-app purchase from your android phone.<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Georgia, Times New Roman, serif;">Hey guys,</span><br />
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span>
<span style="font-family: Georgia, Times New Roman, serif;">Today's post is for any one who has friends or kids who accidentally or purposefully buy in-app products on your smart phone. Of course you have to pay the credit card bills and you don't want un-necessary stuffs crowding your phones. So, what do you do? Simply add a pin for in-app purchase... No one can buy any thing unless of course you give them the pin.</span><br />
<br />
<div style="color: #333333; line-height: 22px; margin-bottom: 1.5em; margin-top: 1.5em; padding: 0px;">
<b><span style="font-family: Georgia, Times New Roman, serif;">To restrict In-App purchase:</span></b></div>
<div style="margin-bottom: 1.5em; margin-top: 1.5em; padding: 0px;">
</div>
<ol style="text-align: left;">
<li><span style="color: #333333; font-family: Georgia, Times New Roman, serif;"><span style="line-height: 22px;">Open google Play on your phone.</span></span></li>
<li><span style="color: #333333; font-family: Georgia, Times New Roman, serif;"><span style="line-height: 22px;">Press the menu button.</span></span></li>
<li><span style="color: #333333; font-family: Georgia, Times New Roman, serif;"><span style="line-height: 22px;">Open Settings.</span></span></li>
<li><span style="color: #333333; font-family: Georgia, Times New Roman, serif;"><span style="line-height: 22px;">Under "User Control". Tap on "Set or change PIN".</span></span></li>
<li><span style="color: #333333; line-height: 22px; margin: 0px; padding: 0px;"><span style="font-family: Georgia, Times New Roman, serif;">It will ask you for a PIN. Enter the PIN.</span></span></li>
<li><span style="color: #333333; line-height: 22px; margin: 0px; padding: 0px;"><span style="font-family: Georgia, Times New Roman, serif;">Re-enter PIN to confirm.</span></span></li>
<li><span style="color: #333333; line-height: 22px; margin: 0px; padding: 0px;"><span style="font-family: Georgia, Times New Roman, serif;">In "Settings", Check the "Use PIN for purchases".</span></span></li>
<li><span style="color: #333333; line-height: 22px; margin: 0px; padding: 0px;"><span style="font-family: Georgia, Times New Roman, serif;">And you are DONE!!!</span></span></li>
</ol>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;">After an in-app purchase is done however, you can however Cancel the transactions later on as well.</span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;">Within 15 minutes of the transaction do the following:</span></div>
<div>
<ol style="background-color: white; color: #222222; line-height: 19.4375px;">
<li><span style="font-family: Georgia, Times New Roman, serif;">Open the Google Play Store app on your device.</span></li>
<li><span style="font-family: Georgia, Times New Roman, serif;">Tap Menu > My Apps.</span></li>
<li><span style="font-family: Georgia, Times New Roman, serif;">Find the app you've purchased that you'd like to cancel and tap to open the details page.</span></li>
<li><span style="font-family: Georgia, Times New Roman, serif;">Within the 15 minutes, you will see the option to "Open" or "Refund" - tap "Refund" to cancel the order.</span></li>
</ol>
</div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;">If you fail to cancel transaction within 15 minutes however, don't loose hopes... There is another way albeit a tedious one, as this one involves contacting the vendor.</span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div>
<ol style="background-color: white; color: #222222; line-height: 19.4375px;">
<li><span style="font-family: Georgia, Times New Roman, serif;">Sign in to your account at <a href="https://wallet.google.com/manage" style="color: #6611cc;">https://wallet.google.com/manage</a>.</span></li>
<li><span style="font-family: Georgia, Times New Roman, serif;">Click <b>View Order</b>.</span></li>
<li><span style="font-family: Georgia, Times New Roman, serif;">At the top of the receipt, click <b>Contact [Seller's Name]</b>.</span></li>
<li><span style="font-family: Georgia, Times New Roman, serif;">Select <b>I'd like to request a refund or return an item</b> from the <b>Subject</b> drop-down menu, and enter your message in the <b>Message</b> text box.</span></li>
<li><span style="font-family: Georgia, Times New Roman, serif;">Click <b>Send email</b> after you've provided the necessary details.</span></li>
</ol>
<div>
<span style="color: #222222; font-family: Georgia, Times New Roman, serif; font-size: x-small;"><span style="line-height: 19.4375px;"><br /></span></span></div>
</div>
<div>
<br /></div>
<br /></div>
Pallavi Majgaokarhttp://www.blogger.com/profile/02103762738935055535noreply@blogger.com1tag:blogger.com,1999:blog-3256410230533249370.post-14488841879775849282012-09-25T03:59:00.001-07:002012-09-25T03:59:48.201-07:00Install Signed APK file to device- offline mode<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />
<div class="separator" style="clear: both; text-align: justify;">
<br class="Apple-interchange-newline" />Requirement:</div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="text-align: left;">Install the device drivers. </span><span style="text-align: left;">You can get the device drivers from the device's website.</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="text-align: left;">Once it is installed, perform the following steps:</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="text-align: left;"><br /></span></div>
<br />
On Device:<br />
<br />
<div class="MsoNormal">
Drag down the “notification bar”.</div>
<div class="MsoNormal">
<!--[if gte vml 1]><v:shapetype
id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t"
path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f">
<v:stroke joinstyle="miter"/>
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0"/>
<v:f eqn="sum @0 1 0"/>
<v:f eqn="sum 0 0 @1"/>
<v:f eqn="prod @2 1 2"/>
<v:f eqn="prod @3 21600 pixelWidth"/>
<v:f eqn="prod @3 21600 pixelHeight"/>
<v:f eqn="sum @0 0 1"/>
<v:f eqn="prod @6 1 2"/>
<v:f eqn="prod @7 21600 pixelWidth"/>
<v:f eqn="sum @8 21600 0"/>
<v:f eqn="prod @7 21600 pixelHeight"/>
<v:f eqn="sum @10 21600 0"/>
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
<o:lock v:ext="edit" aspectratio="t"/>
</v:shapetype><v:shape id="Picture_x0020_1" o:spid="_x0000_i1035" type="#_x0000_t75"
style='width:192pt;height:240pt;visibility:visible;mso-wrap-style:square'>
<v:imagedata src="file:///C:\Users\ADMINI~1\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png"
o:title="help1 "/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></div>
<div class="MsoNormal">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-ocFrIKOhlRU/UFstVHQeSMI/AAAAAAAAAV4/Iox0wLzLySk/s1600/help1+.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-ocFrIKOhlRU/UFstVHQeSMI/AAAAAAAAAV4/Iox0wLzLySk/s1600/help1+.png" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="MsoNormal" style="text-align: left;">
Click the “USB connected” notification.</div>
<div class="MsoNormal" style="text-align: left;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-VeRxirfc9mw/UFstYZmek-I/AAAAAAAAAWc/3fkyK8PJTVE/s1600/help2+.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: left;"><img border="0" src="http://1.bp.blogspot.com/-VeRxirfc9mw/UFstYZmek-I/AAAAAAAAAWc/3fkyK8PJTVE/s1600/help2+.png" /></a><a href="http://4.bp.blogspot.com/-Qnh4M_FbJTU/UFstYzePA0I/AAAAAAAAAWg/qB_cPW8bm2Q/s1600/help3+.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><a href="http://www.blogger.com/blogger.g?blogID=3256410230533249370" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><a href="http://www.blogger.com/blogger.g?blogID=3256410230533249370" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><a href="http://www.blogger.com/blogger.g?blogID=3256410230533249370" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><a href="http://www.blogger.com/blogger.g?blogID=3256410230533249370" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><a href="http://www.blogger.com/blogger.g?blogID=3256410230533249370" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><a href="http://www.blogger.com/blogger.g?blogID=3256410230533249370" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><a href="http://www.blogger.com/blogger.g?blogID=3256410230533249370" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><a href="http://www.blogger.com/blogger.g?blogID=3256410230533249370" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><a href="http://www.blogger.com/blogger.g?blogID=3256410230533249370" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><a href="http://www.blogger.com/blogger.g?blogID=3256410230533249370" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><a href="http://www.blogger.com/blogger.g?blogID=3256410230533249370" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><img border="0" src="http://4.bp.blogspot.com/-Qnh4M_FbJTU/UFstYzePA0I/AAAAAAAAAWg/qB_cPW8bm2Q/s1600/help3+.png" /></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="text-align: left;">This warning may or may not occur.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-FvQwCv1h-V8/UFstZR6-UCI/AAAAAAAAAWo/KhXtfgG45TA/s1600/help4+.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-FvQwCv1h-V8/UFstZR6-UCI/AAAAAAAAAWo/KhXtfgG45TA/s1600/help4+.png" /></a></div>
<div class="separator" style="clear: both; text-align: justify;">
On PC:</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-_x4gDqz7tZw/UFstbpe-sOI/AAAAAAAAAXI/3qnMcuxvj4k/s1600/help7+.png" imageanchor="1" style="clear: left; display: inline !important; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="320" src="http://3.bp.blogspot.com/-_x4gDqz7tZw/UFstbpe-sOI/AAAAAAAAAXI/3qnMcuxvj4k/s320/help7+.png" width="267" /></a></div>
<div class="" style="clear: both; text-align: center;">
<span style="text-align: left;"><br /></span></div>
<div class="" style="clear: both; text-align: center;">
<div style="text-align: justify;">
</div>
<div class="MsoNormal" style="text-align: left;">
Create Folder “Android APK” (or whatever you want to name it.)</div>
<div class="MsoNormal" style="text-align: left;">
</div>
<div class="MsoNormal" style="text-align: left;">
Copy the given APK in this folder.</div>
<div class="MsoNormal" style="text-align: left;">
</div>
<div class="MsoNormal" style="text-align: left;">
Close this window.</div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-Ou8JfdR-t2Q/UFstcPXGLdI/AAAAAAAAAXQ/yMtpQlq7tdI/s1600/help8+.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="225" src="http://3.bp.blogspot.com/-Ou8JfdR-t2Q/UFstcPXGLdI/AAAAAAAAAXQ/yMtpQlq7tdI/s320/help8+.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
</div>
<div class="MsoNormal" style="text-align: left;">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-_AZ0KTqLj_A/UFstcqRjeNI/AAAAAAAAAXY/bggSAGqgkkw/s1600/help9+.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="226" src="http://4.bp.blogspot.com/-_AZ0KTqLj_A/UFstcqRjeNI/AAAAAAAAAXY/bggSAGqgkkw/s320/help9+.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
On device:</div>
<div class="MsoNormal" style="text-align: left;">
Turn off the USB storage mode.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-vTmJkSAtvjc/UFstamIhqQI/AAAAAAAAAW8/HC814AOr2Bw/s1600/help6+.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-vTmJkSAtvjc/UFstamIhqQI/AAAAAAAAAW8/HC814AOr2Bw/s1600/help6+.png" /></a></div>
<br /></div>
<br />
<div class="separator" style="clear: both; text-align: justify;">
<span style="text-align: left;">Open the file browser. The default location will be “mnt/sdcard”, if not, navigate to this location and open the folder you just made.</span>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-MI0KKiFy9DQ/UFstVo2Y0qI/AAAAAAAAAWA/dUaMsKsTPxY/s1600/help10+.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" src="http://3.bp.blogspot.com/-MI0KKiFy9DQ/UFstVo2Y0qI/AAAAAAAAAWA/dUaMsKsTPxY/s1600/help10+.png" /></a></div>
<a href="http://3.bp.blogspot.com/-MI0KKiFy9DQ/UFstVo2Y0qI/AAAAAAAAAWA/dUaMsKsTPxY/s1600/help10+.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em; text-align: justify;"><br /></a><br />
<br />
<div class="western" style="margin-bottom: 0in;">
Open the file and click
“Install”. If it is already present, it will ask to
re-Install/Overwrite the current APK. You may un-install the previous
version from Menu-> Settings->Apps-> <Your application
name>-> Uninstall.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-Mj6rRFiPxbA/UFstWDuqi_I/AAAAAAAAAWI/mv7E4x7aFBQ/s1600/help11+.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-Mj6rRFiPxbA/UFstWDuqi_I/AAAAAAAAAWI/mv7E4x7aFBQ/s1600/help11+.png" /></a></div>
<br />
<br />
<div class="western" style="margin-bottom: 0in;">
Once it is done, you
can <u>either</u> click on “Done” then navigate back to main menu
screen and select the application you just installed from the "Installed Apps" screen (Menu) <u>OR </u>click
“Open” and open the application directly.</div>
<div class="western" style="margin-bottom: 0in;">
<br /></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-QXGEAz47Pxg/UFstXKkq4HI/AAAAAAAAAWM/0c-0mzRpJ7w/s1600/help12+.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-QXGEAz47Pxg/UFstXKkq4HI/AAAAAAAAAWM/0c-0mzRpJ7w/s1600/help12+.png" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-yUilKTquMPY/UFstX8OrYYI/AAAAAAAAAWU/G0PxqCaIfeI/s1600/help13+.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-yUilKTquMPY/UFstX8OrYYI/AAAAAAAAAWU/G0PxqCaIfeI/s1600/help13+.png" /></a></div>
<br /></div>
</div>
Pallavi Majgaokarhttp://www.blogger.com/profile/02103762738935055535noreply@blogger.com0tag:blogger.com,1999:blog-3256410230533249370.post-83988139042375845812012-08-19T01:32:00.000-07:002012-12-18T05:03:37.107-08:00Block all calls programmatically <div dir="ltr" style="text-align: left;" trbidi="on">
<link href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css" rel="stylesheet" type="text/css"></link>
<link href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css" rel="stylesheet" type="text/css"></link>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js" type="text/javascript"></script>
<script language="javascript">
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf';
SyntaxHighlighter.all();
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-83229-12']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<br />
<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<title>Block all calls</title>
<link href="styles/shCoreDefault.css" rel="stylesheet" type="text/css"></link><br />
<div>
Requirement:</div>
<div>
Block incoming and out going calls.</div>
<div>
<br /></div>
<div>
Steps:</div>
<div>
Register a broadcast receiver to monitor calls.</div>
<div>
In AndroidManifest.xml file write:</div>
<pre class="brush: xml"><receiver android:name="MyPhoneReceiver">
<intent-filter android:priority="100">
<action android:name="android.intent.action.PHONE_STATE"/>
<action android:name="android.intent.action.NEW_OUTGOING_CALL"/>
</intent-filter>
</receiver>
</pre>
<br /></div>
<div>
Create a broadcast Receiver to catch the "call" related broadcast.</div>
<div>
<br /></div>
<pre class="brush: java">public class ProcessCall extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
//Create object of Telephony Manager class.
TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
//Assign a phone state listener.
CustomPhoneStateListener customPhoneListener = new CustomPhoneStateListener (context);
telephony.listen(customPhoneListener, PhoneStateListener.LISTEN_CALL_STATE);
}
}
</pre>
Create a custom phone state listener.
<br />
<pre class="brush: java">import java.lang.reflect.Method;
import android.content.Context;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import com.CallLogApp.helper.BlockNumberHelper;
import com.CallLogApp.util.UDF;
import com.android.internal.telephony.ITelephony;
public class CustomPhoneStateListener extends PhoneStateListener {
Context context;
public CustomPhoneStateListener(Context context) {
super();
this.context = context;
}
@Override
public void onCallStateChanged(int state, String callingNumber)
{
super.onCallStateChanged(state, callingNumber);
switch (state) {
case TelephonyManager.CALL_STATE_IDLE:
break;
case TelephonyManager.CALL_STATE_OFFHOOK:
//handle out going call
endCallIfBlocked(callingNumber);
break;
case TelephonyManager.CALL_STATE_RINGING:
//handle in coming call
endCallIfBlocked(callingNumber);
break;
default:
break;
}
}
private void endCallIfBlocked(String callingNumber) {
try {
// Java reflection to gain access to TelephonyManager's
// ITelephony getter
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
c = Class.forName(tm.getClass().getName());
Method m = c.getDeclaredMethod("getITelephony");
m.setAccessible(true);
com.android.internal.telephony.ITelephony telephonyService = (ITelephony) m.invoke(tm);
telephonyService = (ITelephony) m.invoke(tm);
//
telephonyService.silenceRinger();
telephonyService.endCall();
} catch (Exception e) {
e.printStackTrace();
}
}
}
</pre>
</div>
Pallavi Majgaokarhttp://www.blogger.com/profile/02103762738935055535noreply@blogger.com33tag:blogger.com,1999:blog-3256410230533249370.post-27216967390155588192012-08-19T00:10:00.000-07:002012-12-18T05:02:51.280-08:00Step-by-Step Android setup.<div dir="ltr" style="text-align: left;" trbidi="on">
Hi guys,<br />
<br />
This is just the basic start up session. Following are the steps to setup Android environment in your computer.<br />
<br class="Apple-interchange-newline" />
<span style="background-color: white; font-weight: bold;">System Requirements:</span>
<br />
<span style="background-color: white; font-weight: bold;"><br /></span>
To start with, let's check if your system is eligible to setup the environment or not.<br />
<br />
<ul style="color: #222222; font-family: Roboto, sans-serif; font-size: 12px; line-height: 19px; margin: 0px 0px 15px 18px; padding: 0px;">
<li style="margin: 0px 0px 4px;"><span style="background-color: white;">Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit)</span></li>
<li style="margin: 0px 0px 4px;"><span style="background-color: white;">Mac OS X 10.5.8 or later (x86 only)</span></li>
<li style="margin: 0px 0px 4px;"><span style="background-color: white;">Linux (tested on Ubuntu Linux, Lucid Lynx)</span><ul style="margin: 0px 0px 0px 18px; padding: 0px;">
<li style="margin: 0px 0px 4px;"><span style="background-color: white;">GNU C Library (glibc) 2.7 or later is required.</span></li>
<li style="margin: 0px 0px 4px;"><span style="background-color: white;">On Ubuntu Linux, version 8.04 or later is required.</span></li>
<li style="margin: 0px 0px 4px;"><span style="background-color: white;">64-bit distributions must be capable of running 32-bit applications.</span></li>
</ul>
</li>
</ul>
If you have at least one of the above then BINGO! you can start with the installation process below.<br />
<h4 style="text-align: left;">
Installation Process:</h4>
<br />
To start with Android development, you need to install the following:<br />
<br class="Apple-interchange-newline" />
<br />
<ol style="text-align: left;">
<li>Latest JDK. Please select a suitable one from <a href="http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.html">here</a>. JRE alone is not sufficient.</li>
<li>Download the android SDK from <a href="http://dl.google.com/android/installer_r20.0.3-windows.exe">here</a>.</li>
<li>From the list of platforms on right side, choose the suitable one and <a href="http://www.eclipse.org/downloads/packages/eclipse-classic-42/junor">download </a>the ECLIPSE environment. We will be using Eclipse environment to write our code.</li>
</ol>
<div>
<br />
<h4>
Installing ADT</h4>
<br />
To configure Eclipse for Android development, we need to install the ADT.<br />
<br /></div>
<div>
<ol style="color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px; margin: 0px 0px 15px 18px; padding: 0px;">
<li style="margin: 0px 0px 4px;"><span style="background-color: white;">Start Eclipse, then select <strong>Help</strong> > <strong>Install New Software</strong>.</span></li>
<li style="margin: 0px 0px 4px;"><span style="background-color: white;">Click <strong>Add</strong>, in the top-right corner.</span></li>
<li style="margin: 0px 0px 4px;"><span style="background-color: white;">In the Add Repository dialog that appears, enter "ADT Plugin" for the <em>Name</em> and the following URL for the <em>Location</em>:</span><pre class="prettyprint" style="border: 1px solid rgb(221, 221, 221); color: #006600; font-family: 'courier new', courier, monospace; line-height: 1.5; margin-bottom: 1em; margin-top: 1em; overflow: auto; padding: 1em;"><span style="background-color: white;"><span class="pln" style="color: black;">https</span><span class="pun" style="color: #666600;">:</span><span class="com" style="color: #880000;">//dl-ssl.google.com/android/eclipse/</span></span></pre>
</li>
<li style="margin: 0px 0px 4px;"><span style="background-color: white;">Click <strong>OK</strong>.</span><div style="margin-top: 10px;">
<span style="background-color: white;">Note: If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https" ('https' is preferred for security reasons).</span></div>
</li>
<li style="margin: 0px 0px 4px;"><span style="background-color: white;">In the Available Software dialog, select the checkbox next to Developer Tools and click <strong>Next</strong>.</span></li>
<li style="margin: 0px 0px 4px;"><span style="background-color: white;">In the next window, you'll see a list of the tools to be downloaded. Click <strong>Next</strong>.</span></li>
<li style="margin: 0px 0px 4px;"><span style="background-color: white;">Read and accept the license agreements, then click <strong>Finish</strong>.</span><div style="margin-top: 10px;">
<span style="background-color: white;">If you get a security warning saying that the authenticity or validity of the software can't be established, click <strong>OK</strong>.</span></div>
</li>
<li style="margin: 0px 0px 4px;"><span style="background-color: white;">When the installation completes, restart Eclipse.</span></li>
</ol>
</div>
<div>
If you have any problem in the above process:<br />
<br />
<ol style="text-align: left;">
<li>Download ZIP format of the ADT plugin (<span style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">ADT-20.0.3.zip</span>) from <a href="http://dl.google.com/android/ADT-20.0.3.zip">here</a>. Do not un-zip it.</li>
<li><span style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">Start Eclipse, then select </span><strong style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">Help</strong><span style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;"> > </span><strong style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">Install New Software</strong><span style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">.</span>
</li>
<li><span style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">Click <strong>Add</strong>, in the top-right corner.
</span></li>
<li><span style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">In the Add Repository dialog, click <strong>Archive</strong>.
</span></li>
<li><span style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">Select the downloaded ADT-20.0.3.zip file and click <strong>OK</strong>.
</span></li>
<li><span style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">Enter "ADT Plugin" for the name and click <strong>OK</strong>.
</span></li>
<li><span style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">In the Available Software dialog, select the checkbox next to Developer Tools and click <strong>Next</strong>.
</span></li>
<li><span style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">In the next window, you'll see a list of the tools to be downloaded. Click <strong>Next</strong>.
</span></li>
<li><span style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">Read and accept the license agreements, then click <strong>Finish</strong>. (If you get any security warning, just hit "OK").</span></li>
<li><span style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">When the installation completes, restart Eclipse.</span></li>
</ol>
<br />
<br /></div>
<div>
<h4 style="text-align: left;">
Configure ADT:</h4>
</div>
<div>
After you have installed the ADT, after Eclipse re-starts, you now need to specify the location of Android SDK directory. </div>
<div>
<br /></div>
<div>
<ol style="text-align: left;">
<li><span style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">Select </span><strong style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">Window</strong><span style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;"> > </span><strong style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">Preferences...</strong><span style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;"> to open the Preferences panel (on Mac OS X, select </span><strong style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">Eclipse</strong><span style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;"> > </span><strong style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">Preferences</strong><span style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">).</span>
</li>
<li><span style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">Select <strong>Android</strong> from the left panel.
</span></li>
<li><span style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">For the <em>SDK Location</em> in the main panel, click <strong>Browse...</strong> and locate your downloaded Android SDK directory (which would be some thing like "android-sdk-windows").</span></li>
<li><span style="background-color: #f9f9f9; color: #222222; font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px;">Click <strong>Apply</strong>, then <strong>OK</strong>.
</span></li>
</ol>
<h4 style="text-align: left;">
<span style="color: #222222; font-family: Roboto, sans-serif;"><span style="font-size: 14px; line-height: 19px;">Updating ADT:</span></span></h4>
</div>
<div>
<ol style="text-align: left;">
<li><span style="color: #222222; font-family: Roboto, sans-serif;"><span style="font-size: 14px; line-height: 19px;"><span style="background-color: #f9f9f9;">Select </span><strong style="background-color: #f9f9f9;">Help</strong><span style="background-color: #f9f9f9;"> > </span><strong style="background-color: #f9f9f9;">Check for Updates</strong><span style="background-color: #f9f9f9;">. If you have installed the latest plug-in, you will get a dialog box and you are done.</span></span></span></li>
<li><span style="color: #222222; font-family: Roboto, sans-serif;"><span style="font-size: 14px; line-height: 19px;"><span style="background-color: #f9f9f9;">If there are updates available, select Android DDMS, Android Development Tools, and Android Hierarchy Viewer, then click <strong>Next</strong>.
</span></span></span></li>
<li><span style="color: #222222; font-family: Roboto, sans-serif;"><span style="font-size: 14px; line-height: 19px;"><span style="background-color: #f9f9f9;">In the Update Details dialog, click <strong>Next</strong>.
</span></span></span></li>
<li><span style="color: #222222; font-family: Roboto, sans-serif;"><span style="font-size: 14px; line-height: 19px;"><span style="background-color: #f9f9f9;">Read and accept the license agreement and then click <strong>Finish</strong>. This will download and install the latest version of Android DDMS and Android Development Tools.
</span></span></span></li>
<li><span style="color: #222222; font-family: Roboto, sans-serif;"><span style="font-size: 14px; line-height: 19px;"><span style="background-color: #f9f9f9;">Restart Eclipse.</span></span></span></li>
</ol>
</div>
<div>
<span style="color: #222222; font-family: Roboto, sans-serif;"><span style="font-size: 14px; line-height: 19px;">You have now successfully completed setting up the Android environment!!! </span></span></div>
<div>
<span style="color: #222222; font-family: Roboto, sans-serif;"><span style="font-size: 14px; line-height: 19px;"><br /></span></span></div>
<div>
<span style="color: #222222; font-family: Roboto, sans-serif;"><span style="font-size: 14px; line-height: 19px;">You can now start your first android project by referring to <a href="http://developer.android.com/training/basics/firstapp/index.html">this</a> code.</span></span></div>
<div>
<br />
<b><br /></b>
<b>UPDATE:</b><br />
<br />
You can update the ADT using the <b>SDK Manager</b>.<br />
Under the "Sort By" select <b>API Level</b>. <br />
In the list of available, installed, obsolete packages, under <b>TOOLS</b> check <b>Android SDK Tools</b> and <b>Android SDK Platform-Tools</b> and Install Packages...<br />
You will now have the latest ADT installed. After updating the ADT, you can update the latest JellyBeans version(4.2)!!!<br />
<br /></div>
<div>
<br /></div>
<div>
The <a href="http://developer.android.com/index.html">android developer site</a> is the best guide for beginners.</div>
</div>
Pallavi Majgaokarhttp://www.blogger.com/profile/02103762738935055535noreply@blogger.com0