Setting different user priviledges for an android studio app - java

I am creating an attendance monitoring app using Android Studio and MAMP server. I have the same MYSQL database connected to both apps. Initially I was creating an app for students and another app for staff. However I think this is not the best way to go about this. Is there any way to set different user privileges so I can just create one mobile app that will give users access to different pages within the app? Thank you

In response to your question and comments. You should have a single table for user and in that table have a column which stores the privilege level of that user. Then for each user when they log into the system you can check what privilege level they have and load the correct resources.

Related

is there is any way to disable firebase account from code in android studio

I'm creating an application which is going to be active for first 30 days and after that the user should get automatically log out from application itself (as user's account will be deactivated), or is there is any workaround for the same because I can disable accounts from Firebase Console but that doesn't affect any user if they remains logged In.
Mainly I wanted this for Android Studio, I can do the required method through Firebase Database itself but just wanted to know if there is any alternate method available.
If you are asking how to disable a Firebase Authentication user account, that's not possible from within web or mobile application code. You can instead write backend code using the Firebase Admin SDK.
You can disable the account by updating the user and setting the disabled flag to true. Or you can delete the account entirely if you are done with it.

What's the simplest way to request information from (own) other applications

The company that I work for has some small android applications running that communicate with their ERP software lately they requested to authenticate users and have sessions for safety reasons
Instead of integrating the autheticate and session code into every app (6) I want to build an Android app that acts like a dashboard. The app will authenticate the user, create a session and show the available apps on the device that the user can access with their user role.
The problem is I need the know which app requires which user role
I don't want to store this information in the dashboard app sinds that will require me to update the dashboard app each time i create or change an app
I was thinking or using an Content provider but that seems to be a lot of work and redundant since it has to be integrated into every app that I have (6)
So my question, is there a way to get data from apps that can easily be implemented. The data isn't big (only one Integer)
thanks in advance.

Android : get a unique id on each app to rate a service only once

I have a restaurant app showing profiles of the chefs we got...
I set a Firebase database where users can rate each chef..
yet I want to get a unique id for each installation of the app which is persistent with time, so that a user can re-submit a rate for a chef yet he's contributing to the whole rate only once..
is there such an id ?
is there a better way to do so?
thanks in advance, great people..
If your users sign in with Firebase Authentication, you'd typically use their UID for this purpose.
That would prevent them from rating the same check multiple times, even if they use the same app on multiple devices, or reinstall it on the same device.
If you're not (yet) using Firebase Authentication, I'd recommend adding it for this use-case anyway. You can use it without requiring your users to sign in, by using anonymous authentication. This is as simple as calling:
FirebaseAuth.getInstance().signInAnonymously();
But follow the instructions in the documentation to ensure you don't create a new UID every time the app runs.

How should I implement friend's data loading?

I'm writing an Android app using the phone number as the ID. I am getting all the contacts from the client's phone. I want to display to the user all of his contacts whom installed the app (just like whatsapp).
I was thinking about sending to the server all of the contacts and execute a search for each one of them to check if they exist in the db, and send back all the registered players. I am afraid this implementation will slow my app since I have to load all of his friends on every loading page (in case of new contacts that installed the app, or deleted and so on)
What are your thoughts about it?
Use a contacts cache and invalidate/recreate it whenever the contacts DB change, use code such as how to listen for changes in Contact Database. That should make your suggested approach fast enough.
Cheers.

Registration in app right way

I am want to do registration in my app. So i have made all requests to my web service.
I now when user is registered.
Now i need to save somewhere that he is registered that don't give him registration form again.
How to do this ?
Do i need to save somewhere in my sqlite database and every time when app lunches check if he is registered user. Or maybe in app settings i could save this information.
I am new to developing android app and i am searching for the right way.
Thanks all for help.
You could save that with SharedPreferences. Check the link for sample code.
http://developer.android.com/guide/topics/data/data-storage.html#pref.
This data will be removed if the users uninstalls the app or clears all data from system menu.
Edit: If you really want to remember preferences across installs you should try Backup API. http://developer.android.com/guide/topics/data/backup.html
The best solution is to use Android's Account Manager to handle user account. This aproach is the most secure (credentials are not exposed), however it has two drawbacks:
It's a little bit complocated to set up
It requires at least API version 5
Once the user registered you can save in your sqlite database and you have to check for each time when your application launches. But if the user uninstalled the application and tried to reinstall it ll ask for registration again.. In order to avoid this you have to store the information like the device id and the registered details in some servers and also in sqlite database and have to check when the application launches...

Categories