Cocos2d-x game anti-packaging solutions, cocos2d-x Solutions
What is the most feared for mobile games? It is estimated that it is packaging. The rampant packaging of the party has caused many good mobile phone games to be drowned. Therefore, game developers are also brave in this regard! Is there any good anti-packaging technique?
First, let's take a look at what is a package party?
Package the party is a profession, a glorious profession. They download the installation packages of others' games, decompile the packages, add their own advertisements, and re-package and upload the packages to various markets, to seek benefits.
Next, let's go to the question: how to prevent secondary packaging for Android games, that is, anti-package party
1. code obfuscation
Android itself can be obfuscated with code. code obfuscation is to convert class names, variable names, and method names into various abcd, making it more difficult to read the source code, this may be difficult for small hackers who have just joined the package party, and may block a small portion of the lazy package party. However, for a technical package party, it's not a problem!
2. Online Detection package name and version number
If your game requires a network environment, you can add a mechanism to the game to obtain the package name and version number of the game installation package. The package name and version number Android APIs provide interfaces.
Each time a game is opened, the package name and version number are obtained, and then the network is connected to which network is detected? For example, if you use umeng for statistics, you can use umeng's online parameters. In the online parameters, enter the package name and the latest version number of your game. Then, compare the online parameters with the actual package name and version number in the game. What should I do if they are inconsistent? Crash! The review of the game packaged by the package party fails.
However, in fact, some markets are not manually reviewed. Even games that crash upon opening may pass the review.
3. Local detection package name and version number
What should I do for games that do not require Internet connection? Well, in fact, non-online games do not make much sense to us (because we cannot put our own ads ).
In fact, the local detection is also the same. Get the version number and package name, and then write a version number and package name in the code before each game is packaged. when running the game, compare it.
I found that I was not able to handle the problem ~
Do you think the comparison package name and version number are invincible? The package party cannot do it, right?
In fact, the version number and package name are obtained from the Android end. You only need to write the package name and version number to your original package name and version number in the Android code, then you will be able to successfully cheat.
Therefore, we can try to write the code for getting the package name and version number as complicated as possible. For example, to create several classes, we use them to get the package name and version number. Creating many functions is the same function, but the name is different.
In the end, only one of them looks the most inconspicuous, provided that you still remember which one you are using
4. Encryption
All of the above methods have vulnerabilities and cannot prevent the package party. In addition, developers have limited capabilities and energy, so they do not have to spend so much time researching techniques to prevent secondary packaging and hacker attacks. Therefore, various mobile security protection companies are born in this way, and the market is available only when necessary. Their appearance can also solve the problems of the majority of Android app developers, which is simply a win-win situation! Currently, professional users still love encryption. They not only provide free versions of encryption, but also specialized encryption solutions for different industries and adopt customized encryption solutions, provides comprehensive protection services for the majority of Android Developers!