I want to restrict my application to install only allowed device. That is while installing the app I want to fetch the device information like imei number. Then I want to check the imei number if it is valid or not using my restored database of imei.
Is that possible?
Its not possible to prevent App installation, if one has the APK file but
Through smart coding you can achieve it
1) Anyways you will get the IMEI numbers of the users phone so programatically you can check the condition on landing/splash page if IMEI==USER_IMEI_NUMBER then only he/she can able to see its main page else he will not get authority to enter into main page but for that you need to create APK file for each device
2) If you dont know how many users will use your app then you can do remote database in that database you can save new users IMEI number and in splash/landing page you can check through webservice that IMEI==USERS_IMEI_NUMBER (from remote database) then he/she can use your app but off course for that you need to mention internet permission in it and user must have valid internet connection if you dont want user to check it identity/IMEI number each time then you can validate user at once and you can save its result in shared preferrences and you can give access to user everytime without hiting webservice for validation
hope this suggestion may help you happy coding :)
Related
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
I'm developing an android app which contains registration form also,
Here I want to make user can register only once in the device. and if register again (by clearing data or reinstall) with different mobile number and email id, app should give error message.
I think you need to check IMEI number of device
IMEI number will not be changed if sim card changed.
This alone cannot be achieved on mobile device itself. You also need to maintain server which keep the identity of device and user mobile number together. device identity can be combination of IMEI and device id
When you try to register, you do all local validation on client but ultimately 1 network call is must to register, for this send device_id and newly registered number.
Next time when some user tries to register with new number from same device, u'd already have this information on server, server can respond back telling, hey looks like this mobile device is already associated with an number do you wish to use the previous number instead.
In case, user denies, he must be allowed to delete the old relation between oldnumber-current device.
There after he can proceed with the way initially he started to register.
Also this is completely business requirement, whether u want to have 1device-> #numbers or #numbers -> 1device. But i would rather suggest to keep it safe simple and secure with 1device->1number.
For Android Version 6 And Above, WLAN MAC Address has been deprecated.
For uniquely Identification of devices, You can Use Secure.ANDROID_ID.
And we don't need any additional permission to retrieve Android ID.
you can get Android Id like:
public String getDeviceUniqueID(Activity activity){
String device_unique_id = Secure.getString(activity.getContentResolver(),
Secure.ANDROID_ID);
return device_unique_id;
}
You can do this by below approach.
On sign up, get user device IMEI number as well and store on server database as well.(In this step make sure that user that IMEI number does not exist)
I have an app that sends user location data to the server using webview load html. Since the users are truck drivers I do not expect them to know to login using password and user name every time they use app , so my solution is to for each user to make an app with it's own user name and password embedded into the app using the id field sent to the php page .
`enter code here`url="http://mywebsite.php?id=16"+"&longitude="+longitude+"&latitude="+latitude+"&brzina="+speed+"&vreme="+cal.getTime()+"&datum="+date;
What I am changing in url is the id field sent to php page .
Is there a way for me to automate the creation of Android apps without compiling app every time I have to provide a new app to the driver .Let 's say I am given a list of drivers with their id numbers I put this some were and I get for 15 drivers 15 android apps all with the different id part in url .
Do you need to know the ID before they connect for the first time?
If not, you can store a GUID on the phone, which is created on first time run. as an identifier. And when the GUID comes in to the server for the first time, you log them as a new user with that ID, and from then on, know its them again.
for generating a GUID I recommend the UUID class
and storing/retrieving it, maybe the SharedPreferences Class.
Alternatively, give them a GUID in an ini file, which your app runs off. (which you know the ID before hand.)
I want to let my app scan the users contactlist , and display the name of the contacts who also installed the app.
I have no idea where to begin with this . so if someone could help me getting started , that would be apreciated.
grtz
You will need to research ContentResolver because you will have to query the database containing the contacts. To do these queries, you will need the URI and column/header names for contacts db which can be found in the Contacts class.
You will also need users to register that they have your app on your own servers and the registration will need a piece of information about the user that other users would have in their contacts (the users phone number, email address, etc).
You will then need to query a few users at a time from the users contacts for this piece of information (using the ContentResolver and Contacts class), pass it to your server (as text) where it will check if they are registered, then send a message back to initial user (and possibly the match) that you found a match.
That's where you should start, and end :)
Note, you will need these permissions in the Manifest file:
android.permission.INTERNET
android.permission.READ_CONTACTS
First of all, welcome to StackOverflow. StackOverflow is for programming questions. As is such, a post asking for help should always provide a description of what you have already tried. If you haven't tried anything yet, I highly encourage you to try something, and post when you encounter a problem.
As your question stands now, we don't know what the problem is. Are you having problems scanning a contact list? Or are you having problems trying to figure out if another user has installed the app?
That being said, you will have to maintain a database for your app containing a list of people who have installed your app. When your app is launched on one device, do whatever you need to do to register the user in your database. Due to the nature of a "contact," one person's phone may only have their phone number, email address, or even just a name. This is of course something you will have to deal with in your implementation.
I am able to retrieve most of the information with the help of id in facebook.Is it possible to retrieve phone number of friends,because Json Array generated after parsing id is not giving the phone number.If it is, then how?
Yes it is possible to retrieve the friends phone number once they come to your app and grant you the permissions. To get that friend to come to the app, you need to make your app so cool that each user will want to have all their friends using the app too. It's a hard challenge, but it can be done, take a look at FarmVille, etc for some inspiration .