0

I want to build an Android app which will track the attendance of the users.So, each user will have an account with username and password and there will a manager who can view the attendance details of every user from the database.So everyday, when the users login to their account and enters the attendance for the day, if a user marks himself as absent for the day,then a notification needs to be sent "Only to the Manager" by the app that the user will be absent for the day.And that notification will be coming from the server when the users marks himself as Absent.Can anyone please let me know how to proceed?I am new to Android.

Pranami
  • 27
  • 1
  • 10

2 Answers2

2

What if the user mark himself not absent and he is not even in the school ?

Anw you can check Firebase Notifications

Firebase is a mobile and web application platform with tools and infrastructure designed to help developers build high-quality apps. Firebase is made up of complementary features that developers can mix-and-match to fit their needs.

Edit

With Firebase Notifications, you can target notifications to a single, specific device. You'll need access to the registration token for the app instance on that device, in order to provide the token when composing and sending the notification in the Notifications console.

Please check this and you will get it!

ArolaAb
  • 297
  • 3
  • 12
  • Each user will be getting a notification in the morning to fill his/her attendance.So,it is mandatory for each user to mark their attendance everyday. And the attendance for each day will be recorded in the database, so that if at the end of the month,the manager wants to check for how many days did a specific user not come,then he can view from the database. – Pranami Mar 20 '17 at 10:14
  • Yeah , but what if the user have not came to school and mark himself present for a lecture ? – ArolaAb Mar 20 '17 at 10:16
  • Actually I am trying to build this app for 7 users now.So,if any user has not come and marked himself/herself as "Present", then the manager will be able to catch him/her cheating. – Pranami Mar 20 '17 at 10:33
  • Thanks a lot for the help. Will surely go through the provided documentation. :) – Pranami Mar 20 '17 at 10:50
-1

Use SharedPreferences

When you login store if it's a manager login or not:

private final String KEY_PREF_NAME = "UserInfoSettings", 
KEY_IS_MANAGER = "KEY_IS_MANAGER";

private SharedPreferences mPref = getSharedPreferences(KEY_PREF_NAME, Context.MODE_PRIVATE);
mPref.edit()
                .putBoolean(KEY_IS_MANAGER, value)
                .commit();

value = true or false

When you get the notification check if the logged in person is a manager:

if(mPref.getBoolean(KEY_IS_MANAGER, false)){
//TODO show notification
}

On logout clear the preferences:

mPref.edit().clear().commit();
Aishwarya Tiwari
  • 625
  • 4
  • 19
  • No problem, because clearing app data will also logout the user. So to use the app he will have to login again and SHaredPreferences will be created again. – Aishwarya Tiwari Mar 20 '17 at 10:15
  • Do you think it's a safe way to save the manager login data locally ? – ArolaAb Mar 20 '17 at 10:18
  • Read [this](http://stackoverflow.com/questions/9244318/android-sharedpreference-security). – Aishwarya Tiwari Mar 20 '17 at 10:20
  • Also you can use encryption on the value if you want it secured from rooted devices as well. – Aishwarya Tiwari Mar 20 '17 at 10:22
  • Thank you , It's a great answer also the book provided is important https://ht.transparencytoolkit.org/rcs-dev%5Cshare/HOME/MarcoL/books/Application%20Security%20for%20the%20Android%20Platform.pdf – ArolaAb Mar 20 '17 at 10:26
  • Most welcome! Mark my answer as accepted if it helped! That'll be appreciated! :D – Aishwarya Tiwari Mar 20 '17 at 10:27
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/138517/discussion-between-arolaab-and-aishwarya-tiwari). – ArolaAb Mar 20 '17 at 10:27
  • @AishwaryaTiwari I will try to build the app with your approach.Thanks for the help:) – Pranami Mar 20 '17 at 10:31
  • I guess filtering the users on the server side is better from do it on each app , what if you hava 10 000 users and you have a slow server , the server need to send 10 000 notififcations and the app will need to do an additional work to check the shared preference and see if the notification should be showing . – ArolaAb Mar 20 '17 at 10:35
  • Definitely server has all data so it should be sending notifications to the manager only. – Aishwarya Tiwari Mar 20 '17 at 10:36
  • why you need a shared preference then if you know can reach the manager only ? – ArolaAb Mar 20 '17 at 10:38
  • @ArolaAb can you please explain a little bit on how to filter the users on server side? What I was thinking is to create a username and password for each user and also a username and password for the manager. – Pranami Mar 20 '17 at 10:38
  • As I say in my answer you can use firebase , you can store a login data like a database and let the fierbase server send the notification for you , also every device have a unique mac address and a unique IMEI.. – ArolaAb Mar 20 '17 at 10:41
  • @ArolaAb if you doing server side then no need to handle it device side obviously. – Aishwarya Tiwari Mar 20 '17 at 10:43
  • I edit my answer , @AishwaryaTiwari i think your answer isn't the best option here , using firebase is better. – ArolaAb Mar 20 '17 at 10:45
  • @ArolaAb Actually I am new to Android and I have never used Firebase before. I will try to learn and implement your idea if this approach does not work out. Thanks a lot for taking the time to help as much as possible. :) – Pranami Mar 20 '17 at 10:47