types of user in android application - android

I'm currently making an offline application for android. Is it possible to have two types of users - admin and nonAdmin? The admin is the one who will add data to the application while the nonAdmin will just view data from the application.
If it is possible, how can I update the data of the nonAdmin if the admin had added new data to the application?

Sure, this is possible. What kind of data do you want to add?
To get started use two buttons "Admin" and "User" in your first view which is shown when the application is started.
"Admin" starts the AdminActivity to add data. This could be stored in Key-Value pairs, an SQLiteDatabase or directly to the internal storage - depending on what kind of data you want to add.
"User" starts a read-only perspective of your application, showing the data added by the admin.

Related

Hiding/making unaccessible features in android application according to user type

So I am creating an Android application in which suppose there are 2 user types, userType1 & userType2. Now what I want is that only userType1 will see and be able to access the post button, and userType2 Can't see and or access it. So what is the best practice for that?
The best practice would be to implement Firebase Authentication and save user data, either in Cloud Firestore or in the Realtime Database together with the user type. When you start the app, first you have to read the user type and then display the UI elements according to it. I have answered a question in which I have explained how to redirect the user according to its type to the corresponding activity. Here is how you can do that using Cloud Firestore:
How to redirect a user to a specific activity in Cloud Firestore?
Or using the Firebase Realtime Database:
How to redirect multiple types of users to their respective Activities?
The same mechanism can be used to hide/display a button. Don't also forget to secure your data using security rules.

Content availability. Android

I have an application where the user can add quotes.
I'm using Room for data storage.
I want to make it so that the user can add a quote and it would be visible to other users of the application.
Questions:
How can this be done correctly?
How to open access so that all users can see, not just you?
Thanks!

How to make an app save the content of an EditText/TextView?

I want to save some information about users' accounts in an EditText/TextView inside the app. For example I want my app to save in the EditText/TextView the content "Admin" for admin users and "User" for simple users. But I do not want to access the database every time the user opens the app. How can I save the content of the EditText/TextView even if the user decides to exit the app?
The users will not see the EditText/TextView. It will just help me avoid some reads in the database.
Just save it local / cache the data on the users device.
https://developer.android.com/training/data-storage/app-specific

How does Tinder retain user data when the user logs in from another device?

I'm trying to replicate Tinder's mechanism for retaining data on my Android app. It appears that Tinder can restore your profile images and bio:
After uninstalling and reinstalling the app
When logging in to a completely new device
(logging in via Facebook)
How do they do this?
I've looked through Data and file storage overview in the Android Docs and under "Databases" it says to implement SQLite with the Room Persistence Library. However this SQLite database lives in the device of the user so it's not fully persistent - if the user logs in via facebook on another device the data will not be remembered.
The following data is what I'd like to save for my tinder-like app:
User profile (image) & bio (text)
Check whether the user has matched before with another user
for this, an option I considered was each match stores the other matches profile/facebook ID in their internal storage/sqlite db (local) after they've matched. However if they get a new phone it will be reset
Google Maps data: how many people swiped in a certain city
What is the recommended way of going about this?

Use single database for multiuser in Android app?

I am developing a app and want to see offline data if Internet is not available . And this app can use multiple user like as after logout one user then another user can login and can see own data So how we can make database to accessible for among user
Use a discrimator column in your database table design to mark owner ship of every record.
Then you can impl. your data access methods so that they only query records for active user.
It's a design issue not a developing problem ;)

Categories

Resources