2017년 1월 9일 월요일

App Inventor Updating


When you upload the .apk file to the google play store, does the apk file automatically update when something is changed in the app's coding or UI?

--
no, you have to upload a new version, just increment version code and version name
-- 
oo, thx
so its not possible if something is changed in the app 
for it to automatically update
like say u hav a announcements screen
if that is updated by the creator does that update throughout all apps?

-- 
please do not delete your question
the answers are not only for you, the answers are for everybody and without question answers do not help very much, do they? thank you

ike say u hav a announcements screen
if that is updated by the creator does that update throughout all apps?

instead of uploading a new version for each new announcement, use a server database to read your announcement without need to upload a new version of your app

-- 
im new to this so i didnt know

-- 

Connect the app inventor to an external database


Thanks, good morning, I need a help in mit app inventor2, I wonder if you would like it to make a tutorial with the following content: Connecting the inventor app 2 to a program database firebird? The program I'm ready, I'm not knowing how to create that bridge, wanted to create a check in app inventor, making him get the server information and display as the cell list. Type: list of registered patients or clients who did service in the last 7 days. Understood? I want to bring is query and display on mobile only this piece of information that is stored in the program database! If you tell me more or less as would be the way the cell to make information call the rest I can do here. I await your contact already thanks for listening.

--
where is that database running? on your web server?
probably you can adjust my MySQL interface to your needs https://puravidaapps.com/mysql.php

-- 
The server is a machine win server 2008 r2 that is networked with other machines, the program is local, networked wheel! At the moment I just want to list the contents of it on localhost via cell phone, then future plan to put the program online, but it will not be for now not. So my focus is being pull that information contained in the database and display a snippet in the cell, eg customer lists.

-- 
instead of localhost, you have to use the ip address of that computer
you will have to write a script similar to my php script for MySQL, which can be accessed from App Inventor

-- 
I made an account on the site:


to be able to have online access to my machine, I configured a fixed IP with port 80.

What is the next step now?

I saw your script for mysql, but I was in doubt because it needs a host and .php files in order to run the database.

In my case the bank is in the program, is SQL, but it is not the web, do not use phpmyadmin is the firebird.

How do I set this environment?

-- 
well, instead of a php script you have to write a script in a language of your choice (what is available there?), for example a batch script or VB script...
sorry, I can't help you with that

-- 

Error 401 Invalid Credentials on GOOGLE PLAY download but not with .apk on device


We are new to the AppInventor...so please excuse any gaps of common knowledge that there might be in asking this question.  I also already scanned the existing posts for possible solutions but the replies are not specific to our problem.

We used Taifun´s Oauth tutorial for Fusion Tables and successfully implemented an app that when transferred via .apk to an android device works!  A big shout-out to Taifun = )

However, after uploading the .apk to Google Play and then attempting to download it, the device that it was downloaded to started to receive the 401 Invalid Credentials message.

Can it be that the Oauth mehtod of authentication is not correct for use on Google Play downloads?
Do we now have to rewrite the app to use service accounts instead?

Thanks again for any help you can possibly send our way.  

--
some questions

1. did you use the login free access to let all users access your fusiontable?
2. did you store all required ids (client id, client secret and refresh token) inside the app?
3. concerning that device you get the problem now, did you test the apk on that device before uploading to Google Play? 
4. after downloading from Google Play, does it work on other devices?
5. when exactly do you get that error message? on Screen1 while receiving the access token?

Can it be that the Oauth mehtod of authentication is not correct for use on Google Play downloads?
no, of course you can upload the app the Google Play

Do we now have to rewrite the app to use service accounts instead?
no

-- 
Thank you for your time!

1.  Yes, we did​, as taken from one of your tutorials.
2. Yes, they are stored.
3. No, we have not, as we hoped it would work from google play.
4. No, we tried out 2, and it did not work.
5. The error happened at screen2, after the access token was received.

I hope we have understood your questions correctly.

-- 

TinyDB in multiple screens


We are creating an app that tracks the number of hours someone has volunteered. We have a TinyDB that stores the number of hours that one has volunteered. However, it goes back to the original value every time we change screens. The screenshot of the code is included as well as our aia file. 



-- 
you should switch screens correctly...

-- 

Error while sending message


Q. I0 error unable to create GV helper while sending message.
Q. How to send message to four people at the same time?

--
are you located in the United States?

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. 

-- 
Refer to gv helper app

gv helper app


Re: Unable to creat GV helper.
This requires that the Google Voice app must be installed and set up on the phone or tablet, with a Google Voice account. If GoogleVoiceEnabled is ...
16. 6. 17. 작성자: Taifun - 작성자 2명의 게시물 3개 16회 조회
text seding app not working.
i have build a simple text sending app using app inventor 2, but when i click the send button it shows IO Error : " unable to creat GV Helper " , please ...
14. 12. 20. 작성자: mohit baid - 작성자 3명의 게시물 6개 41회 조회
Re: Error: Unable to connect to Gvhelper.
i did as you said, but still got the message unable to activate GV helper. Please advice. and. Hi Steve,. Thanks for your quick reply. I have built the app ...
15. 3. 3. 작성자: SteveJG - 작성자 2명의 게시물 9개 234회 조회
Re: IO error: Unable to create GvHelper.
Google Voice Helper does not work outside the continental US and may not work within the US unless the helper app is loaded on your device. The problem ... The Google Voice option works only on phones that support Android 2.0 (Eclair) or higher. and should indicate that GV is only usable in the US.
15. 10. 22. 작성자: SteveJG - 작성자 3명의 게시물 4개 234회 조회
Problem with texting in MITapp inventor 2.
In mit app invertor 2 when we are trying to make an app with texting feature, the app text show an error . This is the error- IO: error unable to create GV helper. We even try to install google voice but the following model SAMSUNG ...
15. 2. 3. 작성자: girls for change team - 작성자 2명의 게시물 2개 310회 조회
I'm trying to send a sms to a specific number,
... send a specitic text message to a only phone number ( I dont need number picker) but the reply is always: IO errorunable to create GV helper thanks.
16. 11. 5. 작성자: luigi erbe - 작성자 2명의 게시물 2개 14회 조회

Getting the max of a column and displaying the row's value from another column


I'm trying to create an app which will select the highest value of column A and display the value of column B in that same row.

Is there a more efficient way to do this than to check every single value one by one?

--
SELECT B FROM <tableid> ORDER BY A DESC LIMIT 1

-- 
Thank you, but I think I must have missed something.

I have attached a block of my code. I wish to take the 3 highest values in the HITS column and display the NAME of those rows. For some reason, my result is just the first 3 names in my table, by order of rowid, not the value of HITS.


orderbyproblem.PNG 표시 중

-- 
your screenshot looks fine
you also can send a SELECT NAME, HITS FROM <tableid> ORDER BY HITS DESC LIMIT 3 to the table to find out, what's going on

-- 
Thank you so much! That fixed it. When I pulled the list of names it didn't order them unless I also pulled the numbers to order it by.

My only problem is that now I wish to remove certain items from the list.

The result I have from the fusion table is:

((Amanda catcher 25)(Marissa right 18)(Cara left 99))

What I'm trying to do is checking if any of the names appear in a label I'm using on the app. If the name appears then that person's information should be removed from the list, but when I do it, it says that I am trying to remove item with index 0.

listremovingproblem.PNG 표시 중

-- 
use Do it to debug your blocks, see also tip 4 here
and remember, you are working with a list of lists...

-- 
When I use Do it on the index in list block it gives me a zero but I know that the value of batter1.text appears in the list. Is this because that is not the only value in that row?

The value of batter1.Text is Gina, but the row with Gina is (Gina right 13).

-- 

how to stop webviewer from over-stretching in length as you follow links?


one page loads long then go to a shorter page and the webviewer component stays the length of the long page.... and you have a long long way to scroll back up or down the page to get out of the situation ....

--
Only thing I can think of is to fix the height of the WebViewer component and scroll the webpage inside the viewer? 

-- 

search results for listview jquery mobile


there is not much to customize. I only can offer my jQuery Mobile listview as workaround, see here for more information ...
you can't change the font size of the App Inventor listview. but this workaround can do it: Another Listpicker alternative with App Inventor and jQuery Mobile including a Search Filter! see also Q4 in the Questions and Answers section ...
Another Listpicker alternative with App Inventor and jQuery Mobile including a Search Filter! and yes, you can change the background color with ...
Another Listpicker alternative with App Inventor and jQuery Mobile including a Search Filter! In short, I would like a scrolling approach and wonder if it is in the pipe to add images to the ListView component? there is currently this ...
A message appears: "web page not available". Where it should be listview.html file? After it opened in the browser google can not see anything.
... How to use Activity Starter to view a Youtube video in full screen; my thumbnail listview might be interesting for you, see here. Another Listpicker alternative with App Inventor and jQuery Mobile including a Search Filter! Taifun.
... methods inside my html page. So how will I add/delete items from the list. Or is there any other way to change to looks of AppInventor ListView?
Actually we do not have to reinvent the wheel, therefore I suggested to take a look at the jQuery Mobile listview as an example, how it is done there ...
<link href="abrans.css" rel="stylesheet" />. <link href="jquery.mobile-1.4.0-rc.1. min.css" rel="stylesheet" />. <link href="animate.css" rel="stylesheet" />.
alternatively you can use this solution. Another Listpicker alternative with App Inventor and jQuery Mobile. and concerning multiple screens: ...
this might be interesting for you. Another Listpicker alternative with App Inventor and jQuery Mobile including a Search Filter! Taifun.
3) there opens a webview with php / html jquery mobile displaying the sections and their respective images ... to the User logged in, but the external listview will not know which User is logged in to be able to display the point on the page referring to section specifies it is a section of the external system.
probably one of the thumbnail listview example can help? Another Listpicker alternative with App Inventor and jQuery Mobile including a Search ...
something similar is possible with some HTML and jQuery Mobile, see the thumbnail split button list as example https://puravidaapps.com/listview.php.
unfortunately this is not possible with the built in components, but there the thumbnail listview, solution, see here. Another Listpicker alternative with App Inventor and jQuery Mobile including a Search Filter! and if possible by the ...
there is no such component in App Inventor available. the only solution is to use the already mentioned thumbnail listview. Another Listpicker alternative with App Inventor and jQuery Mobile including a Search Filter! Taifun.
... to a Fusion Tables Fusiontable. 2. the built-in listpicker is only for text, but you can use the thumbnail listview instead, see here for details. Another Listpicker alternative with App Inventor and jQuery Mobile including a Search Filter!


Set webstring "response" in dynamic javascript html


Been working around with the webstring property, generating a web page of images and setting the onclick property of each image with the webstring response e.g. onclick="javascript:window.AppInventor.setWebViewString( 'my response')

Have had success doing this with php:

$files = glob("signs/*.png");



for ($i=0; $i<count($files); $i++) {

//path to image

    $image = $files[$i];

    //strips path

    $fname =  substr($image, 6);
    //strips extension
    $sname = substr($fname, 0, -4);
    //for onclick
    $xname = "'" . $sname . "'";
    //displays all files and creates clickable link to video of the same name
    echo '<a href=# ><img src="'.$image .'" onclick="javascript:window.AppInventor.setWebViewString('.$xname .');" alt="sign image" /></a>'. "&nbsp;&nbsp;&nbsp;&nbsp;"; //."<br /><br />"
}

so if the image is called apple.png, when I click the image it returns "apple" to the appinventor app.

Now this is all good if my user has a web connection, but if they are out of range using php won't work.

Therefore I looked for a javascript solution which i could run locally on the device as a part of the app's assets.

This piece of code seems to do the trick, as long as the images (signs) folder is browseable:

<script type="text/javascript" language="javascript">

var folder = "signs/";



$.ajax({

    url : folder,

    success: function (data) {

        $(data).find("a").attr("href", function (i, val) {
            if( val.match(/\.(jpe?g|png|gif)$/) ) { 
                $("body").append( "<a href=# ><img src='"+ folder + val +"'>" );
            } 
        });
    }
});
</script>

But I have been unable to get the body append section to take the webstring "response" code in the same way as the php example, like so:

<script type="text/javascript" language="javascript">

var folder = "signs/";



$.ajax({

    url : folder,

    success: function (data) {

        $(data).find("a").attr("href", function (i, val) {
            if( val.match(/\.(jpe?g|png|gif)$/) ) { 
                $("body").append( "<a href=# ><img src='"+ folder + val +"' onclick="javascript:window.AppInventor.setWebViewString( + val +);"></a>" );
            } 
        });
    }
});
</script>

telling me I have a missing ) after the arguments list

I'm going wrong somewhere, can anyone help?

--
I apologize that I am not writing to help, but to ask how you have access to code? I have been trying to figure out if I can use App Inventor 2 and have access to write my own code, not be restricted to the blocks. 

-- 
April

The code I have posted is part of html or php pages accessed through the Webviewer component. The webviewer>webstring block allows interaction between the web page (local on device or on distant server) and the appinventor app/device.

Because I can't run php on the device, I need to use javascript.

-- 
Is there no-one with javascript guru-ness who can help with this?  Pleeaase :)

-- 
probably my tips how to test your html file outside of App Inventor can help? 
see here https://puravidaapps.com/listview.php#q
and in case you get this running, then you will be our JavaScript Guru...

-- 
Thanks for the encouragement Taifun ;)

After a heavy day on the keys yesterday (on AppInventor!), I awoke refreshed and decided to have another crack at resolving this.

If you refer to the example in the OP there is a line that is appended as html by the javascript. this is the one giving all the problems



$("body").append( "<a href=# ><img src='"+ folder + val +"' onclick="javascript:window.AppInventor.setWebViewString( + val +);"></a>" );


I know that this works (the original find on Stack Overflow:

$("body").append( "<img src='"+ folder + val +"'>" );

I also know that this works, including the <a> section:

$("body").append( "<a href=# ><img src='"+ folder + val +"'></a>" );

but  couldn't figure out why the onclick part refused to work. Had to break it down and iterate until I got there, hitting hard on the Stack Overflow servers, the answer is usually there somewhere, even if you have to interpret it!

The solution comes from the webViewString needing to be a "string", simply providing it with the variable 'val' was not enough, the output of 'val' needed to be in quotes.

So for this I created another variable with a collection of quotes and slashes:


myval = "\'"+val+"\'"

This then outputted the contents of 'val' with quotes around it.

Eventually, after a few other changes to single and double quotes here and there this is what I came up with:

AppInventor

With trepidation I loaded up Genymotion emulator and started up my simple test app, clicked on an image and "Hey Presto!" the name of the image in question appeared in the text box. (this is just for testing, I can now take this string and do things with it!)

I can't label myself as a javascript guru, but I did do a little dance :) Credit must go to the folks on Stack Overflow, steeped in knowledge and information. I didn't have to ask, just searches and browsing

Halfway there now, as I have to test this out locally on a tablet, to be sure the javascript will run without needing to be connected to the interweb, also to sort out the href so it stops jumping back to the top of the page.

This is looking like a useful solution for unknown numbers of images/items, cuts down the load on an app (no buttons or images required as assets) and should speed develop in other ways. I know there are some more sexy solution with jquery mobile but this works for me :)

Also made a little video if the thing in action on the emulator


-- 
Quick update

Fixed the href issue with

<ahref"javascript:;">

Bigger problem trying to run locally on device, though.   If I try to run locally on my linux pc my browser gets quite up set about security issues and cross site conflicts from jquery. On my tablet/emulator I just get a blank screen, either because of the same issue or because the images folder has to be "browseable" ? (had to create .htaccess file with options +indexes on my web server to get all this to run properly) Pretty certain my links and references are correct and i have the jquery-latest.min.js in the same folder as the html file.

Guessing that this won't work on a local device unless I run a web server on it. Oh well ;) 

-- 
generating a web page of images and setting the onclick property of each image with the webstring response

this should work, if you store the images in the assets of your app or alternatively in the internet. I don't think, you can access the file system from within the webviewer.
Also I'm not sure about the ajax part

-- 
I tried it with the html (js too) and image files as assets but the same blank page.

Also had a look in the jquery mobile stuff you sold me a while back, but no real clues in the html there either.

What about not allowing the webviewer to clear the cache unless there is an internet connection, would that allow use when there is not net connection?

Clutching at straws now, having spent the morning fishing in the dark :)

-- 
I now added an image listview example here https://puravidaapps.com/listview.php and also sent the project directly to you by email


What about not allowing the webviewer to clear the cache unless there is an internet connection, would that allow use when there is not net connection?

you always can use the webviewer, but there are some restrictions, for example as already mentioned, you can't access the file system

 image2.jpg

-- 
Good news, I believe I have a solution. Taifuns ListView stuff was very useful, but took me round the houses a bit, until i broke it all down and saw for a very basic working example I hardly needed any of it ;)

Once I had figured out I didn't need to do any uri encoding and decoding, and how to setup the "csv list" to move across as the webviewstring property, it all fell into place.

My examples use images and html file (along with the jquery file) installed as assets on the app for sharing purposes, the eventual aim is to load these separately on the sdcard. I also have some work to do on the css ;)

Here is the code for the webpage (ImageView.html):



<!DOCTYPE html>

<html>



<head>

 <meta name="author" content="puravidaapps.com">

 <meta charset="utf-8">

 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
 <script src="jquery-1.8.3.min.js"></script>
 <title>ImageView</title>

<style>
img {
width:100px;
height:100px;
}
</style>
</head>

<body>

  <script>
  $(document).ready(function() {
    
    var webString = window.AppInventor.getWebViewString().split(",");
    $.each( webString, function( index, val ) {
myextn = ".png";
myval = "\'"+val+"\'";
$("body").append($( '<a href="javascript:;"><img src='+ val + myextn +' onclick="window.AppInventor.setWebViewString('+ myval +')"></a>' ));
});
    });

  </script>

</body>

</html>

Yes, that is all ;)

Here are the blocks:

A view of the designer window


I'll just explain what is going on:
⦁ In Appinventor I create a list of filenames (without the file extension, which gets added later)
⦁ I then take this list, make into a csv row and create a string, stripping away all the "
⦁ This resultant string is then fed to the WebViewString block
⦁ At this point the WebView is blank
⦁ Clicking on the Home button in the app calls the ImageView,html page
⦁ The javascript picks up the webviewstring and splits it at the commas (,) thereby turning the variable into an array
⦁ This array is then fed into the remainder of the script, with a simple jquery for loop ($.each)
⦁ This takes each item in the array in turn, adds an extension, and creates a return webviewstring value
⦁ The web page is rendered and all the images from the list are displayed, they are <a href> clickable (so they blink) and on clicking an image the name of the image is returned to the app

I'm a cheerful rabbit, a jolly badger, and a dancing ferret all rolled into one :)

See also attached aia for anyone who is interested  
ImageView.aia

--
congratulations! keep up the good work!

-- 
Nice work, Tim!

--