Android Question How to Use Google's 'LICENSE KEY' (Base64-encoded RSA Public Key)?

TheWind777

Active Member
Licensed User
Longtime User
From the Developer's Dashboard, when you click on Services & APIs, it has a License Key there.

Does anybody know how I use that key to, "... prevent unauthorized distribution of my app"?

I have looked up RSA on this forum and can't find anything about how this key might protect my App from being stolen?

They say, "Your application stores the public key in its compiled .apk file and uses it to verify the licensing status response."

How and where do I put that key? Is that already what I did when I went to Tools->Private Sign Key and created the KeyStore so I could put the App in the Google Play Store in the first place?

Might they just be showing me the code which was generated when I created the KeyStore that, "I must never lose"? The one which 'signs' each App on the Google Play Store? (Probably not what they call it).

Can that be used to ensure that the .apk file (which is easy to find if you are rooted) of your project isn't just transferred to another person's phone and installed?
 

TheWind777

Active Member
Licensed User
Longtime User
Thanks... That's what I was looking for.


Completely off-topic... but quick question.

I just upgraded to Android 5.0.0 and wiped the data. Thus it is now taking most of the processor power installing; which is all normal natural stuff that happens.

However, because of the enormous downloading of gigantic amounts of Apps from WiFi backup, it's bogging down the system.

If I run my App while such a load on the operating system is occurring it ends up taking forever Building the Queue.

Is there a way to monitor the total percent of Android use? so I can bring up a warning or stop the App from doing heavy-duty things whenever the overall Android load is too heavy? (Building the Queue just takes too long and initiates WAIT states; so I need to not update the queue until Android's total load has reached a reasonable level).

I don't know what 'Overall Android Load' is called, either. Is there a name for it? On a PC it would be called "Calculate CPU Utilization".

They talk of a file called proc/stat

http://www.linuxhowtos.org/System/procstat.htm

Is there any Library that you know of that accesses the data and makes it available?

In theory I should be able to read the file if I just back up one folder; but it isn't working.

Should look something like this?

Is there some android.permission I need to set? Would the user need to be Rooted?

B4X:
Sub The_CPU_Utilization(BlankString As String) As Int
   Dim ReturnValue As Int
   Dim TheText As String
   Dim StatName As String

   ReturnValue = 0

   StatName = "//proc/stat"

   If File.ExternalReadable Then
      If File.Exists(File.DirRootExternal,StatName) Then
         Log("Get_CPU_Usage() - " & StatName & " EXISTS")
         ' TheText = File.ReadString(File.DirRootExternal,StatName)
      Else
         Log("Get_CPU_Usage() - " & StatName & " DOES NOT EXIST")
      End If
   Else
        Log("Get_CPU_Usage() - External is Not Readable")
   End If

   ' Parse TheText Here and set ReturnValue = CPU Utilization

   Return ReturnValue
End Sub

I have verified with a directory App that the proc folder is there, and it is in android's root right next to the sys, system, storage and sdcard folders.
 
Last edited:
Upvote 0

TheWind777

Active Member
Licensed User
Longtime User
I'm not familiar with such value in Android.
But... if you were trying to load a text file, and it was in a folder that is in the root of the android, and that folder was called proc, and the text file was called stat, is that the procedure I would use to load it?

I've tried loading any other file (in the root itself, etc.) and it still says it can't find the file as if the path is wrong. All my phones and tablets are rooted - so even if that was the problem you would think it would find it.

So, if the file is in a folder called proc that is in the root of the Android and the filename is called stat, shouldn't "//proc/stat" offset from "File.DirRootExternal" to point to the file, in theory?

I have verified that the stat file is in the proc folder using Root Browser. Permissions on the file are r--r--r--, when I load it into a Text browser or HTML browser it contains the information (cpu 1975503... etc.). Is there something I'm missing?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

TheWind777

Active Member
Licensed User
Longtime User
Yeah, but if I set root permissions and their phone wasn't rooted, then the App would break, correct? it would need to go through BusyBox or SuperSU wouldn't it? I don't want to force only those who are rooted to use the App. Hmmm.
 
Upvote 0

TheWind777

Active Member
Licensed User
Longtime User
One other thing that you probably would never be able to see unless I flag you directly...

I just submitted a post in the Questions which is called, "Amazon Marketplace - "Your app appears to be a ringtone."

It appears that, when you submit your App to Amazon and you are using the Phone library... just because it has the SetRingerMode and GetRingerMode API Calls in it (even if you don't use those calls)... it keeps your apps from being able to be added to Amazon without it saying your App isn't compatible with any Fire product.

Down at the bottom is a question I have about a potential modification that might be done to the Phone library to make it be compatible with the Amazon Marketplace (only a supposition to be tested... but I think it might work).

As it stands, if you use the Phone library, you can't submit your App to Amazon.

If an if/then couldn't be done inside the library during compilation time - maybe a second Phone Library called Amazon Phone Library, could be made which doesn't contain those two functions.

http://www.b4x.com/android/forum/threads/new-amazon-fire.42190/#post-254700

Indicates the answer to the problem... but could this be implemented by adding a Boolean "Amazon" flag to the Phone Library, so if it were set = True (default being False), it wouldn't load that module?

Make a copy of Phone.xml / jar and call if Phone2. Open Phone2.jar with 7zip and delete RingtoneManagerWrapper classes (two files).

Reference Phone2 instead of Phone.

(With other little problems that had to be resolved because there were then two libraries with two references).

In the meantime, I'll try that.
 
Last edited:
Upvote 0
Top