Using proximity sensor in Android App

Proximity Sensor in Android device is really helpful while building interactive applications, it can help you to add very good usability features in application.

For more technical details of proximity sensor and how it works check Wikipedia.

The main function of proximity sensor is to detect presence of nearby objects without any physical contact.

Now in many interactive apps it can be used like :

– Receive a call when user picks up the device and takes it near their ear
– Automate audio recording when user takes device near their ear
– Reject call when phone is placed upside down
– Turnoff screen when phone is in pocket
– Turnoff screen when phone is near ear to avoid accidental touches

We used this feature for our app to start playing a sound through earpiece when user takes device near their ear. It took some time to get it working so we thought to share the code so it can be helpful for others, you can use below code to get it working easily.

Usage : 
 * Initial set Up of proximity sensor
 * It will call onPlay when device near to any object,
 * and will call onPause when device os moved far from the object
private void setUpProximitySensor()
    if(mProximityController == null)
        mProximityController = new ProximitySensorController(getApplicationContext()
        ,new onProximitySensorCallback() {
            public void onSensorUnregister() 
            public void onSensorRegister() 
            public void onPlay() 
            public void onPause() 
            public void onError(int errorCode, String message) 
                Log.e(TAG,String.format("onError() : %2s", message));
        //start register here

 * register the proximity sensor using proximity controller
private void registerProximitySensor()
    if(mProximityController != null)

 * Unregister the proximity sensor using proximity controller
private void unregisterProximitySensor()
    if(mProximityController != null)

You will need these 2 files (find them in zip) for this code to work, import them in your project, change package name to match your project’s and use above code.



Follow android developers guide for Proximity Sensor here : Position Sensors | Android Developers


facebooktwittergoogle_plusredditpinterestlinkedinmailfacebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Smart Floating Clock – Android App from Urva TechLabs

Smart Floating Clock

Smart Floating Clock is now available on Google Play Store :

It’s Smart because the Clock stays on top, still you can click through it!

Features :

– A text only clock stays always on top, floating
– When its set to not moveable, you can click through it.
– Text size, color and position can be customized
– You can select to show AM/PM
– You can select 24 Hrs or 12Hrs format
– Date can be visible or hidden
– Date color and format can be changed, we have many date format options available
– Automagically manages its position in landscape and portrait modes.
– You can open settings, toggle clock mode to make it moveable or not or close the clock directly from notification
– Ongoing notification is must to keep the clock alive, if you disable it, clock will be closed anytime.
– If you messed up the position of the clock or want to reset your changes, just click on reset all settings!

Screenshots :


facebooktwittergoogle_plusredditpinterestlinkedinmailfacebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Smart Expense Tracker – First Android app from Urva TechLabs

Hi All,

Here we are launching our first android application, its live on Google Play Store :

What it does :

– Almost every Indian bank and credit card services send transaction details to customers phone as an SMS, so we tried to help you to track expense through parsing those messages.

– However its not limited to track expenses only through SMS, you can add expenses as much as you can.

– So dont get confused at the end of the month calculating which thing covered most of your budget, just use “Smart Expense Tracker” without paying anything.


– Dashboard helps you to manage everything on single page, you can add expense, manage categories, manage SMS parsing and see history of your expenses.

– On Dashboard, Expense quick view panel displays expenses per categories, you can select period of days to see expenses only for that period.

Add Expense

Adding expense to “Smart Expense Tracker” is really easy :

– Add your amount
– Add optional notes for your expense (we recommend you add, as it will help you to recollect why the expense was made)
– You can change date and time for the expense, default time will be current time of device
– Select a category for your expense
– And save!

Expense History

– The History page will help you to scrutinize your expenses
– By default you see expenses made “Today”, you can change the period of expenses, using custom mode you can see maximum 60 days expenses on this page
– You can group expenses by category or date
– We have beautiful graphs to visualize your expenses, each category will have their own color code
– By tapping on any expense entry, you can see more details of that expense, you can edit and remove expense from the same details panel.
– If the expense entry was made with SMS parsing, you can see the SMS content from details panel too.

SMS Parsing

– SMS Parsing simplified : You can restrict the app from parsing every SMS you receive, you can use either SMS Templates or more smarter Hot Words. So it will ask you to add expense only the SMS content matches the template and/or hotwords.

– You can enable or disable all or particular hotwords or templates parsing at any point of time.

Hot Words :

– When SMS is received and it contains any of the Hot Words added to the application, it will try parsing the content, and if any amount is found in text, it will ask you to save this to “Smart Expense Tracker”

Templates :

– Templates are very helpful to parse messages perfectly, we will not guess the amount from SMS, but it will have exact amount, so you just have to press “Save” when “Smart Expense Tracker” asks you to save expense.

If your XYZ bank sends you transaction message in this format :

Your a/c 00000000 is debited Rs 10000 on 2014-02-04 A/c balance is Rs 100000.00 Info: Payment Through Online Gateway

Just replace the amount with “@@” and its ready to go :

Your a/c 00000000 is debited Rs
@@ on 2014-02-04 A/c balance is Rs 100000.00 Info: Payment Through Online Gateway

So when you receive next message from bank :

Your a/c 00000000 is debited Rs 1234.56 on 2014-02-04 A/c balance is Rs 98765.44 Info: Payment Through Online Gateway

“Smart Expense Tracker” will ask you to save expense like :

SMS Popup

SMS Popup


– Its not much smart if you can not categorize your expenses, just storing expenses might be not much helpful, so we have easy to manage categories.
– You can add as many categories as you want, color code them to easily identify
– You can change category name and color at any time and it will be reflected everywhere
– We have smart category removal
– Inactive categories will no longer be shown while adding or editing an expense

Backup & Restore

– We change devices, just to upgrade or its necessary sometimes, so we have smart Backup & Restore facility to help you never lose your old entries in “Smart Expense Tracker”
– You can Export everything from your “Smart Expense Tracker” and Import it to another device
– While importing you can select to “Merge with Current Data” or “Delete Current Data”, Merging is smart feature, you will not end up with duplicate entries
– You can keep backing up your data and transfer it to safe location so you never lose any records. In future we will provide server sync

Other Features

– You can select currency from our limited list for now : INR, USD, EUR, GBP, RM, AUD, CAD We will add more currency support in next release
– You can use beautiful widget on your homescreen, so you can quickly review your expenses and easily add expense directly from your homescreen!
– No ads, no annoying advertising popups and no suspicious permissions!! We require only these permissions :




Privacy and Terms Of Use

– “Smart Expense Tracker” is free to use, you don’t need to pay anyone anything to use this application.
– We never send your usage, SMS or any other information to anywhere, everything you store using this application stays on your device, unless you intentionally send backup file to someone or any service, but
“Smart Expense Tracker” never does that with or without your knowledge.
– “Smart Expense Tracker” is available with as-is basis, we are not responsible for any data, information loss, or anything which can harm you or your device by using this application in any way



Beautiful Graphs

Color Picker


facebooktwittergoogle_plusredditpinterestlinkedinmailfacebooktwittergoogle_plusredditpinterestlinkedinmailby feather