Amazon & Google Play deployment - what is pseudo-code for license checking?

I currently have an app which performs license checks for the Google Play store.  So basically working based on this pseudo-code:

if not device.isSimulator and device.isAndroid then   -- do Google Play license check end

Q1 - How would the pseudo code change for a Google Play and Amazon deployment?  

I’m also wondering regarding this:

Q2 - Is it possible to detect what app store a device is using?  I’m assuming no.   Also I’m assuming any Android devices (e.g. Nexus) can purchase from Amazon store, so therefore you can’t use checks in your code such as “if model == “Kindle Fire”” here. 

Q3 - Perhaps the Corona build (when you choose Google Play or Amazon) marks the target store, so is there a Corona API call you should use to develop the Pseudo Code to be like:

  if androidDevice then -- using model checks, i.e. isn't an iPhone or IPAD     if coronaapi.buildTarget == "GooglePlay" then        -- do Google Play Check     elseif coronaapi.buildTarget == "Amazon" then        -- do Amazon check (or however Amazon licensing works)     end    end

So trying to make sure that the solution doesn’t accidental (a) not perform a license check to the wrong store or (b) not perform a license check by mistake.  I’m referring here I guess to what happens when a user copies an APK and manually copies onto another device.  e.g. if they copied an APK from a Google Play downloaded version of your app, copied onto another device (say Kindle Fire) and then run, i.e. making sure your app didn’t do “I’m on a Kindle Fire so don’t do Google Play license check”

Can’t answer any if these, but here’s a blogpost by the inimitable develephant about Google licensing:

http://www.develephant.net/using-google-licensing-to-protect-your-corona-sdk-app/

thanks - unfortunately doesn’t address my question as I already understand how to do Google Play, just don’t know how to do GooglePlay/Amazon together…

You should use store.target to get what store the app was built for.

http://docs.coronalabs.com/api/library/store/target.html

While you can’t identify all the possible app stores on the device, you would be able to tell where your version of the app came from (or at least was built for).

As for the licensing check, you should do that for the Google Play store only.  Amazon has their own DRM licensing that they attach to your app (unless you select to not let them do it).

Does that answer all your questions?

thanks thegdog - hadn’t come across this call - so assuming (and I have to do more digging) Amazon works a bit like IOS in terms of not needing specific code for authentication checks, then my new pseudo-code could look like this:

-- Assuming your app is in: Apple, Google Play and Amazon stores then if not device.isSimulator and store.target == "google" then   -- do Google Play license check end -- no need to do anything specifically in main.lua for amazon or IOS 

Do I have this correct?

That is my understanding, greg886.

many thanks

Can’t answer any if these, but here’s a blogpost by the inimitable develephant about Google licensing:

http://www.develephant.net/using-google-licensing-to-protect-your-corona-sdk-app/

thanks - unfortunately doesn’t address my question as I already understand how to do Google Play, just don’t know how to do GooglePlay/Amazon together…

You should use store.target to get what store the app was built for.

http://docs.coronalabs.com/api/library/store/target.html

While you can’t identify all the possible app stores on the device, you would be able to tell where your version of the app came from (or at least was built for).

As for the licensing check, you should do that for the Google Play store only.  Amazon has their own DRM licensing that they attach to your app (unless you select to not let them do it).

Does that answer all your questions?

thanks thegdog - hadn’t come across this call - so assuming (and I have to do more digging) Amazon works a bit like IOS in terms of not needing specific code for authentication checks, then my new pseudo-code could look like this:

-- Assuming your app is in: Apple, Google Play and Amazon stores then if not device.isSimulator and store.target == "google" then   -- do Google Play license check end -- no need to do anything specifically in main.lua for amazon or IOS 

Do I have this correct?

That is my understanding, greg886.

many thanks