B4A Library OS Library

Hello everyone,

I present you thé OS Lib. aka. the Operating System Library.:sign0025:
This 'giant' library has around 60+ commands.
Everything is explained in the library itself.

What does it cover:

- Memory size of directories
- Tons of hardware strings (e.g model, device, host, ...)
- A unique, very easy countdown timer with 2 events (easier than timer :sign0103:

B4X:
Dim OS As OperatingSystem
OS.Initialize("OS")
OS.CountDownTimer(1000)

Sub OS_ontick (ms as long)
       toastmessageshow(ms,false)
end sub

Sub OS_onfinish (OS As String)
   Msgbox(OS,"OS Library") 'get the secret message in here ;)
End Sub

- CPU information
- Running services, tasks, sending signals
- Rebooting (and wiping data)
- and a lot more!

Note that it is still in beta and errors may still occur. ( I haven't tested all functions yet.)
Please tell it here when, why, what, etc happened.
It is also possible that I didn't add a certain permission as I can't find them always.

I like feedback as it gives me more motivation. :D
(now go and make your own task killer :^))


Cheerz!
Tomas
 

Attachments

  • OSLibraryV13.zip
    18.3 KB · Views: 1,948
  • OSLibrary1.4.zip
    13.9 KB · Views: 3,887
Last edited:

Caravelle

Active Member
Licensed User
Longtime User
Hi

You say that one of the features of this library is that it is able to specify the

- Memory size of directories

I have read through the xml file, but as far as I can see it will only give statistics on memory usage and availability in the standard preset directories. It cannot be used to see how much space is left on a removeable card, which is what I need.

Am I right ?

Many thanks

Caravelle
 

rleiman

Well-Known Member
Licensed User
Longtime User
How do you install this library into B4A?

Hi,

How do you install this library into B4A?

Thanks.
 

rleiman

Well-Known Member
Licensed User
Longtime User
Hi klaus,

Thanks for the quick reply and help. :)

Same as for all other additional libraries.
- Downlod the zip file from the first post.
- Unzip it
- Copy the jar and xml files to the additional libraries folder.
- Check the library in the Lib Tab.

Best regards.
 

latcc

Banned
This looks very interesting. One question, in the first post you say:

Everything is explained in the library itself.

As there isn't a demo program (which would be so useful) does this mean explanations are in the xml file? Or am I misunderstanding?
 

rleiman

Well-Known Member
Licensed User
Longtime User
Hi,

If you install the library and type this in Sub Globals:

B4X:
Sub Globals
   Dim OS As OperatingSystem
   OS.Initialize("OS")
End Sub

And you start typing this in Sub Activity_Create:

B4X:
  OS.

the intelisense will show you all the methods, properties etc in the library so you can get an idea of what it can do. I think that is what the uploader may be talking about, but it would be helpful if there was a demo project on the usage of all the library.

This looks very interesting. One question, in the first post you say:

Everything is explained in the library itself.

As there isn't a demo program (which would be so useful) does this mean explanations are in the xml file? Or am I misunderstanding?
 

ribber

Member
Licensed User
Longtime User
Great libary!

Can I use the killProcess method to kill a another process (not OS.myPid) ? Or must the smartphone rooted for such an action?
 

Rusty

Well-Known Member
Licensed User
Longtime User
Great Library!
I get exactly (to the byte) the same value for Internal Memory size and External memory size...any ideas?
B4X:
Dim OS As OperatingSystem
   OS.Initialize("OS")
   Msgbox(OS.AvailableExternalMemorySize, "Available External Memory Size")
   Msgbox(OS.AvailableInternalMemorySize, "Available Internal Memory Size")
   Msgbox(OS.TotalExternalMemorySize, "Total External Memory")
   Msgbox(OS.TotalinternalMemorySize, "Total Internal Memory")
Bot Available Ext and Int are the same and Total Ext and Int are the same, Available and Total are different.
Also, is there a way to get the External Memory label or name and type (SD/USB)?
 

kanaida

Active Member
Licensed User
Longtime User
I managed to get a list of services and associated pid's, however I'm not sure how to get the useful info about the pid afterwards, such as memory, total cpu time, current cpu usage, virtual memory, battery usage by for that pid only- if possible, i know a little harder but IO usage would be nice as well.

I only know how to do this stuff from the linux command line, but it's a little cleaner and maybe performant doing it in code rather than running a command and parsing it's output.

Is the library V13 or V1.4 newer? think it's a missing dot, but it's bigger in size lol :D I'm using 1.4. So far it's exactly what i was looking for, thanks!
 

Piappo

Member
Licensed User
Longtime User
Hello XverhelstX you show me an example command with the os.batterylevel?
not work

thanks
 

rfresh

Well-Known Member
Licensed User
Longtime User
I'm also wondering if you can Lock the phone? (without having to root it).
 

marcomilazzo

Member
Licensed User
Longtime User
shutdown phone

hi

no problem to root the phone!
my phone is inside a box!
i have only the hardware button coming out this box
so i need to shutdown the phone directly if possible
whitout going trough the shutdown window
at the moment i call on external app (quick shut) and pressing twice the button i get the phone off

it would be nice to do it directly

my second problem is to see whether o not my application is running or freezed
if freezed i can the call an application to shutdown the phone

thank's for your help
anyway your library is incredible!!
so knowing if my app is frezzed or not and the the possibilty to shutdown the phone would resolve all my problems
ciao
marco
 
Top