<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ondataactivity Archives - Truiton</title>
	<atom:link href="https://www.truiton.com/tag/ondataactivity/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>Technology Reaching Us In Time - Online</description>
	<lastBuildDate>Mon, 25 Nov 2019 11:12:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i0.wp.com/www.truiton.com/wp-content/uploads/2022/11/cropped-truiton_new_logo_half_white.png?fit=32%2C32&#038;ssl=1</url>
	<title>ondataactivity Archives - Truiton</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">54534495</site>	<item>
		<title>Android PhoneStateListener Example</title>
		<link>https://www.truiton.com/2014/08/android-phonestatelistener-example/</link>
					<comments>https://www.truiton.com/2014/08/android-phonestatelistener-example/#comments</comments>
		
		<dc:creator><![CDATA[Mohit Gupt]]></dc:creator>
		<pubDate>Sun, 03 Aug 2014 17:25:29 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[oncallstatechanged]]></category>
		<category><![CDATA[onCellLocationChanged]]></category>
		<category><![CDATA[ondataactivity]]></category>
		<category><![CDATA[onServiceStateChanged]]></category>
		<category><![CDATA[telephonymanager]]></category>
		<guid isPermaLink="false">http://www.truiton.com/?p=645</guid>

					<description><![CDATA[<p>While searching through some documentation I found an interesting class of android through which we can listen to some basic network related events, called Android PhoneStateListener which lead to this tutorial Android PhoneStateListener Example. Another class which needs an introduction is TelephonyManager, as this is the class which uses the Android PhoneStateListener to listen telephony&#8230;&#160;<a href="https://www.truiton.com/2014/08/android-phonestatelistener-example/" rel="bookmark">Read More &#187;<span class="screen-reader-text">Android PhoneStateListener Example</span></a></p>
<p>The post <a href="https://www.truiton.com/2014/08/android-phonestatelistener-example/">Android PhoneStateListener Example</a> appeared first on <a href="https://www.truiton.com">Truiton</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-image"><figure class="aligncenter"><img data-recalc-dims="1" fetchpriority="high" decoding="async" width="640" height="427" data-attachment-id="649" data-permalink="https://www.truiton.com/2014/08/android-phonestatelistener-example/android-phonestatelistener/" data-orig-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/08/Android-PhoneStateListener.jpg?fit=640%2C427&amp;ssl=1" data-orig-size="640,427" data-comments-opened="1" data-image-title="Android PhoneStateListener" data-image-description="&lt;p&gt;Photo Credit: &lt;a href=&quot;https://www.flickr.com/photos/79688583@N03/8703538283/&quot;&gt;Jamie Frith&lt;/a&gt; via &lt;a href=&quot;http://compfight.com&quot;&gt;Compfight&lt;/a&gt; &lt;a href=&quot;https://www.flickr.com/help/general/#147&quot;&gt;cc&lt;/a&gt; &lt;/p&gt;
" data-image-caption="" data-large-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/08/Android-PhoneStateListener.jpg?fit=640%2C427&amp;ssl=1" src="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/08/Android-PhoneStateListener.jpg?resize=640%2C427" alt="Android PhoneStateListener" class="wp-image-649" srcset="https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/08/Android-PhoneStateListener.jpg?w=640&amp;ssl=1 640w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2014/08/Android-PhoneStateListener.jpg?resize=300%2C200&amp;ssl=1 300w" sizes="(max-width: 640px) 100vw, 640px" /></figure></div>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">While searching through some documentation I found an interesting class of android through which we can listen to some basic network related events, called Android PhoneStateListener which lead to this tutorial Android PhoneStateListener Example. Another class which needs an introduction is <a title="Android TelephonyManager" href="http://developer.android.com/reference/android/telephony/TelephonyManager.html" target="_blank" rel="noopener noreferrer">TelephonyManager</a>, as this is the class which uses the Android <a title="Android PhoneStateListener" href="http://developer.android.com/reference/android/telephony/PhoneStateListener.html" target="_blank" rel="noopener noreferrer">PhoneStateListener</a> to listen telephony service updates. This tutorial is the first one in the series of exploring Android PhoneStateListener and TelephonyManager classes at <a title="Truiton" href="http://www.truiton.com" target="_blank" rel="noopener noreferrer">Truiton.com</a>. Links to complete series are:</p>



<p class="wp-block-paragraph">1) <a title="Android PhoneStateListener Example" href="http://www.truiton.com/2014/08/android-phonestatelistener-example/">Android PhoneStateListener Example</a><br>2) <a title="Android onDataConnectionStateChanged – Detect Network Type" href="http://www.truiton.com/2014/08/android-ondataconnectionstatechanged-detect-network-type/" target="_blank" rel="noopener noreferrer">Android onDataConnectionStateChanged &#8211; Detect Network Type</a><br>3) <a title="Android onSignalStrengthsChanged – LTE Strength Measurement" href="http://www.truiton.com/2014/08/android-onsignalstrengthschanged-lte-strength-measurement/" target="_blank" rel="noopener noreferrer">Android onSignalStrengthsChanged &#8211; LTE Strength Measurement</a></p>



<p class="wp-block-paragraph">To start off let me give a brief intro about what all things I&#8217;ll be covering in this tutorial. Here I would be instantiating an object of Android TelephonyManager and listening to the updates of <code>Context.TELEPHONY_SERVICE</code>. To monitor the changes of specific telephony states like <code>PhoneStateListener.LISTEN_CELL_INFO, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS,&nbsp;PhoneStateListener.LISTEN_DATA_CONNECTION_STATE</code> and many more, I will be declaring a class <code>CustomPhoneStateListener</code> which will extend&nbsp;Android PhoneStateListener and override all of its methods.</p>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading">Android TelephonyManager</h2>



<p class="wp-block-paragraph">This class of android is the main class through which one can access the telephony services of a device. All the information in this class is accessed through a system-level service called Context.TELEPHONY_SERVICE. Since this tutorial is focused on Android PhoneStateListener lets not get in depth of this class. The only relevant method for us in this class is <code>TelephonyManager.listen(PhoneStateListener listener, int events)</code>. And for this method I will be declaring a custom PhoneStateListener.</p>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading">Android PhoneStateListener</h2>



<p class="wp-block-paragraph">This is the actual class which gets callbacks, whenever some change is observed in TELEPHONY_SERVICE. Android PhoneStateListener has many callback methods which are called if we register for their specific <code>LISTEN_</code> flag in the TelephonyManager&#8217;s listen method. Have a look at the listing below to correlate <code>LISTEN_</code> flags with Android PhoneStateListener&#8217;s callback methods:</p>



<h4 class="wp-block-heading">ANDROID PHONESTATELISTENER CALLBACK METHODS</h4>



<table class="wp-block-table"><tbody><tr><td><strong>LISTEN_ Flag</strong></td><td><strong>Callback Method</strong></td></tr><tr><td>PhoneStateListener.LISTEN_CALL_STATE</td><td>onCallStateChanged(int state, String incomingNumber)</td></tr><tr><td>PhoneStateListener.LISTEN_CELL_INFO</td><td>onCellInfoChanged(List&lt;CellInfo> cellInfo)</td></tr><tr><td>PhoneStateListener.LISTEN_CELL_LOCATION</td><td>onCellLocationChanged(CellLocation location)</td></tr><tr><td>PhoneStateListener.LISTEN_DATA_ACTIVITY</td><td>onDataActivity(int direction)</td></tr><tr><td>PhoneStateListener.LISTEN_DATA_CONNECTION_STATE</td><td>onDataConnectionStateChanged(int state, int networkType)</td></tr><tr><td>PhoneStateListener.LISTEN_SERVICE_STATE</td><td>onServiceStateChanged(ServiceState serviceState)</td></tr><tr><td>PhoneStateListener.LISTEN_SIGNAL_STRENGTHS</td><td>onSignalStrengthsChanged(SignalStrength signalStrength)</td></tr><tr><td>PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR</td><td>onCallForwardingIndicatorChanged(boolean cfi)</td></tr><tr><td>PhoneStateListener.LISTEN_MESSAGE_WAITING_INDICATOR</td><td>onMessageWaitingIndicatorChanged(boolean mwi)</td></tr></tbody></table>



<p class="wp-block-paragraph">Now since we are dealing here with phone states and locations we would require to declare some permissions in manifest:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="xml" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?xml version="1.0" encoding="utf-8"?>
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.truiton.phonestatelistener"
    android:versionCode="1"
    android:versionName="1.0" >

    &lt;uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="21" />

    &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" />
    &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

    &lt;application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        &lt;activity
            android:name=".PhoneStateListenerActivity"
            android:label="@string/app_name" >
            &lt;intent-filter>
                &lt;action android:name="android.intent.action.MAIN" />

                &lt;category android:name="android.intent.category.LAUNCHER" />
            &lt;/intent-filter>
        &lt;/activity>
    &lt;/application>

&lt;/manifest></pre>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Next lets define our PhoneStateListenerActivity</p>



<pre class="EnlighterJSRAW" data-enlighter-language="java" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">package com.truiton.phonestatelistener;

import android.support.v7.app.ActionBarActivity;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.annotation.TargetApi;
import android.os.Build;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class PhoneStateListenerActivity extends ActionBarActivity {
 TelephonyManager tManager;

 @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
 // Added because of PhoneStateListener.LISTEN_CELL_INFO
 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_phone_state_listener);

 tManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
 tManager.listen(new CustomPhoneStateListener(this),
 PhoneStateListener.LISTEN_CALL_STATE
 | PhoneStateListener.LISTEN_CELL_INFO // Requires API 17
 | PhoneStateListener.LISTEN_CELL_LOCATION
 | PhoneStateListener.LISTEN_DATA_ACTIVITY
 | PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
 | PhoneStateListener.LISTEN_SERVICE_STATE
 | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
 | PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR
 | PhoneStateListener.LISTEN_MESSAGE_WAITING_INDICATOR);
 }

 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
 getMenuInflater().inflate(R.menu.phone_state_listener, menu);
 return true;
 }

 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
 int id = item.getItemId();
 if (id == R.id.action_settings) {
 return true;
 }
 return super.onOptionsItemSelected(item);
 }
}</pre>



<p class="wp-block-paragraph">In this class one can see that in the <code>tManager.listen</code> method a new object for CustomPhoneStateListener is defined and in the events parameter a bitwise-OR combination of Android <a href="http://developer.android.com/reference/android/telephony/PhoneStateListener.html" target="_blank" rel="noopener noreferrer">PhoneStateListener</a> LISTEN_ flags is passed. Now lets have a look at some of the main methods of CustomPhoneStateListener.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="java" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">package com.truiton.phonestatelistener;

import java.util.List;

import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.telephony.CellInfo;
import android.telephony.CellLocation;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
import android.telephony.cdma.CdmaCellLocation;
import android.telephony.gsm.GsmCellLocation;
import android.util.Log;

public class CustomPhoneStateListener extends PhoneStateListener {
 Context mContext;
 public static String LOG_TAG = "CustomPhoneStateListener";

 public CustomPhoneStateListener(Context context) {
 mContext = context;
 }

 @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
 @Override
 public void onCellInfoChanged(List&lt;CellInfo> cellInfo) {
 super.onCellInfoChanged(cellInfo);
 Log.i(LOG_TAG, "onCellInfoChanged: " + cellInfo);
 }

 @Override
 public void onDataActivity(int direction) {
 super.onDataActivity(direction);
 switch (direction) {
 case TelephonyManager.DATA_ACTIVITY_NONE:
 Log.i(LOG_TAG, "onDataActivity: DATA_ACTIVITY_NONE");
 break;
 case TelephonyManager.DATA_ACTIVITY_IN:
 Log.i(LOG_TAG, "onDataActivity: DATA_ACTIVITY_IN");
 break;
 case TelephonyManager.DATA_ACTIVITY_OUT:
 Log.i(LOG_TAG, "onDataActivity: DATA_ACTIVITY_OUT");
 break;
 case TelephonyManager.DATA_ACTIVITY_INOUT:
 Log.i(LOG_TAG, "onDataActivity: DATA_ACTIVITY_INOUT");
 break;
 case TelephonyManager.DATA_ACTIVITY_DORMANT:
 Log.i(LOG_TAG, "onDataActivity: DATA_ACTIVITY_DORMANT");
 break;
 default:
 Log.w(LOG_TAG, "onDataActivity: UNKNOWN " + direction);
 break;
 }
 }

 @Override
 public void onServiceStateChanged(ServiceState serviceState) {
 super.onServiceStateChanged(serviceState);
 Log.i(LOG_TAG, "onServiceStateChanged: " + serviceState.toString());
 Log.i(LOG_TAG, "onServiceStateChanged: getOperatorAlphaLong "
 + serviceState.getOperatorAlphaLong());
 Log.i(LOG_TAG, "onServiceStateChanged: getOperatorAlphaShort "
 + serviceState.getOperatorAlphaShort());
 Log.i(LOG_TAG, "onServiceStateChanged: getOperatorNumeric "
 + serviceState.getOperatorNumeric());
 Log.i(LOG_TAG, "onServiceStateChanged: getIsManualSelection "
 + serviceState.getIsManualSelection());
 Log.i(LOG_TAG,
 "onServiceStateChanged: getRoaming "
 + serviceState.getRoaming());

 switch (serviceState.getState()) {
 case ServiceState.STATE_IN_SERVICE:
 Log.i(LOG_TAG, "onServiceStateChanged: STATE_IN_SERVICE");
 break;
 case ServiceState.STATE_OUT_OF_SERVICE:
 Log.i(LOG_TAG, "onServiceStateChanged: STATE_OUT_OF_SERVICE");
 break;
 case ServiceState.STATE_EMERGENCY_ONLY:
 Log.i(LOG_TAG, "onServiceStateChanged: STATE_EMERGENCY_ONLY");
 break;
 case ServiceState.STATE_POWER_OFF:
 Log.i(LOG_TAG, "onServiceStateChanged: STATE_POWER_OFF");
 break;
 }
 }

 @Override
 public void onCallStateChanged(int state, String incomingNumber) {
 super.onCallStateChanged(state, incomingNumber);
 switch (state) {
 case TelephonyManager.CALL_STATE_IDLE:
 Log.i(LOG_TAG, "onCallStateChanged: CALL_STATE_IDLE");
 break;
 case TelephonyManager.CALL_STATE_RINGING:
 Log.i(LOG_TAG, "onCallStateChanged: CALL_STATE_RINGING");
 break;
 case TelephonyManager.CALL_STATE_OFFHOOK:
 Log.i(LOG_TAG, "onCallStateChanged: CALL_STATE_OFFHOOK");
 break;
 default:
 Log.i(LOG_TAG, "UNKNOWN_STATE: " + state);
 break;
 }
 }

 @TargetApi(Build.VERSION_CODES.GINGERBREAD)
 @Override
 public void onCellLocationChanged(CellLocation location) {
 super.onCellLocationChanged(location);
 if (location instanceof GsmCellLocation) {
 GsmCellLocation gcLoc = (GsmCellLocation) location;
 Log.i(LOG_TAG,
 "onCellLocationChanged: GsmCellLocation "
 + gcLoc.toString());
 Log.i(LOG_TAG, "onCellLocationChanged: GsmCellLocation getCid "
 + gcLoc.getCid());
 Log.i(LOG_TAG, "onCellLocationChanged: GsmCellLocation getLac "
 + gcLoc.getLac());
 Log.i(LOG_TAG, "onCellLocationChanged: GsmCellLocation getPsc"
 + gcLoc.getPsc()); // Requires min API 9
 } else if (location instanceof CdmaCellLocation) {
 CdmaCellLocation ccLoc = (CdmaCellLocation) location;
 Log.i(LOG_TAG,
 "onCellLocationChanged: CdmaCellLocation "
 + ccLoc.toString());
 Log.i(LOG_TAG,
 "onCellLocationChanged: CdmaCellLocation getBaseStationId "
 + ccLoc.getBaseStationId());
 Log.i(LOG_TAG,
 "onCellLocationChanged: CdmaCellLocation getBaseStationLatitude "
 + ccLoc.getBaseStationLatitude());
 Log.i(LOG_TAG,
 "onCellLocationChanged: CdmaCellLocation getBaseStationLongitude"
 + ccLoc.getBaseStationLongitude());
 Log.i(LOG_TAG,
 "onCellLocationChanged: CdmaCellLocation getNetworkId "
 + ccLoc.getNetworkId());
 Log.i(LOG_TAG,
 "onCellLocationChanged: CdmaCellLocation getSystemId "
 + ccLoc.getSystemId());
 } else {
 Log.i(LOG_TAG, "onCellLocationChanged: " + location.toString());
 }
 }

 @Override
 public void onCallForwardingIndicatorChanged(boolean cfi) {
 super.onCallForwardingIndicatorChanged(cfi);
 Log.i(LOG_TAG, "onCallForwardingIndicatorChanged: " + cfi);
 }

 @Override
 public void onMessageWaitingIndicatorChanged(boolean mwi) {
 super.onMessageWaitingIndicatorChanged(mwi);
 Log.i(LOG_TAG, "onMessageWaitingIndicatorChanged: " + mwi);
 }
}</pre>



<p class="wp-block-paragraph">Here in the above class I extended the Android PhoneStateListener class and I am overriding some of its key methods. Through these overridden methods we can access the telephony states, cell locations, network types, incoming call number and much more network carrier related information. In this&nbsp;<a title="Android PhoneStateListener Example" href="http://www.truiton.com/2014/08/android-phonestatelistener-example/">Android PhoneStateListener Example</a> I&#8217;ll be explaining all key methods in short except two key callback methods as they have separate tutorials. First one onDataConnectionStateChanged and second one onSignalStrengthsChanged. To keep it simple and self explanatory I am just using logs to display the all the states. Now lets start with first overridden method:</p>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading">Android PhoneStateListener onDataActivity</h2>



<p class="wp-block-paragraph">This method is called when some data activity is observed like upload or download or both. Whenever there is a change in network data you would receive a callback here.</p>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading">Android PhoneStateListener&nbsp;onServiceStateChanged</h2>



<p class="wp-block-paragraph">This method is called when something changes in network operator service. It could be a change in service when phone goes from in service to out of service or to emergency only. In this callback method, along with states some other parameters are returned like operator name from <code>getOperatorAlphaLong</code> method. To detect if phone is in roaming <code>getRoaming</code> method can be used.</p>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading">Android PhoneStateListener onCallStateChanged</h2>



<p class="wp-block-paragraph">Well this method is one of the most used method of this class as this method listens to the call state changes. Like when phone starts ringing, call is put on hold or a call is ended.</p>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading">Android PhoneStateListener&nbsp;onCellLocationChanged</h2>



<p class="wp-block-paragraph">This method is called when your device switches operator cell location. This method can provide great amounts of information regarding the location of device as its object can be cast to GsmCellLocation or CdmaCellLocation. Once we have location area code through <code>GsmCellLocation.getLac()</code> method and cell id through <code>GsmCellLocation.getCid()</code> method we can query and get actual latitude and longitude of that location by any web-service freely available on internet. Also would like to mention here that in case of CDMA device this process is not required as CdmaCellLocation class contains the latitude and longitude parameters in itself.</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Concluding this tutorial I would like to mention separate tutorials are available for more methods like <a title="Android onSignalStrengthsChanged – LTE Strength Measurement" href="http://www.truiton.com/2014/08/android-onsignalstrengthschanged-lte-strength-measurement/" target="_blank" rel="noopener noreferrer">onSignalStrengthsChanged</a> and <a title="Android onDataConnectionStateChanged – Detect Network Type" href="http://www.truiton.com/2014/08/android-ondataconnectionstatechanged-detect-network-type/" target="_blank" rel="noopener noreferrer">onDataConnectionStateChanged</a>. Please share this tutorial if it helped you.</p>
<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author"><div class="saboxplugin-tab"><div class="saboxplugin-gravatar"><img alt='Mohit Gupt' src='https://secure.gravatar.com/avatar/a816092ad56645d2635ccfceb9f7e9d44821c19dec126cb394c882ba574eaa04?s=100&#038;d=mm&#038;r=g' srcset='https://secure.gravatar.com/avatar/a816092ad56645d2635ccfceb9f7e9d44821c19dec126cb394c882ba574eaa04?s=200&#038;d=mm&#038;r=g 2x' class='avatar avatar-100 photo' height='100' width='100' itemprop="image"/></div><div class="saboxplugin-authorname"><a href="https://www.truiton.com/author/mohitgupt/" class="vcard author" rel="author"><span class="fn">Mohit Gupt</span></a></div><div class="saboxplugin-desc"><div itemprop="description"><p>Born in New Delhi, India. A software engineer by profession, an android enthusiast and mobile development evangelist. My motive here is to create a group of skilled engineers, who can build better software. Reason being programming is my passion, and also it feels good to make a device do something you want. Professionally I have worked with many software engineering and product development firms. As of now too, I am employed as a senior engineer in a leading tech company. In total I may have worked on more than 20 projects professionally, but whenever I get spare time I share my thoughts here at Truiton.</p>
</div></div><div class="saboxplugin-web "><a href="http://www.truiton.com" target="_self" >www.truiton.com</a></div><div class="clearfix"></div><div class="saboxplugin-socials "><a title="Wordpress" target="_blank" href="https://www.truiton.com/author/mohitgupt/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-wordpress" role="img" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 512 512"><path fill="currentColor" d="M61.7 169.4l101.5 278C92.2 413 43.3 340.2 43.3 256c0-30.9 6.6-60.1 18.4-86.6zm337.9 75.9c0-26.3-9.4-44.5-17.5-58.7-10.8-17.5-20.9-32.4-20.9-49.9 0-19.6 14.8-37.8 35.7-37.8.9 0 1.8.1 2.8.2-37.9-34.7-88.3-55.9-143.7-55.9-74.3 0-139.7 38.1-177.8 95.9 5 .2 9.7.3 13.7.3 22.2 0 56.7-2.7 56.7-2.7 11.5-.7 12.8 16.2 1.4 17.5 0 0-11.5 1.3-24.3 2l77.5 230.4L249.8 247l-33.1-90.8c-11.5-.7-22.3-2-22.3-2-11.5-.7-10.1-18.2 1.3-17.5 0 0 35.1 2.7 56 2.7 22.2 0 56.7-2.7 56.7-2.7 11.5-.7 12.8 16.2 1.4 17.5 0 0-11.5 1.3-24.3 2l76.9 228.7 21.2-70.9c9-29.4 16-50.5 16-68.7zm-139.9 29.3l-63.8 185.5c19.1 5.6 39.2 8.7 60.1 8.7 24.8 0 48.5-4.3 70.6-12.1-.6-.9-1.1-1.9-1.5-2.9l-65.4-179.2zm183-120.7c.9 6.8 1.4 14 1.4 21.9 0 21.6-4 45.8-16.2 76.2l-65 187.9C426.2 403 468.7 334.5 468.7 256c0-37-9.4-71.8-26-102.1zM504 256c0 136.8-111.3 248-248 248C119.2 504 8 392.7 8 256 8 119.2 119.2 8 256 8c136.7 0 248 111.2 248 248zm-11.4 0c0-130.5-106.2-236.6-236.6-236.6C125.5 19.4 19.4 125.5 19.4 256S125.6 492.6 256 492.6c130.5 0 236.6-106.1 236.6-236.6z"></path></svg></span></a><a title="Twitter" target="_blank" href="http://twitter.com/mohitgupt" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 30 30"><path d="M26.37,26l-8.795-12.822l0.015,0.012L25.52,4h-2.65l-6.46,7.48L11.28,4H4.33l8.211,11.971L12.54,15.97L3.88,26h2.65 l7.182-8.322L19.42,26H26.37z M10.23,6l12.34,18h-2.1L8.12,6H10.23z" /></svg></span></a><a title="Facebook" target="_blank" href="https://www.facebook.com/Mr.Mohit.Gupt" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-facebook" role="img" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 264 512"><path fill="currentColor" d="M76.7 512V283H0v-91h76.7v-71.7C76.7 42.4 124.3 0 193.8 0c33.3 0 61.9 2.5 70.2 3.6V85h-48.2c-37.8 0-45.1 18-45.1 44.3V192H256l-11.7 91h-73.6v229"></path></svg></span></a></div></div></div><p>The post <a href="https://www.truiton.com/2014/08/android-phonestatelistener-example/">Android PhoneStateListener Example</a> appeared first on <a href="https://www.truiton.com">Truiton</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.truiton.com/2014/08/android-phonestatelistener-example/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">645</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Minified using Disk

Served from: www.truiton.com @ 2026-07-10 19:46:25 by W3 Total Cache
-->