2014년 12월 7일 일요일

BLUETOOTH

Hello! I'm form Mexico and I'm working with appinventor since 3 months ago, it's an easy tool for beginners, I'm not a beginner but i would like to know how can i receive a message from arduino bluetooth and save it in a label, the connection with bluetooth it's ok but i don't know how to receive this text and save in a label, i can sending text but i can't receiving. I hope someone can provide me this information



Search in the forum using the Search for topics box to the right of the colorful google at the top of this page  with the terms arduino   or  arduino bluetooth       or search the Web   for  app inventor arduino .    there are plenty of links.

When you are ready to code some blocks, post a screen capture of your relevant blocks and ask a specific question.  You will get help.

Also visit here frequently, someone might post something more specific.


How to integrate my own program into the AppInventor?

I plan to use camcorder to record a short video, then use my own video algorithm to deal with it to get a code. Is there a method to integrate my own video processing program into the AppInventor? Or can I create my own video processing block?



The only way you can do it is with the Activity Starter...



So I need develop another APP for video processing, and development of such APP cannot be done using AppInventor, right?



That's correct.


Free Hosting for your PHP scripts and MySQL DB

We find that AppInventor is pretty great for the front-end, but not so much for complex back-end algorithms. We use PHP scripts and a MySQL DB to implement our more complex backend algorithms. What we struggled most with was finding a place to host these files and data! We recently moved to using OpenShift from RedHat, which is free to use and relatively easy to setup. More details at our blog:



Nice, thank you guys!


Re: App crashes when installed on phone with apk after running fine in Emulator

"Emulation and Wifi testing in the current version is no guarantee that the code will run when the apk file is installed on the phone."

I too seem to have issues with apps running via companion and not after downloading. In my case (please keep in mind I am a neophyte working with app inventor) I took an app authored by a fellow Arduino enthusiast (with permission) and modified it to my needs. The purpose of the app is to control an Arduino controller via Bluetooth.The app was originally written using app inventor classic. I went back to classic and made the mods I needed and it ran fine via companion to my LG Lucid2. I downloaded both to my PC and directly to the phone and installed the app; it ran perfectly. Satisfied with my first project success, I felt I should do it with AppInventor 2 in the event classic was omitted. I edited in the block editor the same functions, and again they ran fine to the LG Lucid2 via the companion. But this time after downloading the the PC, (not seeing a way to download direct to the phone, the app crashed at a point where a Bluetooth selection was to be made from "listpicker".. Reiterating that when written with the block editor in AppInventor classic, and downloaded it works. I still have that version on the phone. The app also works using AI2 Companion to the phone. It however does not work when downloaded and installed on the phone.



It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.





Operation add lists cannot accept: Empty [...] Cant find the problem!

Hi guys, Im fairly new to app inventor 2 and we have to make a school diary app. Im currently making the 'Assignment' Page, but I've encountered a problem. Everytime I press Submit, I am faced with 
The operation add items to list cannot accept the arguments: Empty Religion
Note: You will not see another error reported for 5 seconds.
(Religion is the subject in this case)
I have asked my teacher and solved it, but I don't what I have done that the error appears again. Please help! Thanks!





most probably you did not initialize your list variable with the create empty list block

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.


Testing Tablet changes

as you know, we reverted some changes in the production server
yesterday (sad panda!).

We have some fixes for the issues we were seeing, and it would be
fantastic if you guys would help us out (once more!) with testing
this.

You can find the test server at:
http://ai-tablet1.appspot.com/

Unfortunately you will need a companion for this; you can find it here:
https://dl.dropboxusercontent.com/u/40369965/Companion_density_fail/MIT%20AI2%20Companion.apk

Warning: there is no build server.


What to test?
Anything that has to do with sizes of elements (set a picture size to
the size of the screen, for instance), and anything to do with sizes
in Pixels, which now should be DPs. To test the change to DPs it's
better to use an existing app, because if you start from scratch, you
won't see a difference.

Animation and drawing is a big part of this. Making sure you can
position sprites or balls programmatically (for instance, using the
size of the canvas), and that sprites can be dragged, flung, and they
collide with other sprites.

If you use values such as (Screen1.width / 2) or (Canvas1.width / 2),
things should appear in the middle of the screen/canvas in a phone and
in a tablet (as long as you subtract the size of the element if it's a
Sprite).

There are also some obscure methods in the canvas such as
GetPixelColor; those should be tested too (I have never used them
before, to be honest).

You can also test anything else that might be related and comes to mind!

Thanks a million to everyone for helping out and apologies for the
continuous back and forth of changes and versions!



unfortunately the new companion app overwrites the current live version of the companion app
would it be possible to provide the test companion app using another package name?
this would help us to use both companion apps in parallel
and this would make it much easier to compare old vs. new...



hat's a very sensible request, Taifun. I'll look into it.

I just pushed a new version with some changes; new companion at
https://dl.dropboxusercontent.com/u/40369965/Companion_density_fail/MIT%20AI2%20Companion.apk
(sorry, still same package name!)



How is the testing going for the new layout method for tablets? Is an update to the newer minSdk on the horizon to support larger screens?



You can test the current version at our test server,http://api4test.appinventor.mit.edu . I'm currently working on the code to permit lengths to be given in percentages of screen size as well as just dps. I hope to have that deployed on the test server soon.


(urgent help)

dear users of app inventor i am in urgent need of help.

i have spent hours on trying to do this as a solution but i just cant get my head round it.

i have done tons of tutorials, but i am afraid with app inventor i just dont get it. 

all i require is that the value be stored in the text box the next time i open up the app.
i have attaced two images for you to get an idea on what i am trying to do,.


so when the press button is punched the data will be stored in text box..

if anyone can help me on this basic issue i am having i will be extremely grateful!

thank you very much!



TinyDB is your friend.






On Windows  Ctr + PrtScn  keyboard keys pressed at same time copies an image of the screen to the Windows Clipboard.  Open Paint and save the image by putting the contents of the clipboard into Paint. Save the image to your desktop or another folder as a png or jpg file.  On Win 7 and above you can use the Snipping tool (in Accessories) to capture an image of blocks directly from the screen.  Capture what you need and Save the file as to a folder on your PC.

On a Mac,  command-shift-3 (whole-screen) or command-shift-4 (drag a rectangle) to take a screenshot. The image file will appear on your desktop. 

To post an image to the forum:  Once you copy an image and named it something like capturedimage.png and you have put it in a folder on your PC;  find the blue Insert Image control in the forum text area (the icon is next to and left of the Link).  Press the icon.  A small screen opens..drag the capturedimage.png to the new screen; wait a few seconds while Google's forum loads the image to the text area.  Now the image is in the forum's text box area, ready to post.

Please save the images as a jpg or png file.   Other formats are possible but create problems for some forum members in reading your images.



Thanks is there a quicker solution



The ONLY solution if you want the information to be persistent on the device is to use a TinyDB.


Can't see NXT via bluetooth connection?

I'm doing the NXT AI2 tutorial found here: http://www.appinventor.org/Chapter12

For some reason, my app can't see the NXT. I have the BT on on both devices, and the NXT is set to visible. When I look on BT on my Galaxy S3, it lists the NXT as a device that it sees, but it doesn't show up in the Listpicker (nothing does), which is strange.

I've triple-checked the blocks and I don't think there's an error there.

Am I missing something obvious?



Without a post of a block screen capture (png or jpg), forum members can not check your code; which, despite your diligence, still might have an error in it.

You might email the author of the book , it is possible there is an issue with the chapter instructions.

  AppInventor.org partners with but is a separate entity from MIT App Inventor



make sure, the device is paired

AddressesAndNames
The addresses and names of paired Bluetooth devices



Where is the BTconnectdevice thing?

Where is the BTconnectdevice thing? I could not find this.I need it to connect my phone.Just one sentence missed! Please!



I just want to know how exactly connect my phone to another Bluetooth device. I am using my computer to build that app online. But it failed connecting. I really need help , Please~~!



see an example here

A simple Bluetooth Chat with App Inventor 2



You could  search in the forum using the Search for topics box to the right of the colorful google at the top of this page  with terms like  bluetooth  or arduenio  or Lego NXT. This will lead you to forum discussions about connecting to Bluetooth devices, however, you will have to search the data.

The control itself that allows communication is described here:  http://ai2.appinventor.mit.edu/reference/components/connectivity.html      It is one of the Connectivity components.

Did that help?


Cambiar idioma MIT App Inventor 2 web (Change Language MIT App Inventor 2 web)

I am a beginner and started working with Inventor Mit 2 through the web and I can not change the language. Any idea why this option appears not me? Thank you



What is not changing?   Use the Globe MENU item to select the language...there are presently four choices.

My language is English, however when I switch to Espanol... I get:

If you started a Project in English, the names of the Controls and any variables you created will NOT change (see the blue arrow and the yellow highlight), however the MENU items and other labels will switch.   In this case to Spanish...see the red circles.

The language changes are NOT happening on your browser screen with Firefox?

Would you please tell us more about what you tried to do to change the programming language.  Thank you Diego.



The language menu, does not appear in Mit App Inventor 2 Version nb139a. Only Proyects, Connect, Build and Help. Use the browser Google Chrome. 



The “Language” menu is now a globe icon on the upper left hand side of the screen






Menu Language missing

The language menu, does not appear in MIT App Inventor 2 Version nb139a. Only Projects, connect, build, and Help. I use the browser Chrome




The language icon is here:


The MENU word Languages was changed to a small World symbol.  Currently Spanish, English, Simplified Chinese and Traditional Chinese are available.  There is an ongoing project to add more languages.  AI2 is opensource, the Development Team has a small team of developers and the process of adding additional languages is complicated.  In the meanwhile, Google Translate helps many users.

Did you find the Language Icon?



The “Language” menu is now a globe icon on the upper left hand side of the screen




Than you


How to use two spinner


i want to make a program that use two spinner. First spinner is country list and second is year. and when user click the process button then the another screen will open. Please anybody help me how to build it. im new at app inventor.. thanks before

-- 

first do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of App Inventor, then try something and follow the

--

Languages?

I really like the App Inventor, but isn't it meant for educational purposes? 

A friend of mine has a 10 yo son and I recommended App Inventor, because it's easy to learn and interact with a smartphone's hardware. But there is a problem: The 10 yo does not speak English! He is a German and not yet old enough to have had English lessons in school. It would be easy to translate the few words in App Inventor to many other languages, possibly using the cloud. I do not understand why App Inventor is ONLY available in English and Chinese! 

Please make App Inventor accessible for children who do not (yet) speak English!



App Inventor is also available in Spanish.   There are efforts to make it work in other languages.  AI2 is open source, free and developed by MIT's small staff and some volunteers.    I am forwarding your post to an MIT person who is coordinating an effort to make AI2 available in more languages.  The effort does need translators and you might want to participate.



see this thread https://groups.google.com/d/msg/app-inventor-open-source-dev/hkOrVUGWKBc/PSmC7ENq_bIJ and if you want to help with the translation, contact Hossein for details


image sprites look bad

When using canvas with image sprites, background image of the canvas looks fine, but the image sprites (which I change these sizes with imagesprite.width or height) looks not clear like original (alot bad) on the phone.

I tried with gif format. Should I try another like png, jpg or is it because of the size changed?



png has transparency, and that might look better.  If you're resizing things, make sure the RATIO (horizontal vs vertical) doesn't change.  Otherwise, the image will distort.



see also App Inventor and the Screen Size


Need Help Calculating Distance btw 2 Locations

I really need help or pointers , been stuck on this part for a while.

 I am trying  to  calculate the distance between my current location and  addresses in a list-
 and compare them to see which address is the closest -
then show my current location and which the address that is the closest



I have deleted your other post.  Please DO NOT DOUBLE POST ON THIS FORUM... WE see the posts, and if someone can answer you, they will.  Double posting is just a waste of space and time...

I'm sure someone will respond to your request as soon as possible.  Until then, please wait patiently.



A rough calculation is possible using the algorithm here  http://www.appinventor.org/Chapter21   .  This algorithm is not very accurate but is simple to use.   What it does is attempt to calculate the straight-line distance between two points.  A better algorithm is known as the Haversine algorithm.  If you search the Internet, you will see the mathematics that is required.   You will have to convert the equations to AI2 Math blocks.

Calculations of distance using shortest distance by road/highway can be made by using the Google Map API.  Read about the Google Distance Matrix here:   https://developers.google.com/maps/documentation/distancematrix/      How you use it with AI2 is complex but doable using JSON and the Web component.  There are restrictions on the use of this Google feature.   Use over certain limits requires payment to Google.   Additionally there are other requirements.


Use of the Distance Matrix API must relate to the display of information on a Google Map; for example, to determine origin-destination pairs that fall within a specific driving time from one another, before requesting and displaying those destinations on a map. Use of the service in an application that doesn't display a Google map is prohibited.

There are several MIT tutorials that touch on the subject of mapping using Google and using the LocationSensor...  have you done the tutorials?   They are here: http://appinventor.mit.edu/explore/ai2/tutorials3818.html?&page=2



in case you are using a fusiontable, you can sort easily using the ORDER BY clause, see also SQL Reference Documentation of the Fusion Tables API.

SELECT * FROM <tableid>
ORDER BY ST_DISTANCE(<location_column>, <coordinate>) 

to learn how to work with fusiontables, do the Pizza Party tutorial!


Canvas Help

When I change to height from Automatic to Fill parent on the Canvas in the Drawing and Animation section of the designer, it stays the same height as before. No changes. Anyone know how to fix it?



make sure the screen is NOT set to scrollable.


Server error

I'm getting  a server error when i try to save aia or apk to pc. Wondering it was my windows 8 or app inventor 2.



could be many things... try again in a few minutes, then report back...



One of the following  possibly applies to your code (all may not apply to your code):
Most probably #1 or 2.

1)  You have coding errors in your blocks.  In the Blocks editor, look in the lower 
left corner of the window for the yellow and red triangle icons. If the red icon has a value larger than 0, 
you have a serious coding error.  Find the block in your code that has a red triangle and 
fix it.   Red triangles always inhibit creating an apk or running a project in the 
emulator or possibly creating an aia file.     Yellow triangles are more forgiving, 
however, sometimes, these need to be fixed because they trip an internal warning and not billing puzzle piece sockets are left un-filled.

2) Your source file (the aia file) is larger than the 5Mb limit allowed in AI2 (the aia can not be larger than 5Mb). You may have put images or other resources in your Media (resources) that you do not use in the app. 
 All the images and sounds in resources count toward the 5Mb limit along with the source code.    You can program 
apps larger than 5Mb in the browser, but the apps will not compile and might not run in the 
emulator or the project may not save as an aia. If this is the case you need to reduce 
the size of your image and/or sound files.   Most image files can be made quite small 
by resizing them using a photo manipulation program on your PC to less than 50Kb each.

3)  You might have more than 10 Screens in your app.  AI2 becomes unstable when more 
than ten screens are used.  Projects CAN be built with slightly more screen but then you should expect your app to occasionally behave erratically.

4) You might have set a Screen icon in the Designer Properties for your project that is too large. Use an image 
sizeof 48x48 px or 96x96px instead and only use jpg or png images.  *.ico files are not 
supported.  The 'icon' (actually an image) can be as large as 520x520 (I think that is the size GooglePlay apps require).  The smaller 'icons' work fine otherwise.

5) You did not code the entire project using App Inventor 2.   If you used one of the 
third-party AI2 clones,you might not be able to load a Project into the AI2 compiler or 
create an apk with the standard AI2.

6) If you incorrectly modified the project's Manifest files using a third-party tool, you may have issues.

7)  Sometimes, if you have LOTS of Layouts on a single screen,  the apk might not 
compile. How many is a lot?  I do not know, keep adding layouts and buttons, compile and try again...when the server crashes, you got a lot.

8)  The network you are using may be overloaded (possibly a school network), or you have other applications running in the background on your computer, or your virus checker is doing a scan.  Sometimes, just trying to access the MIT server a few minutes later will give you a more favorable response.

9)  If you have BlueStacks on your home PC (BlueStacks is a special emulator that allows Android apps to run on a PC).  The Google emulator on AI2 cannot run unless BlueStacks is disabled and all of the BlueStacks processes are shut down.  On a Windows PC, you use the Task Manager to 'kill' running processes.

10)  Are you using Sensor controls (except for the clock)?   Most Sensor controls or controls related to sms or the phone do not work in the emulators.  They need to be tested on a device.

11) If this is an issue about the Project loading slowly on your device or on the emulator:  Be aware, the more images, layouts, components you have on a screen, the longer it takes for the emulator and Companion to render the graphical screen.  How fast the emulator renders is partially a function of your hardware...how much ram you have, your cpu clock speed etc. Sometimes, with lots of graphics, the emulator will just give up.   Can you develop live using WIFI or using USB? These options almost always render faster than the emulator but will not be at lightning speed if you have lots of graphics.  Be patient.

12)  This happens too:   We have see instances where it is probable the Google Cloud messed up; other instances where an older PC has had memory issues and caused file corruption of the Project and instances where a user is using a very slow Internet connection (like dial-up) and it is just too slow.

13)  Do you have an AVG, Eset or AVAST virus checker.  Some versions of these products have been reported inhibit running the emulator unless (in the case of AVG) the Advanced Link settings on the software are set to allow AI2 communication.

The problem could be something else, like running an old version of Companion ...in this instance the cure might be:   Projects > Hard Reset.  If there are Companion issues a pop up will appear (if no issues, nothing will happen...just smile).  When the pop up appears, follow the instructions very carefully, then reboot your PC and try again.



I have no warnings or errors showing. here is the error message i get. Server error: could not build target. Please try again later! How can i tell how big the file will be?



I have waited for about  2 hrs total so i will try again later but it shows no warnings or errors 



Go to my tips, read about creating an AIA file, and that will tell you the size...




file size is 1.5mb



That certainly shouldn't be a problem.  Did you try another browser?  Also, make sure you close the browser you're using, and clear the cache...



Build a NEW project, a very simple project.    Put a Button on the Designer screen.   Just the button.   Now compile it.  Does that run?    All the app is is an AI2 button displayed.    Building this simple app will demonstrate whether the issue is with your current project or something else.

Did the simple project compile?  


Setting a List as a Variable


ok. I'm trying to build a quiz. When I run it in the emulator, all is fine, yet when I make it an app and install it on my mobile, the error shows up: "Runtime Error: End Application" "Select List Item: List Index too large". Now I know what causes this.but I don't know how I can program this otherwise.

Here is what I thought: I have five lists of four items each. WHen the user clicks Next button, the variable ActiveList is set to List1. I defined the activeList variable as shown in the attachment. I believe they cause the error as the list isn't there yet and the index doesn't exist. How can I overcome this?


--
Hi, it is not a good idea to leave the block connectors empty. For the first you should say create empty list, and for the second just an empty text string would be ok.
Later, you will reassign the variables with what you need.

--
Ghica, thank you for the guidance, yet I did what can but still I get a runtime error. interestingly, before I made the changes you said, the apk would ask for permissions to for wifi and phone(sth I don't remember exactly) but now it doesn't. But again, runtime error. I'm uploading the whole aia here, if anyone can check and tell me what I misconfigure... Thanks in advance. 


--
How to work with Lists by Saj

If you are asking for help, I recommend you to make it as easy for others to be able to help you ...
You probably will get more feedback then...

which means in your case post a screenshot of your relevant blocks...


To download the aia file, upload it to  App Inventor, open it, do some bug hunting for you, etc... this takes time, and most people will not do that...

--
Hmm.. you're right. I couldn't figure that, as I'm having headaches trying to solve this thing and as I'm still a rookie... A general question I would like to ask first, is it normal for an app to work fine in the emulator but give runtime errors as an apk? In my situation, everything works fine. I believe the trouble is caused by the blocks in the attachment. I'd be grateful if we can sort this out. 

And yet another question: Is there a standalone version of AppInventor2? my connection is terrible sometimes, so I'm having difficulty even connecting some blocks... Thanks for your help in advance.



--
What I see in your blocks is that you have indexes for a list that are 0. But the first element in a list is 1. You must initialize them to 1.
Yes, there are a few standalone versions. Just google for them.

--
Hossein's AI2LiveComplete has a standalone system...http://amerkashi.wordpress.com/

--
Thanks, all solved, though "set global UI to Terrible(!)", the procedures do as I wanted them to. Thanks everyone for the help..

--