Shimfish
Shimfish

Reputation: 63

Detect added libraries to pirated Android app?

It appears from my crash reports that some people pirate my app and add advertisements to monetise it.

The stack trace from the crash report seems to show a bunch of calls to a library to show interstitials?

Is it possible for me to add code to detect the presence of the com.test.ylh or com.qq.e library?

android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@da2c866 is not valid; is your activity running?
  at android.view.ViewRootImpl.setView(ViewRootImpl.java:1126)
  at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:439)
  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:95)
  at android.app.Dialog.show(Dialog.java:473)
  at com.qq.e.comm.plugin.intersitial2.e.a(A:315)
  at com.qq.e.comm.plugin.intersitial2.e.show(A:113)
  at com.qq.e.comm.plugin.intersitial2.e.show(A:107)
  at com.qq.e.comm.plugin.intersitial2.d.show(A:35)
  at com.qq.e.ads.interstitial2.UnifiedInterstitialAD.show(Unknown Source:4)
  at com.test.ylh.InterAd$2.run(InterAd.java:53)
  at android.app.Activity.runOnUiThread(Activity.java:6972)
  at com.test.ylh.InterAd.showAd(InterAd.java:50)
  at com.test.ylh.InterAd.onADReceive(InterAd.java:108)
  at com.qq.e.comm.plugin.intersitial2.a$1.run(A:169)
  at android.os.Handler.handleCallback(Handler.java:883)
  at android.os.Handler.dispatchMessage(Handler.java:100)
  at android.os.Looper.loop(Looper.java:237)
  at android.app.ActivityThread.main(ActivityThread.java:7860)
  at java.lang.reflect.Method.invoke(Method.java:-2)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)

Upvotes: 2

Views: 81

Answers (1)

Rutger
Rutger

Reputation: 134

You can check if a class exists with a method as described over here: How to check if class exists somewhere in package?

However, they could also remove that check when recompiling the app. So it won't be airtight. You can make it more difficult for the "pirates" by adding proper code obfuscation: https://developer.android.com/studio/build/shrink-code#obfuscate

Upvotes: 1

Related Questions