Salesforce™ Android Attendance Management App

We are Salesforce™ Experts and we channelize our energy by documenting all the industry-specific technical problems we solve in Salesforce™ CRM world. Here I am going to explain Salesforce™ Android Attendance Management App. I was closely involved as a Salesforce™ Developer. And we have done it successfully.

This is an Attendance management app integrated with Salesforce™ Rest API and Google Map API. We have developed this app for update the daily Attendance In-time and Out-Time of the employees. Username and Password required for login into the application. Once the user clicks on Attendance In Button a record will be created in Salesforce™ object and while leaving office to click on Attendance out Button same record will be updated with Time outfield. User can’t log in and log out from 100 meters away from the company. If the user forgot to log out while leaving office, So in next day as he will open the app the last record will update and total hours will be count as 5 hours means the half day will be count. We are using Username and Password flow for directly start the app, It will not ask any org credential . 

Client Requirements

  • A client wants an attendance app to manage attendance for employees.
  • They want an Android app which will be managed by Salesforce.
  • Client requirement is an employee will able to log in and log out only single condition when they are nearby (100 meters) of their office area.
  • The user can see the office location and distance with the best path from their current location.
  • A separate credential for every employee like Username and Password.
  • A client doesn’t want to log in every time when they open the app on their respective devices.
  • Once the user logged-in, they can’t log out.
  • The user can put attendance only once i.e between 8 AM to 11:59 PM.
  • All the record will be stored in Salesforce database.
  • For every user total hours will be count every day.

Our Solution

  • We have developed an android app for attendance management.
  • All the record will be stored and managed in salesforce™ DB.
  • We have integrated Google Map and salesforce Rest API in this application.
  • Using this app, the user can see the distance between office and their current location with the best path.
  • We had provided login feature to all app users with their separate login credentials.
  • We haven’t developed any logout button as per the client requirement. Once user logged-in then, they can’t exit the app until they uninstall it.
  • We have created login credentials like Username and Password FLOW to start the app right away, It will not ask any org credential every time.
  • The user can mark their attendance once in a day between 8 AM to 11:59 PM.
  • Salesforce will store all the user record like Attendance-In time and out time as well as total hours in a day.

Here are few screenshots of App

  • This is login page , We need to fill Username and Password and hit on login.
  • Once user logged in then they can mark their attendance. 
  • Attendance record details will show in salesforce.
  • It will show In time, Out time, Total hours. 
  • In this screenshot you can see google map integration with App.
  • It will show the path and distance from source to a fix destination. Here are few code snippets For check location under 100m
    • Users will only able to log in and log out when they are nearly 100 meters.
    • If the user is beyond pre-defined range i.e 100 meters then, login and logout buttons won’t be Active.
    • And users will be barred from app access

    @Override

       public void onLocationChanged(Location location) {

          

           boolean connected = false;

           ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);

           if (connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED ||

             connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED) {

               //we are connected to a network

               connected = true;

           } else {

               connected = false;

               runOnUiThread(new Runnable() {

                   @Override

                   public void run() {

                      //perform own function when we are not connected to a network   

                   }

               });

           }

    Google Map Integration :-

    • Here we did google map API integration with Android.
    • Which will help the user to show the exact location of their office.
    • It will also help to find the best path from the current location.

    xml code where you want to show the map

    <com.google.android.gms.maps.MapView

       android:id=”@+id/map”

       android:layout_width=”match_parent”

       android:layout_height=”400dp” />

Author: AJ

Share This Post On

Submit a Comment

Your email address will not be published. Required fields are marked *

× How can I help you?