Is it possible to use javascript in app?

hi

I thought of using javascript in the webviewer to run a script that gives a timestamp when given a date and time is this possible?
Doesn’t this violate play store rules as I understand?

1 Like

I have lots of demo project that do just that.

https://x.thunkable.com/projectPage/62065661baff3d00106f9ffb

1 Like

hi

after looking at your project if I understand correctly we have to go through an api?

I try to use this one

[https://showcase.api.linx.twenty57.net/UnixTime/tounix?date=2019/02/11 13:38:00](https://showcase.api.linx.twenty57.net/UnixTime/tounix?date=2019/02/11 13:38:00)

but I get an error message in thunkable on my device with this blocks

update regarding the use of api i made simpler

the api is good but if javascript is authorized I would look for a tutorial that explains how to pass a value to a script in the webviewer

The Web Viewer URL is what links to the javascript file.

hi

what is not clear to me at first can you put on the Playstore an application that contains javascript?

(the muner example uses an api)

Why would you not be allowed to do that? Isn’t code just code? Why would it matter what language it’s in? Is there a specific playstore policy that you’re reading and concerned about?

i read that (I have trouble understanding my translator)

The way I understand that is if your app uses Javascript, you still have to follow all play store policies.

Of course you may run JavaScript in your app, after all, that’s what’s running under the hood in all reality. React native uses jsx and JavaScript under the hood to power the app built by Thunkable.

1 Like

well here I am reassured it certainly faster than an api for what I want to do
but for the moment I continue with the api

thanks

well here I am reassured it certainly faster than an api for what I want to do
but for the moment I continue with the api

update

the api returns the timestamp as text I add zero to transform it into numeric and it does not work

2 Likes

I explain all about how to get dates using JavaScript in this post

1 Like

hi

Opérations de date (pas d’API)

hello

I wanted to experience what I read in this evocative post

Date operations (No API)

given what I want to do
I may be wrong but with this method we even “exit” the application to retrieve the script that interprets the post message and receives message blocks
what is the advantage?

1 Like

No. You are running the script in a web viewer which is being controlled by the app itself. You are running a script by using an internal controlled access to the web that is why you cannot run something like Google Login Page because it requires access to the actual browser and does not allow the code to run from a window inside the app.

Hope it is clear now.

1 Like

in fact I confuse the script and the library

1 Like

hi
with the elements that I found in different of your posts, I finally get a timestamp from a date
but I have a very small problem the timestamp obtained corresponds to my local time plus 2 hours how to correct this?
i tried this but it does not work : var ego = (new Date(message).getTime()-7200000) / 1000 ;

1 Like

getTime() will return GMT time. You need to use .toTimeString() or .toLocaleTimeString() to get the time in the user’s local time zone.

[Update]
https://x.thunkable.com/projectPage/621c9b6c73ba2500119d10ef

This project will help you test the different scripts because you can issue JavaScript code and get the response directly.

hi

thanks for your support
I explained myself badly, no doubt, what I want to correct is the timestamp which is two hours ahead

Check out this convoluted project that shows you how to do exactly what you’re asking