Android Code Snippet System Information

mark35at

Well-Known Member
Licensed User
I have put together a collection of code pieces into a simple app to read the system information.

Most of the code comes from the forums and important snippets are credited in the code itself.

I have spent a lot of time with this and have learned a lot. Thanks to NJDude and DonManfred for extra help.

If anything here can help you, then feel free to use.

B4A 3.80
Libraries: ABWifi 1.20, Animation 1.02, Core 3.80, Network 1.25, OSLibrary 1.40, Phone 2.25, ScrollView2D 1.03

Tags: System, Information, Wifi, Battery, DPI, Map, List
 

Attachments

masterleous

Member
Licensed User
downloaded your source code and run on my device and got got following error while start up. i tried 2-3 times but got same result
B4X:
Error occurred on line: 31 (s1)
java.lang.ArrayIndexOutOfBoundsException     at mr.apps.sysinfo3.s1._pe_batterychanged(s1.java:133)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:636)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:302)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:238)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:121)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:159)
    at anywheresoftware.b4a.phone.PhoneEvents$ActionHandler$1.run(PhoneEvents.java:321)
    at android.os.Handler.handleCallback(Handler.java:587)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:130)
    at android.app.ActivityThread.main(ActivityThread.java:3687)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
    at dalvik.system.NativeStart.main(Native Method)
 

mark35at

Well-Known Member
Licensed User
try running the rapid debugger and put a breakpoint in line 30 in sub S1. When stopped, check the values in variable props.

Works fine with me on Android 2.2, 2.3 and 4.2.2
 

Rusty

Well-Known Member
Licensed User
You might want to check the code on line 268. I may be reading it incorrectly, but:
B4X:
If MyLan.GetMyIP = "127.0.0.1" Then
    r = False
Else
    r = True
End If
instead of:
If MyLan.GetMyIP = "127.0.0.1" Then r = True
Let me know if this isn't correct.
Also, I removed the "If r=True Then 'Only continue if wifi is connected" so I could see any wifi SSID's that are out there if the WiFi radio is on, but NOT connected to an SSID.
Great utility.
Rusty
 

khosrwb

Active Member
Licensed User
Update: Included Android Version (code from DKCERT) and sensor information (code from Johan Schoeman)

Still got an error but cannot find the cause.
hi
when I run your code I get to this error::(

B4X:
Compiling generated Java code.  Error
B4A line: 290
SysList3.AddTwoLines(\
javac 1.8.0_102
src\mr\apps\sysinfo3\main.java:633: error: cannot find symbol
mostCurrent._syslist3.AddTwoLines("Display logical density (DPI)",BA.NumberToString(mostCurrent._sys.densityDpi()));
  ^
  symbol:  method densityDpi()
  location: variable _sys of type OSLibrary
 

mark35at

Well-Known Member
Licensed User
Have you added the OSLibrary in the Libraries Tab? Mine is version 1.40. Otherwise I cannot duplicate this error.
 

mark35at

Well-Known Member
Licensed User
I am using this code in B4A 3.80 and 5.02, both without problems. However only in normal Release mode.

I can see no logical reason why line 290 should not work. SOrry I cannot help further.

Aside from all that, the code is from early 2015. Things have changed since then and there may be better ways to read data.
 
Top