Android App: How To Prevent A User From Re-installing An App That Was Previously Installed And Afterwards Uninstalled?
Fundamentally, I want to keep track of user's device say some unique device-id which is then stored on a server when the user installs my app!and if it again tries to install my ap
Solution 1:
I think you can't prevent user to re installing it, But in your application you put a functionality which check database for device ID previously installed app if you found then you disable the functionality of your app.
Solution 2:
//use this following code to find the app is installed or not //your app package name is the unique id
//appUniqueIdStr -package name of the app
boolean installed = appInstalledOrNot(appUniqueIdStr);
if(installed){
//dont install
}
else{
//install
}
/**
* check app installed or not
* @param uri is the package name of the app
* @return boolean whether installed or not
*/privateboolean appInstalledOrNot(String uri)
{
boolean app_installed = false;
ListofAppinMyDevice getmyApp=new ListofAppinMyDevice();
ArrayList<PInfo> apps =getmyApp.getInstalledApps(false); /* false = no system packages */
Log.e("hi", "apps==="+apps.toString());
String uri_app=null;
if(uri!=null)
{
uri_app=uri;
}
else
{
uri_app=null;
}
for (int i = 0; i < apps.size(); i++)
{
Log.e("pack name", "apps.get(i).pname.==="+apps.get(i).pname.toString());
if(apps.get(i).pname.toString().trim().equalsIgnoreCase(uri_app))
{
app_installed=true;
Log.v("hi","im inside the loop");
break;
}
}
Log.e("boo", "app_installed==="+app_installed);
return app_installed ;
}
Solution 3:
You can't uninstall an application yourself (otherwise you would see viruses wiping our phones from the beginning) but you still can disable the application if the device is found in the database.
- create a connection to your server
- ask if the device is authorized
- close the app if you're not authorized
Post a Comment for "Android App: How To Prevent A User From Re-installing An App That Was Previously Installed And Afterwards Uninstalled?"