3

check whether the Amazon or the samsung market or the google play that installed android app in device.

Say if i have app named ABC installed in my android phone. In my application i list down all the apps installed in my phone and need to list the market from where they where downloaded.

How can this be done?

phil
  • 78
  • 6

3 Answers3

0

One option is to package them individually. If at some point you decide to use any marketplace specific features, such as licensing or in-app payments, you'll need to do that anyway.

A manageable way of doing so is a library project containing almost everything and a number of mini-projects that rerference it and contain only the specifics.

The drawback: multiple projects instead of one. The benefits: manageability, maintainability.

Edit: if you still prefer using the certificates for that, this example can help: thomascannon.net/misc/android_apk_certificate/ .

Please post the solution you eventually come up with.

full.stack.ex
  • 1,747
  • 2
  • 11
  • 13
0

Quoting an answer from Detect if app was downloaded from Android Market

Starting with API 5, you can use PackageManager.getInstallerPackageName(String). From the documentation:

Retrieve the package name of the application that installed a package. This identifies which market the package came from.

To get the package of the Android Market, this post may help.

I guess with the appropriate devices, you could build an app to output the package names of each market you want to recognise.

Community
  • 1
  • 1
Vincent Mimoun-Prat
  • 28,208
  • 16
  • 81
  • 124
  • According to the [Samsung Developers Forum](http://developer.samsung.com/forum/thread/getinstallerpackagename-return-value-in-samsung-phones/77/177735) this method won't work on app installed from Samsung Apps as it'll return `null`. – hleinone Jan 29 '13 at 12:16
0

I did it this way(a single src and res folder for all projects, different LauncherActivities for each market):

Copy your res and src folder somewhere like /sharedsources/

Make a three new projects for Google/Amazon/Samsung.
Delete the res and src folder from each project

In each project link to /sharedsources/res and .../src
Now make a three new activities:
e.g. GoogleLicensing,AmazonLicensing,SamsungLicensing

Google Project Manifest: set GoogleLicensing as Launcher Activity
Samsung Project Manifest: set SamsungLicensing as Launcher Activity
Amazon Project Manifest: set AmazonLicensing as Launcher Activity

Google Project: remove SamsungLicensing and AmazonLicensing activities from build(dont delete) Samsung Project: remove GoogleLicensing and AmazonLicensing activities from build(dont delete) Amazon Project: remove SamsungLicensing and GoogleLicensing activities from build(dont delete)

Done.
Export each Project.

Keep in mind that you have three AndroidManifests now, which need to be edited accordingly. Also keep in mind that you should only have one project open at a time. There is no reason for opening more than one anyway, since they share the same source...

Actually i did this to be able to swap between Linux and Windows (my sharedsources folder is on a shared hdd) only for 1 project, but it worked out very well for the different markets aswell.

stefple
  • 1,007
  • 17
  • 28