M
M
mediadata2016-07-11 14:31:50
Android
mediadata, 2016-07-11 14:31:50

Is it possible in an Android application to get the name of the apk file from which it was installed?

What are the ways to get the name of the apk file of an installed application? This is necessary to implement the task of tracking application installations with a unique apk file name. Off-market installations.
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Vasilenko, 2016-07-21
@farewell

PackageManager pm = getPackageManager();
try {
    ApplicationInfo ai = pInfo.getApplicationInfo("package вашего приложения", 0);
    String sourceApk = ai.publicSourceDir;
} catch (NameNotFoundException e) {
    e.printStackTrace();
}

Z
Zlatoslav Desyatnikov, 2016-07-21
@pxz

In your case, it will most likely be easier to write in the Manifest.
I remember, back in the days of old mobile phones and J2ME, in the "Dating Galaxy" chat, referral information (the id of the person who invited the friend) was stored inside the jar in the manifest. jar, respectively, was generated on the server for each person. In Android, it seems, this is also possible.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question