Reputation: 27
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.
Upvotes: 0
Views: 246
Reputation: 297
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!
Upvotes: 2
Reputation: 625
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();
Upvotes: -1