B4A Library Licensing library

This library allows you to use the market services to protect your application.
See the tutorial for more information: http://www.b4x.com/forum/basic4andr...ur-android-application-licensing-library.html
The documentation is available here: Basic4android - Licensing

Installation instructions:
- Unzip the attached file and copy Licensing.jar and Licensing.xml to the internal libraries folder (default): C:\Program Files\Anywhere Software\Basic4android\Libraries

V1.21 - Adds protection from NullPointerException error reported.
V1.20 - Fixes an issue related to Android 5.
 

Attachments

  • Licensing.zip
    34.3 KB · Views: 865
Last edited:

Troberg

Well-Known Member
Licensed User
Longtime User
And you even could take the time to register the unpaid users by catching their Google's account and store them into your database

Which might be illegal. At least here in Sweden, it's illegal (with exceptions mainly for government organizations) to store digitally personal information without their consent.

For some reason, however, it's perfectly OK to write it down on a piece of paper (another odd effect of this law is that, legally, a fax send from a computer is under completely different laws than a fax sent by a "paper scan fax")...
 

lemonisdead

Well-Known Member
Licensed User
Longtime User
what if other user has put a paid user's email and start using my app?
This one won't be catched. But how many users do share their Google's account ?
 

Troberg

Well-Known Member
Licensed User
Longtime User
i was working full time.

Well, then I say: Make it reasonably hard. You don't need to make a Fort Knox security, just hard enough for the typical user to don't bother. Also, remember, the people who rather spend a weekend hacking your app than paying a few $, do you think they would have bought it if they couldn't hack it?

So, your work protecting your app may very well be useless, from an economical viewpoint. You'll just block those who won't pay anyway. Consider cost/benefit.
 

lemonisdead

Well-Known Member
Licensed User
Longtime User
Which might be illegal
I never care about what is legal or not if it is a way for me to protect my customers ! Storing an email address is subject (in France) of a "users database declaration" only. And if you want to be really fair : update your privacy policies or add an option for the user to share his taste via email (so nobody will never ask you why you are catching Google's account). But that's only a suggestion of course. You are free to do what you want
kiss.gif
 

Troberg

Well-Known Member
Licensed User
Longtime User
I never care about what is legal or not if it is a way for me to protect my customers ! Storing an email address is subject (in France) of a "users database declaration" only. And if you want to be really fair : update your privacy policies or add an option for the user to share his taste via email (so nobody will never ask you why you are catching Google's account). But that's only a suggestion of course. You are free to do what you want
kiss.gif

Of course, it was just a small reminder to check local law, to avoid trouble.
 

RichyK68

Active Member
Licensed User
Longtime User
I've just updated my LG G2 to Lollipop and two of my own apps have stopped working, they fail on the license check. I've updated the Licensing library to version 1.20 and recompiled but still no luck. Any ideas what else I can try?

Richard
 

MarcTG

Active Member
Licensed User
Longtime User
I've just updated my LG G2 to Lollipop and two of my own apps have stopped working, they fail on the license check. I've updated the Licensing library to version 1.20 and recompiled but still no luck. Any ideas what else I can try?

Richard

You don't need a licensing library anymore, just set your minimum API to 16+

You will be protected on API 16+ automatically. It doesn't matter which devices you target.
 

RichyK68

Active Member
Licensed User
Longtime User
So I can simply remove the license checking stuff from my app? As long as I target 16+ from now on?
 

RichyK68

Active Member
Licensed User
Longtime User
Sorry, is this what I need to change in the manifest? Is this the correct setting?

AddManifestText(
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="16"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.READ_SMS"/>
<uses-permission android:name="android.permission.RECIEVE_SMS"/>
)
 

MarcTG

Active Member
Licensed User
Longtime User
Sorry, is this what I need to change in the manifest? Is this the correct setting?

AddManifestText(
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="16"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.READ_SMS"/>
<uses-permission android:name="android.permission.RECIEVE_SMS"/>
)

No your minimum SDK should be 16
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="20"/>

Here's the google document concerning this:
https://support.google.com/googleplay/android-developer/answer/186113?hl=en

Please note that starting with JellyBean release of Android OS, all apps, paid as well as free, are encrypted by default, and therefore, do not require any additional protection against unauthorized copying such as Google Licensing Server. If you only develop for devices running JellyBean, you don't need Google Licensing Server. You can learn more about app encryption in the Developer Guide.
 

frapel

Active Member
Licensed User
Longtime User
Hello Erel,
first of all thanx a lot for this lib and your tireless work/support.

I would ask you a little modification to the lib: I think the generated Java object derived from the b4a LicenseChecker object (I mean the one present in the Java source code folder resulting from compilation) should be named to something "more obscure" like LC or even a misleading name like LHelper or similar...

...this way the Java code could be more secure even if decompiled, while now the name LicenseChecker is easily findable and recognized in relation to a paid app license control (even if we use obfuscation its name remains in plain text).

regards
Francesco
 

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi

Does this library can use in B4J ? :(
 

tsteward

Well-Known Member
Licensed User
Longtime User
Ok so if we no longer need the license library how do we check things like annual subscriptions please?
 
Top