I WANT to make an application in which i want to receive a signal or anything else if user try to uninstall my application is there any way to do that ? Please help
Here is my manifest of my demo application
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.uninstalldefence"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.uninstalldefence.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name="com.example.uninstalldefence.BootReceiver"
android:label="Bilal" >
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<data android:scheme="Package" />
</intent-filter>
</receiver>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RESTART_PACKAGES" />
<Uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
</manifest>
and here is my broadcast receiver. But it didn't work Can you please provide any help ? package com.example.uninstalldefence;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.SmsManager;
import android.widget.Toast;
public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// Receive install the radio
if (intent.getAction().equals("android.intent.action.PACKAGE_ADDED")) {
String packageName = intent.getDataString();
System.out.println("installed:" + packageName
+ "package name of the program");
Toast.makeText(context.getApplicationContext(), "Added!",
Toast.LENGTH_LONG).show();
}
// Receive uninstall broadcast
if (intent.getAction().equals("android.intent.action.PACKAGE_REMOVED")) {
String packageName = intent.getDataString();
System.out.println("uninstall:" + packageName
+ "package name of the program");
Toast.makeText(context.getApplicationContext(), "Removed!",
Toast.LENGTH_LONG).show();
}
}
}