DateTools : Some tools to work with date and time

Hi, I am getting this error when I call getonlinedatetime on android 7 (Lenovo P2 stock rom).

The operation Duration cannot accept the arguments: , [“java.lang.NullPointerException: Attempt to invoke virtual method ‘int java.net.DatagramSocket.getSoTimeout()’ on a null object reference”], [1699597457636]

If I disable getonlinedatetime block, I am not getting the error.

net_URL: https://www.google.com/
I am just calling “check_network” procedure when screen1 initializes. (I have only one screen.)

blocks_

I have no error on Samsung s22’s android 13.
Min SDK Level of the project is android 5.0 (API21).
What can be the problem?

Show your blocks.

I added blocks to original post. thanks for your quick reply.

Test your app here and then posts the logs.

I tested on nexus 5 Android 7.1 which is more similar to lenovo p2. but it seems to work properly. Logs are here:
2023-11-11 14-38-12 debug log.txt (210.2 KB)

So issue might be device specific?
Make sure you are using latest version of extension.

I think, the problem may only occur with kodular companion on older android sdk’s.
But it is a old phone and it already has latest version which is android 7.0.
As I said before, online tester of kodular works properly on samsung s22 android 13
What could be causing the problem for that error? And can I take precautions against this error on blocks side?

I missed to write latest version of extension in my previous post.

However, I would need logs of your android 7 to check what’s going wrong.

How can I collect logs from my phone? Is there a tutorial for that?

Fortunately yes.

Logs are here:(only errors)
logcat_p2.txt (277.4 KB)
Thank you very much for your great interest.

edit: I am also adding full log:
logcat_p2_full.txt (779.7 KB)

Ok, I have found the issue.
Strange it appears only on few devices.

Hello, I’m trying to use this extension, but it’s not working. The extension has been added, but I can’t find the blocks. I have another question: can this extension take the timestamp automatically even if the user makes a mistake with the time?

Did you drag the extension to the working space? You might want to provide a screenshot…

To get a timestamp, just use the Now method from the Clock component

Taifun

1 Like

Get online datetime in this case.

This post was flagged by the community and is temporarily hidden.

thanks for reply
The extension only works if the phone is connected to the internet. Is there a method to obtain the exact date and time even if there is no internet connection, or at least detect if the user has set the automatic time zone setting?

Great work!

Are still welcome some suggestions for this extension? :pray:

Lito

@>–>—

You can say, but it won’t be immediately updated.

you can use my extension to achieve that…