Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installed application is third-party or not

Tags:

android

How can I get the list of installed third-party applications on Android phone.

I am able to get the list of application with the code below but I want only third-party applications.

PackageManager pm = context.getPackageManager();
appInstalModel.setAppName(p.applicationInfo.loadLabel(context.getPackageManager()).toString());
appInstalModel.setAppPkg(p.packageName);
appInstalModel.setAppVersionName(p.versionName);
like image 389
Ajay Singh Avatar asked Apr 01 '11 14:04

Ajay Singh


People also ask

What are considered 3rd party apps?

Third-party apps and services are created by companies or developers that aren't Google. For example, you may download an app that helps you schedule workouts with friends. This app may request access to your Google Calendar and Contacts to suggest times and friends for you to meet up with.

How do I know if a third party app is installed?

Go to Settings. Tap Apps & notifications, and then tap See all... to view the app list. Look for any suspicious or unfamiliar apps, and then tap Uninstall or Disable.

Can I install 3rd party apps?

Android is, for the most part, an open platform. You can use the Google Play Store to install apps and games or you can go off the reservation and install APKs on your own. It's not a practice we recommend.

What is a first party application?

First-party applications are those controlled by the same organization or person who owns the Auth0 domain. For example, let's say you created both a Contoso API and an application that logs into contoso.com and consumes the Contoso API.


3 Answers

    List<ApplicationInfo> apps = getPackageManager().getInstalledApplications(0);
    for (int i=0; i < apps.size(); i++)
    {
        if ((apps.get(i).flags & ApplicationInfo.FLAG_SYSTEM) == 1)
        {
            //System app
       }
    }
like image 110
RoflcoptrException Avatar answered Nov 10 '22 02:11

RoflcoptrException


RoflcoptrException's answer is correct. But in some cases it won't give you all the installed third-party applications. ApplicationInfo also has flag FLAG_UPDATED_SYSTEM_APP which is set

If this application has been install as an update to a built-in system application

On my smart phone such applications include Amazone Kindle, Adobe Reader, Slacker Radio and others. These applications did not come with the phone and were installed from Google Play Store. Thus, they can be considered as third-party apps.

So, you may also want to check FLAG_UPDATED_SYSTEM_APP flag.

final PackageManager packageManager = _context.getPackageManager();
List<ApplicationInfo> installedApplications = 
    packageManager.getInstalledApplications(PackageManager.GET_META_DATA);

for (ApplicationInfo appInfo : installedApplications)
{
    if ((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0)
    {
        // IS A SYSTEM APP
    }

    if ((appInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0)
    {
        // APP WAS INSTALL AS AN UPDATE TO A BUILD-IN SYSTEM APP
    }
}
like image 21
Nikolai Samteladze Avatar answered Nov 10 '22 01:11

Nikolai Samteladze


The ApplicationInfo object will have the FLAG_SYSTEM flag unset. The sdmove program might have some sample code.

like image 25
Josh Lee Avatar answered Nov 10 '22 00:11

Josh Lee