Ali Rahgozar
Ali Rahgozar

Reputation: 57

Finding installed application domains in Mobile

I have two questions:

  1. Is applicationId which is set in defaultConfig in build.gradle(:app) the application domain ?
  2. Is there a way to see installed application domains in an android mobile device? Thanks.

Upvotes: 2

Views: 1048

Answers (1)

DevWithZachary
DevWithZachary

Reputation: 3685

The app domain is indeed what you set at the application id

Sun recomends that you use your company's Internet domain name (which is known to be unique) written in reverse. You then use subpackages for different projects. For example, horstmann.com is a domain that one of the authors registered. Written in reverse order, it turns into the package com.horstmann. That package can then be further subdivided into subpakcages such as com.horstmann.corejava.

From the Revised and Updated Java SE 6. Core Java.

See How to get a list of installed android applications and pick one to run for how to get a list of installed applications and their domains

final PackageManager pm = getPackageManager();
//get a list of installed apps.
List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);

for (ApplicationInfo packageInfo : packages) {
    Log.d(TAG, "Installed package :" + packageInfo.packageName);
    Log.d(TAG, "Source dir : " + packageInfo.sourceDir);
    Log.d(TAG, "Launch Activity :" + pm.getLaunchIntentForPackage(packageInfo.packageName)); 
}

Upvotes: 1

Related Questions