2016년 12월 31일 토요일

camcoder and file path


Camcorder.afterrecording has clip parameter to give the file path, but I don't know why in my app give another path:

content://media/external/video/media/<number_with_4_digit>

someone know why?

--
the result from the camcorder unfortunately is a video content uri, but not a path to the recorded clip 
see also this old thread from Dec. 2014 getClip returns a file path not working MIT should change that and provide a file path instead

also unfortunately there is no conversion block available, which converts a video content uri into a path to the file
however you could write your own extension and create a block yourself...

more information about how to create an extension see here Announcing App Inventor Extension Components
however that will be more advanced and will require some Java skills...

I also can offer to write that conversion block, see also Q2 here https://puravidaapps.com/file.php#q .

--
in order to select manually the video recorded is there something like imagepicker?

-- 
there is no video picker component

you could use my file extension and the FileList block to get a list of files of a given directory, see also https://puravidaapps.com/file.php
 filelist.JPG
The App Inventor Extensions are currently in testing. See the announcement for more information about how to use an App Inventor Extension. 
  
-- 

Camcorder.afterrecording has clip parameter to give the file path, but I don't know why in my app give another path:
content://media/external/video/media/<number_with_4_digit>



it seems to be, MIT fixed that issue meanwhile
the camcorder now provides the path to the file instead of the content uri as previously
thank you MIT!

-- 

Error "Segment: Start (3) + length (1) - 1 exceeds text length (1)"


The arduino sending a string "010101" using by using bluetooth. i can see the program still running well at the back of the pop up message "Segment: Start (2) + length (1) - 1 exceeds text length (1)"

How to get rid of this error ?? "Segment: Start (2) + length (1) - 1 exceeds text length (1)"



--
Use the length block to test if rxstringstatus >= 3 before using the segment block.


--
thank you for the reply... you solve my problem.. thank you

-- 



I can't quite figure out how to get this right


I'm trying to control mt arduino from my android phone and get feedback like temperature and humidity from arduino using one string because it makes it alot easier but at the moment it is not working that well.
Here a pic of the code i came up with.
Any help is appreciated :)



--
1. see here how to receive something correctly

A simple Bluetooth Chat with App Inventor 2

btchat.aia

2. it does not make sense to check this regularly, because once connected, ISCOnnected will stay true even if the connection is gone

3. before doing this, you should check, if the length of the list is >= 2 to avoid errors in case it is not

-- 
I'll try that tomorrow and give an update on my progress.

-- 
Ok so I decided to just get out of bed and try it right now so I tried what you suggested and it works almost perfectly now.




-- 
Many thanks for the help, I am going to try it now with more values and i'll just see where that goes.

-- 
this looks better
see here how to connect correctly

and remove the first if block inside the clock component

-- 
Alright so I removed the connect block from the clock and I added some notifiers



-- 


Trying to connect to App Inventor with Arduino Bluetooth


Hi, I'm trying to connect an arduino sensor (PIR) with MIT App Inventor using a bluetooth module. Basically, the goal is so that if the pir sensor reads above a certain value, I will be able to send SendText to the phone, as well as give a high to a pin on the arduino. While I know how the computer logic will work (the if, then logic), I don't know how to start it. Has anyone else done something mildly similar to what I've been trying to do who can help me figure out how to access the arduino data so that it can be manipulated in my code? (What chunks of code should I add so that I can get to the point of data manipulation?) Thanks! 

Screenshot (19).png 표시 중

--
It does not look like you have used the forums yet, as a search using the search box above would have returned several threads about this topic.

-- 
I know, I haven't posted on forums yet, but I've spent the past few hours looking at others post, without any clear answers (except for a couple examples that kind of contradicted), so I figured I'd try asking myself.

-- 
what about following this example I can't quite figure out how to get this right which has been discussed 2 days ago?
and there are many more..

-- 

Making a Game using GIMP, Inkscape and App Inventor part 01! (Video Tutorial)


Today I have the first part of a new tutorial. How to make an App using GIMP, INkscape and App Inventor. I start since the very begining. I show in the first part of the video the app we are planning to make. I hope you find it useful I am sure you will learn some useful tips to improve your apps! to make them look better ... well I hope so.. Part 2 will be ready by thursday.. so please check it !
Thank you friends!



--
Very useful for showing how to create sprite images from parts of another image.
Looking forward to the next video...

-- 

The operation add items to list cannot accept the arguments: [0] [1000]


Hi, I am trying to construct a list with time values, but I received the error msg at runtime. 
I would appreciate a little help on this.

PartOfMyCode.png 표시 중

--
try to initalize the list using the create empty list block
-- 
I already did it, also using make a list block, with the same result :-(

-- 
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.

-- 
I already figured it out. Let me tell you that dealing with data files I/O in app inventor 2 is not straightforward at all. In my case, it did not work to convert immediately to csv (inside the timer block), instead of that I had to make my lists and post-process them in another block in order to save the data in a .txt file.  

-- 
a screenshot could have helped us to give you some suggestions


 dealing with data files I/O in app inventor 2 is not straightforward at all. In my case, it did not work to convert immediately to csv (inside the timer block)

my guess is, you are reading a file using the file component. You should convert the text in the File.GotText event and not in a Clock.Timer event

-- 
I know you are very helpful, thanks anyway, I am sure I will need your help at some point in the future.

-- 

Camera Project


Hi everyone, I'm Thomas and I'm kinda new to appinventor

Is there a way to avoid having to click on "OK" after taking a picture with the camera TakePicture function?

--
unfortunately this is not possible usng the built-in camera component

you could write your own extension and create some blocks yourself...

more information about how to create an extension see here https://groups.google.com/d/msg/mitappinventortest/Ip2AX036d0U/5NJlAEbFCgAJ
however that will be more advanced and will require some Java skills...


-- 
I have Java skills but I have never programmed phone stuff without using AppInventor

What I really need to do is when recieving a byte (like the value "3") that has been sent from another phone (I have already achieved this part),
the phone recieving the byte takes a photo and stores it.

I have linked the app I've made.
I use another app to send the byte.

So far, when i recieve the byte, it opens the camera on the phone, but it doesnt take a picture. And if it would do, I would have to press the OK button to take the picture, and the whole purpose of our project is taking picture remotely.

I feel like I'm so close to do it, but AppInventor doesnt seem to make possible what I want to do.
Is there any way you could help me ?

Thanks

So far when I 


-- 
I deleted your post because it has an .apk attached, which is not allowed. You can attach an .aia if desired.

--
Hi everyone, I'm Thomas and I'm kinda new to appinventor

Is there a way to avoid having to click on "OK" after taking a picture with the camera TakePicture function?

--
unfortunately this is not possible usng the built-in camera component

you could write your own extension and create some blocks yourself...

more information about how to create an extension see here https://groups.google.com/d/msg/mitappinventortest/Ip2AX036d0U/5NJlAEbFCgAJ
however that will be more advanced and will require some Java skills...

alternatively I can offer this workaround 

Take Pictures programmatically using the Activity Starter calling a Java app

-- 
I have Java skills but I have never programmed phone stuff without using AppInventor

What I really need to do is when recieving a byte (like the value "3") that has been sent from another phone (I have already achieved this part),
the phone recieving the byte takes a photo and stores it.

I have linked the app I've made.
I use another app to send the byte.

So far, when i recieve the byte, it opens the camera on the phone, but it doesnt take a picture. And if it would do, I would have to press the OK button to take the picture, and the whole purpose of our project is taking picture remotely.

I feel like I'm so close to do it, but AppInventor doesnt seem to make possible what I want to do.
Is there any way you could help me ?

So far when I 


-- 
I deleted your post because it has an .apk attached, which is not allowed. You can attach an .aia if desired.

--


How do I create an email feature?


I need to create a basic Email function, that allows me to write and send an Email to a particular address. Thank you in advance. :)

--
See Taifun's post HERE on different email solutions.

-- 

How can I change version code during building an app


How can I change version code during building an app?

--
well, actually you change it before building in Screen1

-- 

Passing variables with TinyDB seems to fail when App is built


Working with a group of disabled students on a variety of apps. An interesting problem has occurred in several of these apps where we are using TinyDB to pass values between screens. This ranges from values used to control which colour schemes to use on screens, or a simple login system using one variable signifying Logged in (True) or Not logged in (False).

The problem is that when we are testing through the MITAI2 Companion everything works fine - Pictures appear, colour changes work, the Login is fine (hiding/revealing content depending on value), however when we build the final App these things no longer work.

As a test in one app I got a message to appear on the screen stating if security was on or off after using the login screen. In the Companion the message changes to 'Security is Off' after the login. Build the app and install then run and this doesn't happen - the message states 'Security is On'. Note. On the login screen itself a RED square appears if you are not logged in and once your username and Password are checked the square turns to green - this display bit works fine in the built App, but you are still not logged in when you return to the previous screen.

Whats happening differently beween the test stage and the final App? Any ideas?

--
What might have happened is that while you are developing and testing the TinyDB becomes populated with data. However, after you built the app, the TinyDB will be empty. Therefore, if your app depends on data being there, then you must do some initialization the first time the app starts. And save that you have done that in th TinyDB.

--
An initial screen setups the values to be stored in TinyDB by the App, then any changes are updated on the various screens, so the TinyDB isn't empty at any point.

-- 
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.

-- 
Something else must go wrong then. Could you provide an .aia to look at?

--
Attached is one of the students project Apps. This is one where the login works in development but not when the final app is built.


-- 
Probably your problems is this: screen handling is not the same when you use the companion or a built file.
When you return from the login, you expect to do the Mainscreen.initialize again, but since you did not close the Mainscreen, that does not happen.
Start using when ... otherScreenClosed, or always close the screens directly after you called another screen.

Read Taifun's tips on this:

-- 

Possible to add two different tinyDB to sms text?


Hi, is it possible to add two different tinyDB to sms text? 
I know that this doesn't work, but it will show you the idea

 Capture.PNG
--
There is only one TinyDB, but it can have many tags. I see a problem with your code because it is very unlikely that a specific Lat,Lon combination would be there, therefore you would always get blank values, unless you do not move.
So could you please explain a bit more what you want to do?


--
The proper test for proximity would be:
If abs(target lon - current lon) + abs(target lat - current lat) < epsilon then
  you are close
else
  you are far.

Epsilon is whatever number you choose (> 0) for how close you need to be, bigger is looser.

-- 

Problem with MIT app Inventor


I am create on MIT app inventor in my project application but some problem in MIT app inventor.

My Problem is Not progress bar pun on image how to put it ??

--
Do you want to put a progress bar on top of an image? I do not think you can do that. You could have a background image of the screen, if that is sufficient for you.
--
You can pre-build images of a progress bar, and show a sprite with a current image picked off a list, that cycles thru your progress.

-- 


2016년 12월 30일 금요일

RANDOM SCREENS


Is it possible to run the screens randomly?  

--
I mean if it can change it time the app runs for example one time 1, 3, 7 and another time that you open it 1, 5, 4...

-- 
You could set the timer to a random amount of time and close the screen when it fires.
Do you also want to open other screens randomly? In that case you could store a list of your screen names in the TinyDB and choose an element randomly when it is time to open another screen.
If neither of this is what you intend to do, then please clarify.


--
Why do you need so many screens?

Do you throw away one phone and buy another if you want to look at another photo?

-- 


Getting to the main loop of the screen


I'd like that my program could do a periodical action when a screen is active. Is there any kind of 'main function' for a specific screen? I mean, is there any main loop running everytime in background?

I'd like to check the timing of the system from time to time regardless of the screen where the user is at the moment.

I am developing an alarm and I'd like to check the time to activate the alarm or not.

--
The way to check things occasionally, is to use a clock with a long timer interval. However, when you switch screens at a moment that the timer did not fire, you must adjust the timer in th next screen. Or maybe, if the interval is short enough, that does not matter.

--
AI2 does not run in the background.

-- 

bluetooth Arduino


I developed a small app that imports data from Arduinothrough bluetooth,
the part of Arduino is working.

When I install the application I have a problem:
After I choose the bluethoot module from the phone,
the application stops responding on a black screen....

I am attaching my screen of blocks,
Is anything wrong?



--
Here is something to try.
Perhaps have the Clock1.Timer Enabled to false initially in the Designer.
Below the BlueToothConnect.Address procedure you can enable the timer.

-- 
Before this project worked great,
Now it is not working on three different phones,
I have replaced the bluetooth module, Arduino twotimes,
because I thought that the problem was in this,
but then I tried it with a PC and it works Arduino,
everything hangs when I choose the phone the bluetoothmodule.
I attach the set clock of my program,
some idea?
has anything changed in the app inventor ofbluetooth data management?

-- 
sometimes it helps to look around a little bit...
before using the ReceiveText block make sure, there is something to receive
for example this solution, which was discussed yesterday: I can't quite figure out how to get this right

-- 
Your timer settings seem pretty fast. How fast is the Arduino sending data? Indeed, if you get the next timer event before you are finished waiting for the previous one, the app will choke. It will help in any case to experiment with longer wait times of the clock.
If your message received from the Arduino is short, then Taifun's method will work. If you are receiving long messages, you must use the number of bytes to receive block, collect them in a global variable as buffer and check whether you found the end of message and only then dissect what you have.


--
I have done many tests,I write the results:A) Arduino UNO, HC-S04 sensor and bluetooth module are new and they work fine with the Serial Port of PC

B) I have always done more tests with the same simple sketc arduino, this:

#define echoPin 7 // Echo Pin
#define trigPin 8 // Trigger Pin

int maximumRange = 200;
int minimumRange = 0;
long duration, distance;

void setup() {
 Serial.begin (9600);
 pinMode(trigPin, OUTPUT);
 pinMode(echoPin, INPUT);
}

void loop() {
 digitalWrite(trigPin, LOW);
 delayMicroseconds(10);
 digitalWrite(trigPin, HIGH);
 delayMicroseconds(10);
 digitalWrite(trigPin, LOW);
 duration = pulseIn(echoPin, HIGH);
 distance = duration/58.2;
 if (distance >= maximumRange || distance <= minimumRange){
 Serial.println(" ");
 }
 else {
 Serial.println(distance);
}
  delay(100);


C) I have always used in the  test, the clock setting the TimeInterval is 1000, with check of TimerAlwaysFires and TimerEnabled

D) I have set Bluetooth client in all tests as picture attached Bluetooth.pngTest 1 (blocks, picture Test 1.png)-Once You have selected the Bluetooth module is rare that continues;-The rare times (once out of 20 times) I had
 
1) turn off the phone
 
2) 
turn off Arduino
 
3) Turn off bluetooth- That one time worked, the numbers were not in real time, is blocked and then gave a series of about 10 seconds before numbers

Test 2 (blocks, picture Test 2.png)
- As soon as I open the application appears to me
"Error 505: Not connected to a Bluetooth device"- I continue and I click on the bluetooth module is connected but no data appears(Immage attached Error.png)- It never stops, but never gives the data.What do you advise me to do?The part Arduino works, it would seem that app inventor(or I) has problem in connexin bluetooth data.Can you send some of your example?









-- 


Test 2 (blocks, picture Test 2.png)
- As soon as I open the application appears to me
"Error 505: Not connected to a Bluetooth device"
- As soon as I open the application appears to me"Error 505: Not connected to a Bluetooth device"



most probably, this is, because your clock is enabled from the beginning
you should disable your clock end enable it after the connection has been successful
Taifun

--
I have not selected Timer Enabled and active afterblutooth connection,
Now tests have improved. The phones now are connected to bluetooth module
but there are no incoming data (numbers in centimetersfrom Arduino)
is just the Bluetooth setting which I am attaching?
What I can fix?
Someone can show an example .aia?



--
Thee are many examples of people successfully connection Arduino's to AI2 using Bluetooth, so somewhere there must be a bug in your setup.
What you can do to find out is to use another app like Ardudroid, to find out what your Arduino is really sending.
Also, show your relevant blocks as they are now, or attach an .aia



--
Something else: you assume that the text you receive will contain a ?
What if there is no ? I do not see it written in your sketch.
So, you will not see anything.
What you should do, is create a new label, called debugLabel or similar, and show all received text in it. You can see then what your Arduino sends and adapt your app as needed (or the sketch, if needed)



--
I tried to make a sketch for my Sparky robot car (which has also a proximity sensor), similar to yours. The main difference is that my sensor sends out integers instead of floating point numbers, but I think that this does not differ too much.
Here are my blocks:
This should work for you too. Because the Arduino is much faster than the AI App, you will usually get two values, which are displayed on two lines in the label. You could make the timer interval shorter, or you could chop the second value off (look at the text blocks, for example "split at", use /n as at value. You would get a list, of which take the first element and display that.

I made the text of the listpicker "connected" when the connection succeeds, that is nicer. Actually, you should have a disconnect button and disable the listpicker when connected.

-- 


AI Companion-The Companion you are using was built for different instance of AI


Hello, I have always been able to connect to my appusing AI Companion. But today, I encounter this problem
"The Companion you are using was built for different instance of App Inventor. To obtain the correct companion look on the App Inventor screen under Help->Companion Information menu."
I then updated my app from 2.35 to 2.36 but still have the same problem.

--
see here Instance problem and try again

-- 
Is this still happening?

-- 
No. It's working now. Thanks

-- 


Instance problem


We have a school lab of Mac OSX computers which my 2 blocks of students share, one in the morning, one in the afternoon. My first block of students didn't have any problems using the emulator in the morning. However, my second block of students in the afternoon all had problems running their programs in the emulator. The error is:

"The Companion you are using was built for different instance of App Inventor. To obtain the correct companion look on the App Inventor screen under Help->Companion Information Menu".

Students in both classes don't have issues testing using their Android phones/tablets, just my second class using the emulator.

I have tried reset, and hard reset, and nothing has worked.

Is there a problem with multiple users on the same computer running the emulator? Can there be 2 different logins accessing the emulator program on the same Mac computer?

--
I believe your problem may be related to the release we just put out this afternoon. I have backed the release out until I can do more debugging. I apologize for the inconvenience.

--
Thanks for the quick action and quick reply. Both our classes were able to launch the emulator now in our Mac OSX lab.

-- 


Using oauth api


thank you very much for your working . Please help me. I'm working to do an app that contain oauth api. How can i get access token. There is no block in your https://puravidaapps.com/oauth.php page. Please help:(



--
in addition i have an client id and secret

-- 
read the large green box on the bottom of that page https://puravidaapps.com/oauth.php about how to get the source code. thank you.

-- 

There is a bug in version nb148


There is a bug in version:
Build: April 24, 2016 Version: nb148
When you load a project that has the size of font of a different checkbox to 14.0 resizes the height of the checkbox component pixel image attached.
I changed the height of all checkbox to "automatic" but when I save it and Reloading the project again resize all checkbox to pixels.
I hope to settle it soon.

checkbox.png 표시 중

-- 
It is very strange,  I've changed the size of the font to 14.0, and I've changed the Height as "Auto" again, I have closed the browser and I've  reloaded the project and AppInventor again change the height of the checkbox to 14px instead of "automatic".

-- 
It works correctly for me on Windows 10, Chrome browser.
I set checkbox height to 14, saved the project.
Then set checkbox height to automatic, saved the project.
Closed the browser.
Reopened the browser.
The checkbox height was still set to automatic.

-- 
Try again.
I think you accidentally may have set the checkbox height to 14 when you were trying to set the FontSize to 14.

-- 
This is indeed an issue. We recently changed the system so that when you set the font size it would change the height of the checkbox. We will look into figuring out what the right thing to do is...


-- 
It occurs when I load the project in the browser, AppInventor resizes the checkbox another time to pixels.

-- 
We just deployed nb148a which should fix this issue.



-- 
Thank you, when I have time I try it and you commented. Greetings.

--
Perfect!!

-- 

Recorder Saves file with extension *.3Gp but adds another "." after extension


Recorder saves recorded message with and extension  nameofsong.3gp and sometimes as nameofsong.3gp. with a "." after 3gp

I am using Lenovo Laptop with Windows 10 with a Samsung Tablet SM-T230NU running Android Vers 4.4.2.
Here is the project Rec3GPFile.aia

Also Plays previously recorded audio file sometimes.

Thanks for your support.
Any reason why it does that?


--
use this test project How to use the Sound Recorder and let us know, if you get the same issue on that device
-- 
Thanks a lot. That worked. Frank

-- 


Google or MIT


If i ask a question here, I usually get a great answer. I'd like to know, am I usually answered by MIT or Google employees?

--
MIT and forum community members.

--

APP INVENTOR 2


I'm currently doing some coursework for computing on app inventor and i was wondering when app inventor 2 was first introduced to the public or when it was first released coming from the original program using javascript 

--

Problem creating a folder


i us 6-12 imagepicker, Want to save the image in a folder  full size image. the images show on screen on smalL canvas.
i us tinydb call storvalue tag as "\DCMINI\imag2.jpg"
Icanot find the Folder un the tablet.

--
TinyDB can't create folders, TinyDB is to get or store values in the TinyDB database

-- 
The image from the imagepicker is saved as sized of canvas.(small)
I need the image to be saved as original size, How can I do this?

-- 
use the image picker together with the Copy block of my File extension to copy the image to that folder https://puravidaapps.com/file.php

-- 

I wanted to create an app for my org which picks a specific PDF file from a list


Please guide me with this I want to store pdf files in web db as it will be updated every now and then I want to pull the updated data on web veiwer of my app and provide an option to store the doc in phone if the user wants.