how to get notified before the new application has installed? - android

I am making an android app that will check for any vulnerability and malicious detection in android app being installed. now what i want is when user is installing any app then before the app get installed on device i get notified but broadcast receiver so that i can check the app for detection?
i have tried PACKAGE_ADDED but it is notifying me after the app has installed .plz tell me how can i do.i have used this code
<receiver
android:name="MyReceiver"
android:enabled="true"
android:priority="0" >
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" >
</action>
<action android:name="android.intent.action.PACKAGE_REMOVED" >
</action>
<data android:scheme="package" />
</intent-filter>
</receiver>

The logic in your description is to detect a package that not being installed. Why not to trigger some methods inside the uninstalled package and detect the related reaction, Or reverse the apk to the source code then analysis what you want.
To write an activity which may or may not be a launcher activity:
PackageManager pm = getPackageManager();
Intent appStartIntent = pm.getLaunchIntentForPackage("com.your.broadcast.receiver.package");
if (null!= appStartIntent)
{
startActivity(appStartIntent);
}
Also, you can try intent flag withFLAG_INCLUDE_STOPPED_PACKAGES to access the application that is stopped. Hope this could help you.

Related

intent-filter for knowing when some app is being opened?

I would like to know which intent-filter use for listen when some app is being opened from my BroadcastReceiver.
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />
</intent-filter>
Android OS doesn't allow this behavior. No broadcast will be sent out when a particular app is opened.
However, you can have a service that is constantly running in the background and in that service you can use the ActivityManager to get a list of the current open apps. Based on that info, you can start your activity. This is a work around.
There is no system broadcast sent out "when some app is being open", for privacy and security reasons.

how to know android app is installing/downloading

I am developing an android app in which user earns points when he installs and runs the apps from play store. Now if user wants to earn pints then he has to install the some apps from play store...while installing the app from play store what is the status of app(installing/downloading)
In my Android app I want to know the status of an app. i.e app is installing or downloading
I found NotifyListenerservice...not sure it is for that only.
Please tell me how to achieve this.
Thanks,
Anjali
Use a BroadcastReceiver to see if it has been installed or removed, or whatever you want.
<receiver
android:name=".receiver.PackageChangeReceiver"
android:enabled="true">
<intent-filter android:priority="99999998">
<action android:name="android.intent.action.PACKAGE_ADDED"/>
<action android:name="android.intent.action.PACKAGE_CHANGED"/>
<action android:name="android.intent.action.PACKAGE_FULLY_REMOVED"/>
<action android:name="android.intent.action.PACKAGE_REMOVED"/>
<data android:scheme="package" />
</intent-filter>
</receiver>
You can find an example here Intent PACKAGE_ADDED not registering
You can also use an AccessibilityService to validate if the app has been started, but you shouldnt abuse this for this use.
No you can't check.. Your app can't be aware of being installed or it is downloaded.
The broadcast receivers will be initialized only after the manual launch of the application. Before that broadcast receivers are not actually listening.
The application is in stopped state. The app needs a manual launch..
#Anjali The problem which you are asking is called Conversion Tracking. You can find out more about this term on Google.
When app is installed on device then OS send a broadcast to the application which can be listen by application. Have a look at below code:
#Override
public void onReceive(Context context, Intent intent) {
try {
if (intent.getAction().equals("com.android.vending.INSTALL_REFERRER")) {
Bundle extras = intent.getExtras();
String referrerString = extras.getString("referrer");
//ReferrerString variable contain your data which was passed to your application. Now you can do whatever you want to like communicating with server etc.
}
} catch (Exception e) {
}
}
Generally, If you are passing some unique parameter in the url to install the application then you will get those parameter in ReferrerString. Your play store link will look something like below:
http://play.google.com/store/apps/details?id=packagename&referrer=yourdata
You would need below manifest entries for it:
<receiver android:name="packagename.BoradcastReciverImplmentedClass" android:exported="true" >
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>

I am making an app and want to know when the app is uninstalling

I am making an app and want to know when the app is uninstalling. For doing it, I used BroadcastReceiver but I don't know where is my code is wrong? (when my app is uninstalling, BroadcastReceiver can't receive any message about uninstalling)
It's my app's Manifest:
<receiver android:name="receiver">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED"/>
<action android:name="android.intent.action.PACKAGE_DATA_CLEARED"/>
<action android:name="android.intent.action.PACKAGE_INSTALL"/>
<action android:name="android.intent.action.UID_REMOVED"/>
<action android:name="android.intent.action.PACKAGE_REMOVED"/>
<action android:name="android.intent.action.MEDIA_REMOVED"/>
<action android:name="android.intent.action.MEDIA_BAD_REMOVAL"/>
<action android:name="android.intent.action.BATTERY_OKAY"/>
<data android:scheme="com.example.testpermission"/>
</intent-filter>
You cannot get an event when your own app is uninstalling. See here. There is also a post on the subject here.
You can't, but if you have second installed application on the device - you can get notification via that application about the uninstallation of the first one (as far as I remember).
I believe that the application cannot monitor its own uninstall from two reasons:
It will make it much harder to uninstall application (some evil apps might even try to do something bad when their application is being removed).
If you remove application - you cannot run it, or send it events! The app should be closed for clean deletion.
About how to do it from second app:
Your second app should be a receiver to the ACTION_PACKAGE_REMOVED event (read about BroadcastReceiver, and see: http://developer.android.com/reference/android/content/Intent.html#ACTION_PACKAGE_REMOVED)

Android: How to get the installed App information using Broadcast receiver

I am new to android. I am using a Broadcast receiver which listens when a app is installed or removed.. When a app is installed or removed my Broadcast Receivers's onReceive(context,intent) will be called.. Now i need to get the info about the application installed or removed (Mainly the package name)..
Plz help
You can try this receiver and permission. (But this seem only work in /system/app)^^"
<receiver
android:name="com.your.receiver"
android:enabled="true"
android:exported="true" >
<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>
<uses-permission android:name="android.permission.BROADCAST_PACKAGE_REMOVED" />
All the information you want is in the Intent extras.
Look at How to find the package name which has been uninstalled when using Intent.ACTION_PACKAGE_REMOVED

How to know Application Installation is completed in android?

I want to create such a service which start when any new application is installing on android device. so how to know any application getting installed in android device, is there any Intent event is fired ?
<receiver android:name="r1">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED"/> <data android:scheme="package"/>
</intent-filter>
</receiver>
you can try this broadcast receiver....
also go through
"android.intent.action.PACKAGE_REMOVED"
"android.intent.action.PACKAGE_REPLACED"
might come in handy...

Categories

Resources