A musical evening!

Last evening couldn’t have been much better. It’s not quite often that one witnesses ordinary people with extra-ordinary talent. World No Tobacco Day (WNTD) is observed around the world every year on May 31st. In order to spread the awareness of cancer, NGO Helping Hand had organized a special musical evening in Mumbai.

The event saw eminent personalities including Mrs. Priya Dutt, Mrs. Manisha Koirala and Mr. Johny Joseph felicitating cancer survivors. Luckily, I got a chance to attend the event, all thanks to Dada! 🙂 The blind orchestra group Pride Of India delivered a breathtaking performance that mesmerized each individual present in the K.C College auditorium. It was the first time I had seen such an orchestra. At no point in time I felt the group went out of sync. The group brought back old Bollywood songs to life and presented the real picture of today’s India. On the whole, it was a wonderful musical experience and I look forward to attend many more such events! 🙂

Here are a few glimpses of the event!

IMG_20140531_192827714

IMG_20140531_193747083

Add event to calendar in Android

Hello everyone!

A calendar provides a systematic way of organizing events by giving names to periods of time, typically days, weeks, months, and years. Android provides developers an abstract Calendar class to maintain a list of planned events. As mentioned on the developer’s page, a Calendar object can produce all the time field values needed to implement the date-time formatting for a particular language and calendar style (for example, Japanese-Gregorian, Japanese-Traditional). Calendar defines the range of values returned by certain fields, as well as their meaning.

Through this post, we will learn how to add an event to the default calendar application in Android.

Pre-requisites: Eclipse IDE, Android SDK

Step 1: Launch Eclipse IDE and create a new Android application project called AndroidCalendarExample with package name com.example

Step 2: Add code to Activity class

MainActivity.java

package com.example;

import java.util.Calendar;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		Button button = (Button) findViewById(R.id.btn1);
		button.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {

				//add event to calendar
				addCalendarEvent();
			}

		});

	}

	public void addCalendarEvent(){

		Calendar cal = Calendar.getInstance();     
		Intent intent = new Intent(Intent.ACTION_EDIT);
		intent.setType("vnd.android.cursor.item/event");
		intent.putExtra("beginTime", cal.getTimeInMillis());
		intent.putExtra("allDay", true);
		intent.putExtra("rrule", "FREQ=YEARLY");
		intent.putExtra("endTime", cal.getTimeInMillis()+60*60*1000);
		intent.putExtra("title", "Test Event");
		intent.putExtra("description", "This is a sample description");
		startActivity(intent);
	}
}

The Calendar class is used for converting between a Date object and a set of integer fields such as YEAR, MONTH, DAY, HOUR, and so on. A Date object represents a specific instant in time with millisecond precision.

activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <TextView
        android:id="@+id/txt1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />
    
    <Button
        android:id="@+id/btn1"
        android:layout_below="@+id/txt1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/event" />

</RelativeLayout>

Next, we also need to make changes in the AndroidManifest.xml file in order to include the necessary READ and WRITE permissions.

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />

    <uses-permission android:name="android.permission.WRITE_CALENDAR" />
    <uses-permission android:name="android.permission.READ_CALENDAR" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

Finally, save all changes. Make sure no errors are present. Run the application on an Android device and you should see the following output!

android_calendar_1

android_calendar_2

#Event: Get ready for DroidSync 2014

Hello everyone!

If you are Android developer or someone eager to step into the world of mobile technology then this summer could just be the ideal time to kick-start things. The Androcid team is organising a 1 day conference at Ramada Plaza Juhu, Mumbai, on 5th April, 2014. The event plans to showcase the entire Android ecosystem and promises to be an ideal place for developers, business professionals and start-up owners to come together and share information that could help strengthen the Android community.

If you feel you have an expertise, then here’s your chance to showcase your application or submit a 30 minute talk proposal. Looking forward to meet like-minded people? DroidSync plans to provide the ideal platform for you to interact with industry experts, business and management professionals or just anyone who loves to work with Android.

The registrations have already began. Grab your early bird tickets soon! To register and know more about the event please visit the website. Hope to see you at the conference! 🙂

droidsync_2014

Detect incoming call and call hangup event in Android

Hi everyone!

In Android it is possible to detect call events using the built-in TelephonyManager API. As mentioned on the Android developer’s page, the TelephonyManager class provides access to information about the telephony services on the device. Applications can use the methods in this class to determine telephony services and states, as well as to access some types of subscriber information. Applications can also register a listener to receive notification of telephony state changes.

Through this post, we will learn how to detect an incoming call as well as a call hangup event in Android.

Pre-requisites: Eclipse IDE, Android SDK

Create a new class called MyCallReceiver with package name com.example in any of your existing Android application projects and add the following code!

MyCallReceiver.java

package com.example;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
import android.widget.Toast;

public class MyCallReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {

		if (intent.getStringExtra(TelephonyManager.EXTRA_STATE).equals(TelephonyManager.EXTRA_STATE_RINGING)) {
			// This code will execute when the phone has an incoming call
			
			// get the phone number 
			String incomingNumber = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);
			Toast.makeText(context, "Call from:" +incomingNumber, Toast.LENGTH_LONG).show();
			
		} else if (intent.getStringExtra(TelephonyManager.EXTRA_STATE).equals(
				TelephonyManager.EXTRA_STATE_IDLE)
				|| intent.getStringExtra(TelephonyManager.EXTRA_STATE).equals(
						TelephonyManager.EXTRA_STATE_OFFHOOK)) {
			// This code will execute when the call is disconnected
			Toast.makeText(context, "Detected call hangup event", Toast.LENGTH_LONG).show();
				
		}
	}
}

Important: Listening phone state

We use a BroadcastReceiver class that will monitor the phone state and whenever there is a change in phone state, the onReceive() method of the BroadcastReceiver will be called.

You also need to add the READ_PHONE_STATE permission in your AndroidManifest.xml file as follows!

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />

    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
      
        <receiver android:name="com.example.MyCallReceiver" >
            <intent-filter>
                <action android:name="android.intent.action.PHONE_STATE" />
            </intent-filter>
        </receiver>
    </application>

</manifest>

Save all changes and make sure no errors are present. When the appropriate call event occurs, you should see a message being displayed on the screen! 🙂

call_hangup

incoming_call

Reference: BroadcastReceiver in Android

It’s time for Droidcon!

It’s about that time of the year again when people passionate about technology come together and participate in one of the coolest events. India’s largest Android conference Droidcon is back with a three day extravaganza including in depth, hands-on sessions on everything about Android.

The event will take place on 28th-30th November 2013 at the MLR Convention Centre, Whitefield, Bangalore. If you are an Android enthusiast, then this would be a great chance to meet eminent developers out there and interact with the best speakers in the country. To know more about the event please visit the official Droidcon India 2013 website.

Grab your tickets soon! Hope to see you there! 🙂

droidcon

It’s time for Nitrodroid!

It’s that time of the year again when some of the best speakers come together on a common platform to promote the development of Android. Nitrodroid is back with it’s 2nd edition that promises to be much better, bigger giving you a chance to meet experienced Android developers across India.

If Android is what that drives you and you are passionate about technology, then Nitrodroid is the place to be. The event will take place at Hotel Fidalgo, Goa on 26th October 2013. To know more about the event please visit the official page or the Facebook page.

Hurry and book your tickets for Nitrodroid 2013. Hope to see you there! 🙂

nitrodroid_2013

An event to remember!

On a lazy Sunday morning most of us would just wake up, have a cup of coffee and read the newspaper to see what’s new. How many of you would be ready to face a quiz? A quiz that would test your skills in Engineering across all it’s disciplines. An inter-corporate event that would involve participants from all across India competing in a battle of wits. It’s hard to believe right? Well, not really! All thanks to the Times Ascent group for making this possible.

The grand finale of the second edition of the Ascent Engineering Mastermind kicked off today at St. Andrews College (Bandra,Mumbai). It was the first time I was attending an inter corporate event. Unfortunately, I could not participate since the registration process was closed. I decided to wait back as an audience and watch the quiz unfold and luckily that turned out to be a blessing in disguise. After a delay of around 25 minutes or so, the preliminary rounds began and participants were given a set of 20 questions whose answers needed to be written on the sheet provided.

I could orally answer 11 out of those but then the questions were really good with a handful based on core engineering disciplines. The preliminary rounds were over in no time and only the top 4 teams would qualify for the next round as far as the Mumbai zone was concerned. The other zonal finalists from Pune, Delhi and Bangalore were also present and would join in the action once the finalist of the Mumbai zone was decided.

TCS Mumbai was named the finalist of the Mumbai zone after a gruelling four rounds and now the grand finale would begin! To add to the fun there were spot prizes too with a few questions being thrown to the audience. I won a goodie for answering one of them and that certainly made by day! 🙂

On the whole, the event was a true learning extravaganza. From Physics and Mathematics to Civil and Electrical, the event covered all facets of Engineering. GenPact Ltd won the coveted Ascent Engineering Mastermind prize with TCS Mumbai being declared as runners up. It was one of the most memorable events I had attended. Looking forward to participate next year! 🙂

Here are a few moments of the event that I captured!

IMG040

IMG041

IMG043

IMG044

IMG045

IMG046

Power Extreme!

I had a really awesome time last evening at the Extreme Invasion event held at JVPD ground, Juhu in Mumbai. The event was one of its kinds as skateboarders, BMX bikers and inline skaters from different parts of the world set the ramp on fire with their electrifying moves.

The event was initiated and owned by Brand Promotions and organized in association with the Asian Extreme Sports Federation (AXF). I was lucky to witness internationally renowned professionals including Jeerasak Tassorn, who had won 2nd place at the LG World Championship in 2007. Some other stars included Braxton Haine (skateboarding), Zafrin Shah (BMX) and Richie Eisler who performed some extreme inline skating tricks.

Apart from the extreme adventure, the event also included a special B-boying performance making the three hour extravaganza a complete entertainer. I look forward to attend many such events in the future. It’s time India goes Extreme…!! 🙂

DSC_0126

DSC_0124

DSC_0120

DSC_0119

DSC_0118

DSC_0137

DSC_0138