2016년 12월 28일 수요일

How to send a message to whatsapp?


Hey guys, I'm trying to create a "share button" on my app that will send a message to whatsapp using activitystarter component, but I don't know how to do that.
I've seen some posts (from a long time ago) saying it's not possible with app inventor, that the only thing we can do is open whatsapp "homepage"

Is it right? I think may be in the last months someone came up with a solution or whatsapp changed the way it works.

To be clear: I don't want to send a message without the user intervention, I just want to open whatsapp like the sharing component does (I don't use this component because it give many options to the user, I want the option to share on Facebook and whatsapp only).
I saw this link but it didn't help: https://www.whatsapp.com/faq/pt_br/android/28000012

--
I saw this tip on your website so much time before I came here asking for help, but for some reason I stopped reading after "this is unfortunately not possible with App Inventor", now I read again and I see that this is so much easy to do haha.
Thank you so much Taifun, your contribution here at the forum and on your website has been very helpful for me and for many others.

-- 


How to show notifier and stop action during specific times


I am trying to find a way to make a button work only during specific times of the day and on certain day. For example I only want to allow users to proceed after 5pm daily or/and before 10am daily but only on thursday or friday. If this isn't the case I would like to show a notifier and ensure they can't proceed? Any help would be greatly appreciated.

--
see the documentation of the clock component and its methods here http://ai2.appinventor.mit.edu/reference/components/sensors.html#Clock
then try something and if you get stuck, post a screenshot of your relevant blocks

A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook   http://www.appinventor.org/book2 ... the links are at the bottom of the Web page.  The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro  and the aia files for the projects in the book are here:  http://www.appinventor.org/bookFiles  
How to do a lot of basic things with App Inventor are described here:  http://www.appinventor.org/content/howDoYou/eventHandling  .

Also do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of AppInventor, then try something and follow the
 Top 5 Tips: How to learn App Inventor

You will not find a tutorial, which does exactly what you are looking for. But doing the tutorials (not only reading a little bit) help you to understand, how things are working. This is important and this is the first step to do.


-- 
-- 

About fusion table


Hi may i know how do i control the fusion table from refreshing out the same data . Because at first i put this data in tiny db and put it as a form of fusion table . When i go to the table screen, it will just have another row which has the same data. Thank you

--
first send a SELECT statement to the table like this

SELECT * FROM <tableid> WHERE Date = <date you like to insert> AND Joint = 'joint you like to insert' AND ROM = <rom you like to insert> AND Result = <result you like to insert>

then get back the result of the query in the fusiontable control got result event, there are 2 possible results:
1. you get only the header row of the table back, which means, the row still does not exist, then send an INSERT statement to the table
2. you get the header row and a data row back, which means, the row already is there, then do nothing

-- 
Sorry because im a beginner for this . I dont quite understand what do you mean ):

-- 
And also all this data is not fixed , it may changes . I couldn't jus select the date = something right??

-- 
you should do it step by step
it seems to be, you are trying a lot of things in parallel and then you get lost easily
concentrate always on the next step, test that step and only if you got this working, then continue to the next step
see also 
in this case the first step is to find out, if the row you like to insert is already available in the table


SELECT * FROM <tableid> WHERE Date = <date you like to insert> AND Joint = 'joint you like to insert' AND ROM = <rom you like to insert> AND Result = <result you like to insert>


and if you get an error, then first see here 
there is also a chapter "I tried everything, what can I do now"...

If you checked for all the Frequent Made Errors and the error message doesn't tell you anything to fix this, open a new thread in the MIT AppInventor forum and add a screenshot of your SQL statement including the "Do it" result and a screenshot of your error message and I will try to help you. Thank you.       

let's first continue with this task and if you get this running, then let's take a look at the DELETE task


-- 

Fusion table


May i know how do i delete the rows from fusion table ?

--
use a DELETE statement

For DELETE statements the first step to be done is to get the ROWID of the row to be updated with a SELECT statement. The second step is to do the DELETE.


-- 
Sorry but i don't know how to start the select statement.

-- 
How do i get the ROWID of the row 

-- 
I do this but it got error . May i know what is the problem ??


Untitled3.png 표시 중

Untitled4.png 표시 중
-- 
check your SQL statement using Do it and read the error message, which gives you some hints about the issue...

you are currently selecting several columns from the table and in the fusiontable control got result event you assign the complete data row to the rowid variable... does this make sense? probably better to only assign the rowid instead, what do you think?

-- 
I'm sorry but I still don't understand and how to name that rowid for specific row which I want to delete . Like for example I want to delete 7 rows in one go when I pressed the delete button

--
which row do you like to delete?
you have to add a WHERE condition to be able to get the rowid of that row
and you do not have to add all columns in the select statement, just do it like this

SELECT ROWID FROM <tableid> WHERE name = 'Denise'

assuming there is the column name available and you like to delete the row, which has the name = 'Denise'


to delete several rows, you first have to get a list of rowids to be deleted using a SELECT sttement and then DELETE each row one by one
to delete all rows, just send a DELETE FROM <tableid> to the table

-- 
Sorry but it still doesnt work . It still show the error ):

 unnamed.jpg

IMG_4206.jpg 표시 중

--
a correct DELETE statement looks like this
DELETE FROM <tableid> WHERE ROWID = <rowid you like to delete>

-- 
but i still dont understand how to do . could you give me a example like from my fusion table ?? 

-- 
what does rowid exactly means ??

-- 
What about the select statement , how do i do it ?? Sorry but i really try it out many times. But still doesnt work

-- 

Need Help with List


What I am trying to do is to have two screens (screen1 and screen2). I am try to have an add item button on screen1 which leads me to screen2 and there is a textbox there to enter something. When I press the enter button on screen2, it will take me back to screen one and auto update the item to a list.

This is what i got so far but everytime screen1 initializes, it will add the last thing that i typed on screen2 onto the list. I just want it to add after i enter something from screen2 and not have it automatically add everytime screen refreshes. Can you guys help me? thanks

screen1.png 표시 중

--
What if you add it in before leaving Screen2 instead of adding it in Screen1.Initialize

-- 
Hi. Sorry i dont really understand. Im new to appinventor. How would i go abouts doing that?

--
instead of using 2 screens, what about using only one screen and vertical screen arrangements to simulate different screens?
just set them to visible = true/false as needed
doing this, you don't have to pass values between screens, which might be easier...

A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook   http://www.appinventor.org/book2 ... the links are at the bottom of the Web page.  The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro  and the aia files for the projects in the book are here:  http://www.appinventor.org/bookFiles  
How to do a lot of basic things with App Inventor are described here:  http://www.appinventor.org/content/howDoYou/eventHandling.

Also do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of AppInventor, then try something and follow the
 Top 5 Tips: How to learn App Inventor

You will not find a tutorial, which does exactly what you are looking for. But doing the tutorials (not only reading a little bit) help you to understand, how things are working. This is important and this is the first step to do.

-- 
I'm sorry, but if you don't understand that, you really need to do some basic tutorials first before you try more advanced things. Follow the links Taifun posted and keep practicing.

-- 
That is very helpful Taifun. Exactly what i wanted to do. Thank you

--


RuntimeError


Does anyone know why it happens ? and how can you solve?
Qualcuno sa perchè succede? e come si può risolvere?

Screenshot_2016-04-30-14-26-29.png 표시 중


--
I read ... but could you tell me how to fix it I do not understand them well ?

-- 
You can also compress your images using a utility such as tinypng.com

-- 


How Can I Add My Own Font (.ttf)?


How Can I Add My Own Font (.ttf)?

--
Not with MIT App Inventor. But you can with Thunkable.com, which is a platform based off MIT AppInventor.

--


Priority for fusion tables request


I don't know why, but my procedure to request fusion tables is always set as priority one in a block no matter what I put before.
In this example, i try to change the color and the text of the button that trigger the fusion tables request.
The request only should happen when the button changed, but in reality, the button change only when the request is finished.
Any idea why ?

--
Your delay procedures are probably the culprit.  Delay procedures are generally a very bad idea with AppInventor Programming  ...see this for an explanation of how things happen in AI  http://josmasflores.blogspot.com/2013/02/a-single-thread-of-execution-in-app.html  (the graphics are from AI Classic, however, the principle is the same for AI2).

Check out Lyn's explanation and Scotr's Wait or delay method fail  that uses a Clock.

This appears to be a timing issue.

-- 
Thanks for your explained Steve. I'm using delay because i send à lot of differents request to the same fusion table and when the results come back, it's à mess without it.
Maybe there is à better way to do it ?

--
the fusiontable works aysnchronously: first you send something and in the GotResult event you receive something

just use the following logic and use a global variable to find out, which action you have to take
send request 1
receive the result of request 1 in the GotResult event, then send request 2
receive the result of request 2 in the GotResult event, then send request 3
etc.

-- 

Trouble Shooting Deployment on tablets and phones


Recently we built an app.  We are having trouble to load it on different phones but it works on tablets.

Any suggestion to this.  Is it because of the app size (~11M)?  Where do we start?

--
so you were able to install the apk file of your app on the different devices successfully?

We are having trouble to load it 

what exactly does this mean? what happens exactly?

how does the Screen1.Initialize event look like? any screenshot?
how many screens do you use? how many images, videos, audio files?
did you reduce the image sizes according to Using Images with App Inventor
  
-- 
Thanks for the quick response.

I used the wrong terminology.  In fact, the app was installed successfully but it would not run on phones but works on tablets.  It has a message like "Unfortunately, the app has stopped" with no further explanation.

Wondering besides the image sizes, could it be the programming too?

--
to find out more about the Runtime Error, you can use Logcat

I normally use Eclipse and Logcat there, but if you have installed the App Inventor Software (see also http://appinventor.mit.edu/explore/ai2/setup-emulator.html), you already have everything you need to use logcat...

How to use Logcat

1. connect your device using USB with your computer
2. in File Manager go to the App Inventor directory, which is  C:\Program Files\App Inventor or similar
3. press Shift and right mouse click the subdirectory commands-for-Appinventor to get the context menu
4. select "open command window here" and you will get a command window of that subdirectory
a) enter adb logcat and the logcat will start running
b) start your app to elicit the error
c) copy the log (see below)

To copy your log, right click, click "select all" and enter to copy the complete log into the clipboard, then open Notepad and paste it using ctrl-v.

-- 

Problem updating session number and recording multiple session data


I have looked at the tutorials on the website, read AppInventor 2 by Wolber et al., read the TinyDB section of App Inventor 2: DataBases and Files, searched the web, but cannot find out how to do something that seems very simple: keep track of the number of times the app has been used (as a motivational device - as in, Congratulations!  "You have completed 17 sessions.  By the time you have completed 100 sessions, you can expect to be proficient."   I would also like the number of times the app has been used (Session) to be part of the tag to end up with a data structure like:


Which I will eventually use to plot graphs of progress.

I realize that there is a lot going on in my app, and wouldn't even hope for anyone to implement this in the complete app, but I wonder if someone could write or point me to a two screen app that would just have a text box plus button to enter the value with tag "Session x before" on the first screen and a text box plus button to enter the value with tag "Session x after" on the second screen/

PS.  I am using Windows 10, but since that was not an option, I put Windows 8, which is the closest.


--
store your sessionCounter as value in always the same tag
and btw. never use the open another screen block together with "Screen1", why? see here
The recommended method of switching screens in App Inventor

-- 
Wow!   I am both honored to have you reply since I have seen so much excellent work you have done and humbled by not really understanding how to take your advice.  If I store my sessionCounter as value  in always the same tag, how will I accumulate all the data from multiple sessions?   I could try to rewrite my  to use just one screen if you think this would be a good idea, but it will involve a very complex designer since the app has two videos, one of which is stepped through slowly as the user does a practice like repeating a phrase.

-- 
app
to do that, just use only one tag and store the session number as value
app
I did not understand that, what is the purpose of value here?
what is the difference between before and after?
can you elaborate?

without completely understanding your example, in another tag you could store a list with the history: the list index (1, 2, 3, etc) could be the session, the list item could be the value you like to store fore each index (session)


-- 
Thanks, but on further reflection, I realize that I really need a web-based database and that trying to work with TinyDB is just temporary at best.  So I do have some resources on web-based databases that I will attempt to learn from.

--
do the Pizza Party tutorial to learn how to work with fusiontables

and in case you like to store the data locally, you also can use the built in SQlite database, see also the SQlite extension https://www.puravidaapps.com/sqlite.php


-- 

Request for direction regarding data storage/structure


I'm looking to create an app to store scores etc I'm happy to work through lots of worked examples and in principle I like the App inventor but if anyone can share their thoughts on a best route to take, that would be much appreciated as I can then focus on this rather than trying to learn everything before making a start.

Imagine wanting to store scores from a ten pin bowling competition.
Its likely the device (most likely a phone) won't be online during the storing of the data as signals are unlikely inside the building and wifi is not always available.

You'd want to store ball by ball and frame by frame scores for an unlimited number of bowlers and then potentially be able to look back at stats after the event.

Ideally, be able to store games indefinitely and compare scores as time progresses.

Now TinyDB seems too simplistic for this to me from what I've read - but am I writing it off too easily. Does anyone have any details on more complex uses of TinyDB that I could look at to see how I might use this.

FusionTables sound more likely an answer, but do I need constant online access and can I easily distribute an app for users to use their own FusionTables (ideally without having to know anything about them) or do all users have to link back to my table. I believe that using O Auth the former can be achieved, but does it result in an app that a user simply asks to install in the play store and just has to give agreement to the various access rights or is there more involved.

Any thoughts welcome

BTW the actual planned app isn't for bowling but its a more useful analogy to ask the question


--
TinyDB can store not only simple text as values, but also lists and list of lists...
just take a look at how to work with lists of lists...

--
Many thanks - I generally follow the page you linked to - but without an example of storing data in 'lists of lists' I must admit I find it hard to see how you can replicate a larger scale database

For example how would you structure a two person game, with 3 rounds, ten frames in a round and up to 21 balls bowled for each person per round
In a very simple spreadsheet you could store it thus:



...... etc
Somehow I'm just not seeing how this would fit in a structured way in multi layered lists. I'm hoping it's straight forward and I'm just being thick, because this would definitely mitigate the lack of connectivity.
Although is there a finite list length and can you easily export the data into a csv or similar to archive it etc.


--

--
alternatively you can add another dimension for the player,
in the example I just use a list of lists for each player...

--
Wow that really helps, many thanks - I'll have a play and make sure I can populate and read back the data ok.
A perfect example, thanks again
--

Thanks grate job.

How can I create it from a csv file?

--
just use the list from csv table block to convert it into a list of lists

--
Thanks I will try.

--
this is bad? I cant stock here. (and is the beginning haha)
--
That won't work... You're getting a list back from the CSV conversion, so you have to set the Label1.Text to the first element of the list, not the whole list.
--
Hi thanks Enis for yours comments.

I visit your website, grate job.!!

I made this 
to read this (in csv format file)
and what it shows is this in the label (the hole data base)

((id;name;surname;pohne)(1;aaa;xxx;456)(2;eee;yyy;789)(3;iii;zzz;112))

so:

what I  want is to look from a particular id the hole row. How can i do that...

--
set global name to list from csv table get text
then use a for each in list loop and check the first item in each sublist for the id you are looking for
if you found it, then display the 2nd, 3rd and 4th item of the sublist as result

--
Thanks so much It works Grate!!!
I'm continue with the app !!! 
--

How does one make a 2-Dimensional Array?


A student of mine is trying to create a two dimensional array for an aspect of their class project. They need some way to use it similar to the list function, as well as in a tiny DB so that information is saved between uses. If this cannot be pulled off with these two, then what would be the best method to preform this? Information in this array needs to be capable of being removed, added, and changed.

--
a 2 dimensional array is a list of lists

-- 

Memory Game


I am trying to make a card game for my son. It will take letters and flip them when clicked. If successful, the cards will be removed, otherwise they will flip back. I also want it to say the actual letter (call the mp3) when it's successful. I have uploaded the images and programmed a canvas with imagesprites (only 6 but I plan to have more). I have found some great information on the web, but I'm really lost on how to get the imagesprites to be from a list of the images uploaded, as well as how they're removed when it's a match. I cannot find a memory game that is similar to this to see how that has been done. I'm also going to try to modify the asteroids game and add a bingo game to this, as well.

Attached is what I have, which I don't think is much.

Thanks for your help, ahead of time!

HL.jpg 표시 중

HL2.jpg 표시 중

--
Here's  a completed Concentration game from the Classic Gallery:

Download the .aia source and import it as a new project.

It works.

--
I appreciate the reply. However, this is what happens when I import it. I've never seen anything like this....is this correct? I can't test it right now because I'm at work.

Valentines.jpg 표시 중

-- 
these are collapsed blocks
select a block, then right mouse click and select expand to expand one of the blocks

-- 
Ah, now I see it! However, my only issue is that I will have the entire alphabet to choose from in the list and I need to have it select randomly (within a 6 or 9 card set at a time). This program assigns the image to the sprite. How can I get it to select it from a list, but use only one list at random? Would I need multiple lists, or put them all in one?

-- 
I took some time to read the blocks in the Valentine Match app.

There is a lot of duplication in the Sprite Touched events, which can be reduced using procedures and parameters.

You will need an extra list holding ALL your images, a list mapping images into sounds, and
code to load a working list mapping sprites to their intended images.

See this FAQ for a section on how to work with lists ...

--
I cleaned up the redundancy in the Valentine Match Game, to make it easier to adapt for your needs.
You will have to think about how to introduce new letters to the match board, probably as rewards for completing rounds.
-- 
Thank you so much! I haven't been able to get back to this until now. I was looking over your code and it is quite a learning experience :)

You did a list all pictures procedure. My thought, to have it do random order, is to have several lists from a csv row and then calling the random lists? I didn't realize such a small program would require so much code! Wow...

-- 
There's not that much more needed.
See attached.
That will let you expand your picture list indefinitely, but give you 6 pictures at the start of the game.
You may need to move (copy) that random selection call to the New Game button section too.
Don't worry about duplication of images during the selection.
The game will still work, and the player can regard it as a lucky bonus.
ABG

Screen1_Initialize.png 표시 중


-- 

Searching for string, warning and error in Blocks view


Often times once "code" grows to a certain size, a lot of my time was spent on looking for where the code is - navigating in block view becomes really slow. Using string search in the browser does not make the found text in blocks visible. For now, I download the .aia file, and unzip it and search in the corresponding .bky file, but it's a pain. By the time I found the string that I want, I may have already forgotten why I was looking for it in the first place. Error and warning become hard to find especially when you paste blocks from backpack. And it would have help if "Download blocks as Image" would work, but I think it only works up to a certain size.

I would think it should be easy to add a search feature each in Block view for searching string, error and warning. The block viewer should display the block where the string, error or warning is found. It should also be easy to propagate from one found block to the next. Is this suggestion something that you would want as well? Or, has I been doing it the wrong way and there is a straightforward way to search?

--
a search feature is on the list of MIT

the recommendation is to collapse your blocks and expand only those, you are currently working on

and the question is, why did your code grow so much...
it probably helps to look into how to avoid redundancy http://twodogapps.com/?page_id=686#Redundancy and how to use procedures http://twodogapps.com/?page_id=686#Procedures

A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook   http://www.appinventor.org/book2 ... the links are at the bottom of the Web page.  The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro  and the aia files for the projects in the book are here:  http://www.appinventor.org/bookFiles  
How to do a lot of basic things with App Inventor are described here:  http://www.appinventor.org/content/howDoYou/eventHandling  .

Also do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of AppInventor, then try something and follow the
 Top 5 Tips: How to learn App Inventor

You will not find a tutorial, which does exactly what you are looking for. But doing the tutorials (not only reading a little bit) help you to understand, how things are working. This is important and this is the first step to do.

-- 
Thanks, Taifun, it's good to hear that search feature is on the list.

I have been quite careful not to repeat my blocks as I would have been using any programming languages. However, it's inevitable that the number lines of code, or in this case the number of blocks, is proportional to the number of features one adds in. And, the fact that blocks generally take more space than lines of code and are slower than code to be moved around the viewer. So, I will collapse my blocks to avoid the problem - that makes perfect sense. I don't do it often because there is no quick keys to collapse and expand all, and one wrong click may lead to accidentally deleting blocks.

I had gone through quite some tutorials and they are helpful. Thanks for the pointers and your time to help.

-- 
Actually, I was wrong, it allows me to collapse and expand all blocks at once. My bad. I will definitely collapse them more often. Thanks again!

--