2014년 12월 26일 금요일

Error message No method named 'keyFile' in class com.google

Hi I have to issues

Firstly, im getting an error message no method named 'KeyFile' in class.com.google.appinventor.components.runtime.FusiontablesControl

Secondly, will i select the UseServiceAuthenitcation, and apply my ServiceAccountEmail the application does not work.

I am not sure which blocks to send


Understand Tinydb with Webviewer...

Screen 1- that contains number of buttons...
Button 1
Button 2
Button 3
(For Example)
Screen 2- Webviewer Component

Now what i want that when button 1 clicked screen 2 will open and Webviewer load http://www.google.com url..
When button 2 clicked screen 2 will open and Webviewer loadhttp://www.gmail.com url...
When button 3 clicked screen 2 will open and Webviewer loadhttp://www.youtube.com url...

Can this is happen with the help of tinydb or i need to use tinywebdb
I know its very basics.. but i don't know...



All this is is really a passed variable to the next screen (Screen2).

On Screen1:

On Screen2:




Ohhh.....
I am looking all around for that solution man...lol
I am just a beginner..
Thank you so much for help..



Read my tips... they'll help you as you get started...




Sure bro...



One more thing... that may only work with the APK on a device... passed values don't work in runtime emulator mode, I don't think.

Another solution if you wanted to use it is the TinyDB which will also work on the emulator...

On screen1:
On Screen2:




or pass the URL as start value...
then just use the Webviewer.GoToUrl block in Screen2.Initialize


How to add contact us form?

I need contact us form...
Like above image..
is there any method to create this in the screen? i don't want to use external html to create form and post the link in web viewer function...



Yes of course, just use some labels, text boxes and a button.

TextBox

Users enter text in a text box component.
The initial or user-entered text value in a text box component is in the Text property. If Text is blank, you can use the Hint property to provide the user with a suggestion of what to type. The Hint appears as faint text in the box.



Then you could use one of these methods to email the contents of the form to yourself http://puravidaapps.com/sendmail.php


AI2 and Linux Setup

Want to install AI2 on my laptop.  Linux Mint 17 / Firefox.
Have downloaded these  files

http://appinventor.mit.edu/explore/ai2/setup

Appinventor Setup installer tar file

http://appinventor.mit.edu/explore/ai2/setup-emulator.html

/usr/google/appinventor/commands-for-appinventor/aiStarter &


Have double clicked the tar file to extract files.

Folder is:     /appinventor2-setup_1.1/appinventor/commands-for-Appinventor/

When I place the:     /usr/google..........    in the Linux Terminal it says file not found.


Is this the correct procedure or is the folder incorrect?



install ia32



Did this in Terminal and got this message.
********************
charles7@charles7-Satellite-Pro-L500 ~ $ sudo apt-get install ia32-libs
[sudo] password for charles7: 
Sorry, try again.
[sudo] password for charles7: 
Reading package lists... Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/extra.linuxmint.com_dists_qiana_main_i18n_Translation-en
E: The package lists or status file could not be parsed or opened.
charles7@charles7-Satellite-Pro-L500 ~ $ 
****************

What should I try ?



Why not use AI2livecomplete. I use it with linux mint myself. Extract it. Make the .sh executable and it works. You can use it without and internet connection. You can make bigger apk's. The latest version is made from AI2 source of december 16th.



You can find it at http://sourceforge.net/projects/ailivecomplete/files/



I'm OpenSUSE user so, I don't know much about Mint this link may help.
http://forums.linuxmint.com/viewtopic.php?f=190&t=122296



Thanks for info.   ( I am a noobie to AI2 and appreciate help)


I have downloaded the AI2Offline_16Dec14Zip  and using right click have set the file to execute.

Now to get AI2 alive complete running what do I enter in terminal ?



Charlie... AI2LiveComplete is a separate program run by Hossein.  Any question about it must be directed to his blog site...http://amerkashi.wordpress.com/


Help with TinyDB

i Guys! It's time for me again to ask some questions to you.
I have created an App, here is the layout of the app.
My question for you is how can I use the TinyDB function to save the pressed button (when the button is green) to be green when the application is turned off and turned on after a while. It's just not working...
I attach a picture of my blocks to.

This is how I want it to work:
When i press a button the button will be green to figure that i've pressed it.
If i want to press another button the first button will be black again and the previous button will be green.
When press the red button the green button will be black.
All this features I want to be enabled even if the application is turned of and then on again. 

Thank you Guys for all help, Im new here and Im sorry if you're think I'am stupid.



You just need to save WHICH button was selected when you close... Then when you open up, restore THAT button to the back color and all the rest to black except for the last which is red...


How to save recorded sound as sound file on phone?

I have a problem. I want to save recorded sound (which is in a .3gpformat) as a readable sound file, because it seems like 3gp cannot be read by the mediaplayer of the phone. Is there any way to accomplish this without using a different app to convert the file?



the sound recorder only can record 3gp format, see also this example

do you use an older device?
you could install another media player on your device...



Well I know that it can only save records in the 3gp format, but the problem is, I have a S4 and it tries to open 3gp with the video player which doesn't work probably because it does not contain any video content.






Well I found the answer to my problem, I thought when you save a sound to the TinyDB after recording, you would really safe the sound file itself but instead you only save the directory of the sound file.



what you are saying is not correct, see screenshot, as you can see, it is a 3gp file, which is saved...




I never said something different, I just said that the value in the TinyDB is not the file itself but instead the directory of the sound file (which is like you said in a 3gp format)



ok, yes, it's the path to the sound file which is saved...


TinyWebDB HELP

PLEASE SOMEBODY COULD HELP ME? I have a problem with this "TINYWEBDB". How can I do to put the datas that I recover on my app to the cloud? My app has a page which allows me to recover datas and thanks to Tinywebddb, these data should be on my Google app engine Datastore viewer. But there are no datas. The configuration of my app engine is good. 

THUS PLEASE SOMEONE COULD HELP ME? OR SHOW ME HOW COULD I DO TO HAVE THE DATAS FROM MY APP TO GOOGLE APP ENGINE THANKS TO TINYWEBDB? I'M DESPERATED.



see here https://sites.google.com/site/stevozip/home/AI2/tinywebdb
btw. there is no need to SHOUT! 

Advice: Before posting, it's a good idea to search in this forum. Many others have likely run into problems similar to yours. How to search see screenshot.



Man, it drove me crazy because there are so many tutos and I tried them but I have had no results so there are reason to me to shout lol


Projects loading

I lost my projects(they were 2),which i need for my school . Please, is there a way to restore them?



Lost your Blocks.  

Does this mean your Project are gone from the AI2 browser?   

 Is it possible you logged in with an account different from the one under which you coded the projects?  If you have several accounts, try using another account to access your project(s).

Does this mean you are missing some blocks for two projects?

In most instances of users 'losing' blocks, they are not really gone (yes, sometimes there is a problem).  At the moment, please try this:   On your Blocks screen, please find a white area; right-mouse click anywhere where there is not a block; a menu will appear; please select  Arrange Blocks Vertically    or   Arrange Blocks Horizontally;  your blocks should re-appear.   Did the blocks re-appear?

Please tell us which of the above applies to your problem.  Also,  please send us the name of your projects and tell us a bit about what you were doing with your project just before you quit your last GOOD programming session.   Did you add lots of images?  layouts, make a major change or whatever.  This will help us establish what might be wrong and provide the possible basis for recovery.  Sorry you lost your blocks, we will try to help you but realize, it may not be possible to recover your blocks if they did not appear using Arrange Bocks.

Did you save an aia file?    You should be able to restore your project with the source aia file; simply load the aia.  Developers are supposed to frequently save a project as an aia file to provide a local back-up in cases where there are issues either with your PC memory or with Google Cloud which sometimes cause projects to corrupt.

Answer the questions and provide more information and someone here will try to help.  Be aware, it may NOT be possible to recover your blocks and perhaps you just tried to access your projects with a different account or the blocks were hidden.   Smile, someone will try to help.


Merry Christmas,



NASOS replied by email    and said:

A message appears which says that app inventor could not retrieve project information and my projects doesn't apper. I tried many times, but the problem remains.I guess it has to do with the loading of the information. Thank you for your support and

Merry Christmas


Please send us the name of your project.  Someone will look but you need to be patient because it is holiday time in the US.



NASOS replied by email.    Ladies and gentlemen, please do not respond by email.  Respond within the forum please.

the first file is My_Project that i need. i know about Christmas it is holiday here too. Thank you for one more time

@Everyone    Ladies and gentlemen, please do not respond by email.  Respond within the forum please.
@NASOS ...someone will look but it might take a long while.


How to get Acces Token and refresh token for Fusion Api


I want build app using fusiontable as DB. And without FusionT rotating icon and more useful so ı need use oauth.

I know Taifun's do it but its premium content

I need oauth verify for insert update or other actions

How can ı get acces token and refresh token 

#2. Your web application redirects the user to Google Authorization page
#3. User grants your web application access
print 'Visit the URL below in a browser to authorize'
print '%s?client_id=%s&redirect_uri=%s&scope=%s&response_type=code' % \
  ('https://accounts.google.com/o/oauth2/auth',
  client_id,
  redirect_uri,
  'https://www.googleapis.com/auth/fusiontables')
#4. Google redirects the user back to your web application and
#   returns an authorization code
auth_code = raw_input('Enter authorization code (parameter of URL): ')
#5. Your application requests an access token and refresh token from Google
data = urllib.urlencode({
  'code': auth_code,
  'client_id': client_id,
  'client_secret': client_secret,
  'redirect_uri': redirect_uri,
  'grant_type': 'authorization_code'
})
request = urllib2.Request(
  url='https://accounts.google.com/o/oauth2/token',
  data=data)
request_open = urllib2.urlopen(request)
#6. Google returns access token, refresh token, and expiration of
#   access token
response = request_open.read()
request_open.close()
tokens = json.loads(response)
access_token = tokens['access_token']
refresh_token = tokens['refresh_token']
#7. Access token can be used for all subsequent requests to Fusion Tables,
#   until the token expires
request = urllib2.Request(
  url='https://www.google.com/fusiontables/api/query?%s' % \
    (urllib.urlencode({'access_token': access_token,
                       'sql': 'SELECT * FROM 123456'})))
request_open = urllib2.urlopen(request)
response = request_open.read()
request_open.close()
print response
#8. When the access token expires,
#   the refresh token is used to request a new access token
data = urllib.urlencode({
  'client_id': client_id,
  'client_secret': client_secret,
  'refresh_token': refresh_token,
  'grant_type': 'refresh_token'})
request = urllib2.Request(
  url='https://accounts.google.com/o/oauth2/token',
  data=data)
request_open = urllib2.urlopen(request)
response = request_open.read()
request_open.close()
tokens = json.loads(response)
access_token = tokens['access_token']

How to apply it to app inventor 

Can someone help me?



well, my fusionDB example is not premium content, it's only a "No free lunch" example and you can get it for a small fee...

as a start you can read the Google documentation about authentication https://developers.google.com/accounts/docs/OAuth2 and try to convert this into App Inventor
Good luck!



I can get acces token but ı cant send post how to do it?

POST /oauth2/v3/token HTTP/1.1
Host: www.googleapis.comContent-Type: application/x-www-form-urlencoded

code=4/v6xr77ewYqhvHSyW6UJ1w7jKwAzu&
client_id=8819981768.apps.googleusercontent.com&
client_secret=your_client_secret&
redirect_uri=https://oauth2-login-demo.appspot.com/code&
grant_type=authorization_code
I try 
 token block.png





Thanks

I do it i use pagetitle for accestoken and i use segment block for refreshT

I use start number 172 and leght number 45 for segment block so ı can get refresh token 

I have litle question about refresh token leght is it always 45?


Error no method named 'Keyfile' in class com.google.appinventor

Hi two things

firstly, im getting this error message no method name 'KeyFile" in class com.google.appinventor.components.runtime.FusiontablesControl

secondly, when i press UseServiceAuthentication and apply my ServiceAccount Email the application doesnt work.

If you need to look at the blocks.. can you tell which ones that you will need to see



Please do NOT double-post on this forum.  I have deleted your other post.  We get to these as fast as we can, and double-posting just wastes space and time.

Post screenshots of all of your relevant blocks... this means any blocks that have to do with the issues you're having... the more you show, the better we'll understand.  If you're not sure how to take screenshots, read the section in my tips below.



see my answer in your other thread



hi these are my blocks that i had changed based on tutorial   

the error designer image   ... the app will not work if i select UseServiceAuthenication or allow my ServiceAccountEmail








What is the Version number of your companion app?



it says Version 2.11 ai 2   i have updated 



the current version of the companion app is 2.23ai2zx1
see also here to download the latest version http://appinventor.mit.edu/explore/ai2/setup-device-wifi.html



version 2.23 ai 2zx 1



Current version is 2.23. 

Do a Hard Reset from the Connect menu.  Then, open the emulator again from the Connect menu, and follow the instructions EXACTLY.  That means, you have to carefully read each message posted...



ok, if you now have version 2.23 installed then I recommend you to start doing the recommended steps to create a new project again

also use the example app to download on that page to test the service account option together with your table

btw. in your screenshots I can see a keyfile starting with 4f in the Designer, but in the Blocks Editor you are using a file starting with 8b, this obviously will not work...


Date picker icon where clock icon should be

I have a "DatePicker" icon where normaly is "Clock" icon (I've noticed this on several tutorials.I can't use this option.Please help



You can find the clock component in the Sensors drawer



Please show a screenshot that displays what you're trying to say...



Good translation Taifun! Two Thumbs Up!



@Enis: well, I speak some bad english and that helps sometimes ;-)


can I use c language with AI2

I want to know that can I use C language with App inventor 2.

example I write calculator program by C and I want to use it help me calculate in app inventor 2.



No, unfortunately, you can't...



I once prepared an example to run Python code in the webviewer of App Inventor, see here

How to use App Inventor and Skulpt to run Python code

in case you can find a similar library for C, you could do it


[App Inventor Open Source Development] Using STATIC to share component among screens

I'm working on the Bluetooth LE client, and what I've noticed is that it's hard to share among screens. There is only 1 real BTLE device on the phone, and I would like to share the connection among multiple windows:
  •  for example, you may want an APP that configures the BTLE connection, but another screen that processes the data. 

My first attempt, I used the tinyDB to share variables from the one screen to another, but the clocks and timers in the previous screen are no longer executing. My next thought in development, if I put all the BTLE state variables inside the class as "static", there is really only 1 instance of these variables, and the connection state etc will automatically carry over to the next instance of the BTLE component in the next screen. 

Has anyone used this technique to share info between screens?  



How complicated are your screens? 
You can put components inside arrangements and make arrangements visible or not visible.



@David, Have you seen THIS link regarding design / guidelines on developing AI apps using multiple screens?


Need help to begin a program

Hello everyone, I'm Baptiste ans I use app inventor since 2 months. I already finish a simple Quizz and now i would like to start a new project.
I want to do a story where you have a lot of choices during your journey.

Like this: 

To program this game I have made 3 lists: 1) Pictures     2) Narrations    3) Choices

But I dont understand how I can realise this scheme:
I waiting your solution :) 



What you are doing is trying to program an Adventure game.  Here are some hints:


A project in AI Classic (unfortunately you have to have a copy of AI on your PC to do this)  http://jlaasonen.me/2010/10/12/making-a-simple-adventure-game-with-app-inventor/  


The Classic Text Based Adventure game Hunt the Wumpus shown here may give you some ideas  http://www.codeproject.com/Articles/786118/Hunt-the-Wumpus
The example is in the Ruby language, the principles apply to AI2 too.  Be aware, this example is very involved.



You can do something much simplier using decision trees (if .. then statements in App Inventor).  images, and labels in different combinations.    Part of what you want to do would be similar to one of the Quiz tutorials here:  http://appinventor.mit.edu/explore/ai2/quizme.html  



To program this game I have made 3 lists: 1) Pictures     2) Narrations    3) Choices
the pictures and narration lists are simple lists, the choices list is a list of lists, each sublist has 2 items, the text for choice 1 and the text for choice 2
let me suggest to prepare a 4th list, which is again a list of lists and holds the index of the next item to go to

example, let's assume, the user selected choice 2, now get the corresponding index from the index list, then display the new image, narration and corresponding choices