简体   繁体   中英

cordova detect if app was downloaded from Google Play

I'm making a Cordova 4.0 Android app that will be sold in Google Play, and I would like to prevent illegal use of it (for example preventing someone to extract the APK from the system and re-distributing it).

One theoretical way of doing this would be by checking that when the app is launched by the user, he did actually download it from Google Play (versus being it sideloaded). I'm not even sure if this is possible or if there's an alternate way of doing something like this.

One way that works in other cases is to use require some sort of login when accessing the app, but in this case I can't do that. Any advice would be appreciated!

Google offers a way to implement validation / licensing: http://developer.android.com/google/play/licensing/index.html

Take a look if this is what you need!

One suggestion would be for those apps which are get connected to a server to fetch some data.

App verification token

  • Generate an encoded 64-bit long token and store on both device & server as well. This will be a unique token per app
  • Whenever app tries to connect to server, it sends the device token details. Server needs to verify it before fulfilling its request.
  • On specific events, server can generate a new token for a device.

Same way, device token can be mapped to a user or an app on the server side.

Token could carry some app related information, for instance .

  • first 4 or 6 digits represent app size
  • second block of digits could represent user specific or device or some other details
  • Or another block could hold app contents modification date

In case of any change, server could verify the app size, last app contents modification dates, etc.

Generally it is recommended to uglify, obfuscate and minimize app resources before submission.

You can use the package manager class to determine the source of an app (only google or amazon currently detected)

You can similarly use google analytics which gives same information.

This is pretty neat since Android stores the source of every package, allowing apps to know where they came from, to prevent piracy and sideloading.

Great if you always publish to google or amazon. Useless if you sideload your app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM