Android Tutorial Protect your Android application with the Licensing library

Troberg

Well-Known Member
Licensed User
Longtime User
Two questions:

1. I can't find my public key. I'm on the web page with the test bench, but there is no key. Where is it?!?!

2. This thread is kind of long and messy, and, apparently, Google has a new method now. Is there thread that's more up to date? Some kind of summation of the current status?
 
Last edited:

Troberg

Well-Known Member
Licensed User
Longtime User
Thanks, found it. I was reading some earlier post, and was looking in the user account page. I didn't realize that they've moved it to a per app-basis.

Do I even need the key with the new method?
 

slugger

Member
Licensed User
Longtime User
Hi,

I am having a problem using this library.

My code is similar to the example given in the first page, the variable that is used in the SetVariableAndValue method has an underscore in it (it is called pub_extract).

If I declare the variables in the Process_Globals part of the main code everything runs fine.

If I move everything in the service module, declaring the variables in the Process_Globals part of the service, I get the following error:

B4X:
unexpected error.
java.lang.RuntimeException: java.lang.NoSuchFieldException: _pub_extract

Has anyone else experienced the same behavior?

Is the licensing library not to be used in services?
 

LucaMs

Expert
Licensed User
Longtime User
page which shows your publisher public key. This page also includes the "test console".

Sorry, I'm a newbie

I'm on a page that contains a "license key for this application"; I fear you was talking about a "publisher key", then a "personal" key, I suppose.
Also, in this page I cannot see the "test console".

I'm lost in Google pages!!!
 

incendio

Well-Known Member
Licensed User
Longtime User
I have this on manifest file : <uses-sdk android:minSdkVersion="4" />

Is this licensing library still works with sdk ver 4?
 

Eumel

Active Member
Licensed User
Longtime User
Look at the developer console left side.
There is a point where you put your developer name, adress and so on ..
In german it calls "Einstellungen".

There is a part "Lizenztest". Here you can put gmail adresses as testaccounts (max. 400)

-----------
Eumel
 

incendio

Well-Known Member
Licensed User
Longtime User
Found it!

Set test gmail account, but still got response Don't allow.
 

incendio

Well-Known Member
Licensed User
Longtime User
Update :
My Device has a firewall app that blocked the test license app.

After firewall disable, got error : NOT_MARKED_MANAGED, what does it means?

On developer console under License Test Response, tried RESPOND_NORMALLY & LICENSED, always return with error/ sub lc_Error called.
 
Last edited:

incendio

Well-Known Member
Licensed User
Longtime User
From my experience the only reliable way to test it is by publishing the app and then optionally unpublish it.
So, by publishing it, I can test it if licensing is works or not.

This licensing server, is it effective right away after apk uploaded or should wait for some time?
 

Peter Simpson

Expert
Licensed User
Longtime User
The perfect tutorial as usual @Erel, thank you

As you mentioned on another post, developers can (should) replace GetDeviceId with GetSettings("android_id") because GetDeviceId does not return an ID on WiFi only device.

Replace this
B4X:
Dim p As PhoneId
lc.Initialize("lc", p.GetDeviceId, publicKey, "kljdflkf".GetBytes("UTF8"))
with this
B4X:
Dim Pho As Phone
lc.Initialize("lc", Pho.GetSettings("android_id"), publicKey, "kljdflkf".GetBytes("UTF8"))
 
Last edited:

incendio

Well-Known Member
Licensed User
Longtime User
I have published app, but still got error NOT_MARKET_MANAGED.

The app already published before doing a test license. I just took its license key and put it in the sample code from the first post, but it always return an error.

Did i miss something here?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…