How to make different authentication numbers everyday without editing code? - android

I am making a commuting web with vuejs and firebase.
I want to make this:
The boss gives the employee a different authentication number every day, and the employee (user) has to enter the authentication number when pressing the go to work button. (to To make sure he's the one boss hired.)
For this function, I can make this with v-if (v-if code == 123 like this), but the problem is that I cannot edit the code every day. How can I change the authentication number every day without touching the code?
I would also like to create an app that can easily change the authentication number so that the CEO can use it.

Well you can do this,
Whenever the boss sends the authentication number to a particular employee, save that authentication number in firebase under the employee's details as for eg. - "todaysAuthNo: 123456" , when the employee(user) enters the number and press the go to work button then check whether the number entered by the user matches with the number entered by the boss i.e. check whether it matches with "todaysAuthNo: 123456".
Hence, next time when the boss enters a new authentication number it will get replaced with the old number in "todaysAuthNo" and also the user will need to enter the new authentication number entered by the boss to login.

Related

How to keep a log of button clicks in Android App

I have an App in which I would like to start charging the user after they use a feature 5 times.
The unpaid App allows the user to click a button (to do a pre-determined task), and after that, the user must pay to be allowed to do the same task again.
I need to make sure that the log of button clicks is saved even when the user uninstalls/then re-installs the app - this is the main thing I do not know how to do.
Please kindly help!
first get the device unique ID with:
String id = Secure.getString(
getContext().getContentResolver(),
Secure.ANDROID_ID);
then store this id on your server with number of clicks, so every time the user redownloads your app you can identify the device and check how many times the user clicked the button
Well, if you want to keep this info even if the user reinstall the app, you can't save this info in local storage. You should have a database where you can store a user ID and how many times user has already clicked.
As creating a database and put it online requires some backend work, if you have no backend skills (like me), give it a try to firebase: https://firebase.google.com/
In short words, firebase is a Google solution to provide a backend to your app.
With firebase you'll be able to apply a login system (where you'll have a user ID) and create a dabatase (where you can store infos, like how many times user has used the feature)

When user login in one mobile, the same credientals should not login in another device in android

As I want to implement the login function same as whatsapp . If the user login in one device using (email and password) .The same login should not happen in another device.How to implement this functionality in android
In my application whenever the user login ,the status value will be change as 1 in database, when the same user if login in another device means it will show popup, already exist,If the previous user logout means value changed as 0.
But my doubt suppose if the user as logged in and uninstall the app means again he cant able to login again because the value changed as 1.
For the above situation how to handle.Please someone help me.
I am not sure, but the following idea may work.
As also mentioned here, save every users' phone ID to your DB as well. (I am also adding the code for helping you, but as I mentioned code was written by someone else in the link above)
import android.provider.Settings.Secure;
private String android_id = Secure.getString(getContext().getContentResolver(),
Secure.ANDROID_ID);
Then, check if the user is trying to log in by using that device which has its ID stored in your DB. If this is the case, directly log in the user. This shows that user deleted the application without logging out.
If the user uninstalled the program in the other device and then enters the application from another device, ask the user to log in again. After user logs in, save the current device's ID in your DB. For security issues, maybe you can store the old logged in device's ID and model and more.
I hope I clearly explained to you the idea. Let me know if that helped or not.
Have a nice week!
You need to maintain session for this. when user logins create and return one sessionId for that user. for all request there after need to pass that sessionId. if same user login from another device overwrite previous sessionId with new one. so that based on that first users request will be invalid. and one user is login on one device only

How does barclays uk validate a user from a phone call

So basically on barlcays uk app you can have a button to direct call them from within the app.
The phone number is just a normal number +44 333.... doesn't seem to include any personal information or token about me/app.
So from the app it makes a call to this number +44 333... and I don't need to provide any information about me.
But if I call again the same number without the app I need to answer security questions.
So how do they do it? based on my current number and a small time interval?

Process to change userId i.e. mobile number to another one

I am designing application's functional and structural flow and need suggestion in one condition.
In this application mobile number is a userId of a user i.e. user can register to the app through mobile number and now he/she wants to change the mobile number and want all the data on the current number. So what should be the process to do all this ??
Your suggestion will add value to my thought. Thanks..

keeping track of online user using phone number

I am developing android application in which want to keep track of online users.
When the user install the app, he gives his number and country code, we register the user with that number.
Now whenever he starts the application he sends the list of all mobile contacts to server to find who is online.
The problem with this approach is same mobile number can be in different format like
+91 9665123456
91 9665123456
0 9665123456
9665123456
Lets assume while registering the user A gave number +91 9665123456 and we register the user and make it online whenever the app is running.
But in user B mobile, his number is stored as 09665123456, I need to query whether user A is online or not, but as both number are different what approach to use ?
I am not sure how whatsapp approaches to this problem?
The other way what I can think of is using libphonenumber to find the number match but it also gives probability.
Is there any other approach which is recommended to handle above scenario ?
I would suggest a below approach:
1, Your server should have a list of country codes and the corresponding number of digits allowed for a mobile number in that country
2, When the registered user A , comes online and sends his contacts to your server for the first time, you can check a contact by starting from the left end of the number. If you see a international prefix 00 or +, then take the first digit from left, identify the country code and if the remaining number of digits to the right match the defined number of digits for this country , scan the list of users registered with that country code to see a match. If no, then take the first 2 digits to see for a possible country code and check similarly.
Now if you dont see any international prefixes in a contact, that means the contact is in the same country as A and so you need to scan the list of users registered from the same country after taking the last certain number of digits as required for that country code.
3, It will be better if you generate a unique id for a each registered user which can be used as a primary key for a user database. This will eliminate the need for detailed scan for repeat users. For eg: let A have an id 123 and B have an id 456. When A logs in, set the online flag for A , then search for B and if B is already registered, then add B's id 456 to A's friends list along with corresponding number stored by A. So next time when A comes in, you will see that contact B has a unique ID assigned and so you need to go check if the online flag is set for this ID. Also this will be useful even if a user changes his/her number
I had a similar issue while developing an app. What you can do here is, to check the input for special characters, and also take the size in account. Remove the spaces, and store just the last 10 digits. This can be achieved by trimming and subString operations, if the entry type is a string. Then comparison of the two strings should result in a desired manner.
as per my suggestion
==> first of all you remove all space in your number using replace(" ","") function,
==> then use query for match last 10 character so its give you mobile number which you have want to find is there online or offline from users Contact book.

Categories

Resources