Thursday, January 1, 2015

Android Geofence Stop Getting Transition Events After Some Time

And here comes the first technical blog of 2015, Recently in one of our android application we have used Geofences in Android application. The app needs to track entry and exit of device in Geofence. After implementing and configuring Geofences by help of the sample code from android developer site, it worked good for some time but after the app is running for long time suddenly no transitions were recorded even though the device was in Geofence. After looking for the reason for few hours, I finally found a solution, in this blog I am going to mention that.

The issue was with IntentService mentioned in example code. When your device enters into Geofence, this intent service gets called with pending intent. It works good if your app is in foreground but when the app is in background, this IntentService is never called. So to overcome with this shortcomings, we have used Broadcast receiver in stead of IntentService.

So first define BroadcastReceiver in Manifest file.

            android:exported="false" >
                <action android:name="com.tracksum.vehicletrack.GeofenceReceiver.ACTION_RECEIVE_GEOFENCE" />


Now create this class in your package. 

public class GeofenceReceiver extends BroadcastReceiver {

   public void onReceive(Context context, Intent intent) {
       if (LocationClient.hasError(intent)) {
       } else {

    private void handleError(Intent intent){

   private void handleEnterExit(Intent intent) {
       int transition = LocationClient.getGeofenceTransition(intent);
       if (transition == Geofence.GEOFENCE_TRANSITION_ENTER){
       }else if(transition == Geofence.GEOFENCE_TRANSITION_EXIT){

This is your broadcast receiver. Now create an intent and pending intent with this.

Intent intent = new Intent("");

PendingIntent geoFencePendingIntent = PendingIntent.getBroadcast( getApplicationContext(), 0,                                                                             intent, PendingIntent.FLAG_UPDATE_CURRENT);

Add this to location client while adding geofences.

mLocationClient.addGeofences(geofenceList, geoFencePendingIntent, this);

That's it and now you will get all the transitions of Geofence if your app is not in foreground.

Introducing Adsum


This is my first blog post of 2015 and this time it's not technical blog. I would like to introduce a product built by our team. Since last few moths we were building this product and finally it's here so here we are introducing our milestone product "ADSUM"

Adsum as the name suggests means "I am present".   Briefly, Adsum is an app on your phone that keeps track of your attendance on day to day basis. It makes the life of the employee and HR easier by creating monthly charts of attendance, absenteeism, leave and sick day and linking it to the employees payroll and has many other benefits.

It's a GPS based attendance & leave management system that helps the Organizations & Managers to manage the resource on the fly. Output from this system can be linked to payroll, expense management system etc. Data is accessible real time and helps you to reduce the conflicts amongst the workforce on attendance and leave management. System can be customized based on your needs and reporting requirements. Following are few screenshots of the application.

It comes with two different views for employees and managers. Managers has extra views like dashboard and activities. App has real time notifications which is sent to managers as soon as employee marks attendance and apply for leaves. Managers can approve leave and attendance form the app it self.This makes their life so easy. 

It's an ideal app for organizations who has staffs which are paid on hourly basis. Using Adsum app you can precisely calculate number of hours worked and you can have monthly and weekly report for payroll. 

In short this is an awesome application for any business who want to automate their attendance management system. If you want this app for your organizations or want to know more about it, kindly contact us. Following are our contact details.

Vibhay Vaidya : +919920465555
Rinkal Shah : +919898171728

Also drop us an email on following email ids.

Thank you.