Create an app sharing to counting accesses

Hi, sorry… i tried to create app to counting accesses with 2 buttons and script on google sheets, but doesn’t work on mobile devices.
So i hope it is possible with app inventor.

I need 2 buttons:
Button Green = when clicked increase by 1 the total
Button Red = when clicked decrease by one the total
I need a label where will be displayed in real-time the result of the clicks. And i need this label/result is sharing with 4 smartphones that are playing with the same application.

If you need i can give you thenscript i used on giogle

Thank you so much

The trick will be the update to the “non-active” devices…

It would be helpful to see how you are scripting your google sheet.

Not sure if this is what you mean, but it can be simply done with cloudDB

cloudDBClicker.aia (2.8 KB)

If you still need the data in google sheets, that can be added.

2 Likes

thank You so much! it Works perfectly!!!

thumbsup2
Glad to hear it.

Can i ask you another thing?
At the same for result, can i share the switch element?
I don’t know how to share the change of position of the switch… I can only share the change of the label associate at the switch position :confused:

Sorry
Thanks

You probably want to know who changed the switch as well?

Add a textbox to enter a name for the user
Add a variable: Which Button
For each button click event in the valuetoStore
Create a list: Label1.Text, Textbox1.Text, Which Button (text value)

Create labels for user and switch position
In the data changed event, set the three labels with the contents of the list

I can’t share the switching of the switch (the switch doesn’t change its color between green-grey on every device in which is the application.
I only obtain the sharing on every device of the switch’ label

You will need blocks in the dataChanged event to change the position of the switch ? (Assuming you have sent information about the which state you want the switch to be in)

yes, i need to store and share to the others devices the state of the switch. I don't know how to send to cloudDB the Change information "When Switch.change" ...so the position of the switch doesn't change on the others devices as instead the label does

Something like this:

i don’t understand: all this code to show the variation of the switch position to the others devices that runs the same application?

It is not that much more thatn the original app i wrote for you, just allows for the switch setting and text as well, and by using a list to store the data means we only have one tag to worry about on each data change.

ok, sorry but it's hard to understand every step so i were worried. i try and i respond you

OK, perhaps you haven’t explained how the switch is used in your app. All I did was programmatically change the switch based upon a user pressing the +/- buttons. If the user has to “turn the app” on, I am not sure why this is needed or how you intend this to work?

Here is the aia project that i prepared with the switch (as shown in the blocks) perhaps this will help, you seem to have got very confused…

cloudDBClicker2.aia (4.1 KB)

the switch is used only to show the associated phrase.
when switch1 is turned on, red text is shown. When switch1 is turned off, black text is shown. I can share the right text and color, but I cannot share the on / off status. Yes,sorry i used App inventor a few times so i'm very very very confused

Are you looking for these blocks, to turn the switch on and off from inside?
switch off switch on

i don’t know how to use this in my code…where and how to store this value in CloudDb to obtain the sharing between users… can you help me?thank you so much

i’ve tried some different combinations and this picture is the last one tried, but i’ve failed, can you correct my code?
thanks :frowning: