2017년 5월 31일 수요일

Yandex Translate - how to translate full app


We're trying to make an app that a user selects the language before beginning and then the app is translated for the user throughout. 

Using Yandex Translate, here's what we did so far:

1. Set a variable called "global languageCode"
2. Created a Spinner to select the language with multiple languages listed
3. Called the Yandex Translate

How do we get that call to propagate to all pages?

--
generally use TinyDB to pass values between screens

but the question is, why do you need different screens?

Use different screens wisely
Before starting to create another screen, first you should think about is it really necessary? See also Building apps with many screens and SteveJG's post about advantages/disadvantagesbecause in only one screen you also can use vertical arrangements to simulate different screens, just set the arrangements to visible = true/false as needed... See also Martyn_HK's example about how to use Tabs in App Inventor and another example from Cyd.
The recommended method of switching screens in App Inventor
manager.aia
--

FAQ for TinyDB and Screens


Root Checker Extension v1


I'm excited to release my second extension: Root Checker
This extension allows you to:
⦁ check if phone is rooted
⦁ execute Shell commands
⦁ display executed commands' output
This extension unlocks a variety of new things and it can prove to be very useful for the community.
Please provide feedbacks. I have successfully tested on my friend's rooted phone.


(isRooted has been updated to IsRooted as suggested by @Taifun)
MORE FEATURES COMING SOON!
Download Extension
⦁ Version 2: RootChecker_v2.aix (6.8 KB)
⦁ Version 1: RootChecker_v1.aix (5.0 KB)
It's always good to be up-to-date with the latest extension. But I have provided download links for old versions as well.

Example
⦁ AIA (version 2): (will be available soon)
⦁ AIA (version 1): Root_v1.aia (6.6 KB)
Preview


For latest info and support about this extension, I'd encourage you to look here.

--
I have a mobile not rooteado, and it says to me that it is not rooted, so at the moment well, then I will probraré with one rooteado to see what happens

--
great to see you working on something useful now...
keep up the good work!

--
Would you help me with my code?

I'm trying to make an extension which executes shell commands. I'm stuck at common Java errors which I can't figure out.

--
In the rooteado if I get that it is rooted, so it works !!
Thank you for your contribution!

--
Would you help me with my code?
sure
if I know the answer... ;-)

for question about working with the App Inventor sources please ask in the Open Source group here https://groups.google.com/forum/#!forum/app-inventor-open-source-dev

--
@Pavitra: App Inventor uses some naming conventions, see also the document How to add a Component, which is the camel case notation, see also https://en.wikipedia.org/wiki/Camel_case

for Properties, methods and events, UpperCamelCase is used
for input parameter lowerCamelCase is used

example:
which means, if you like to follow these standards (which is the recommendation), then the correct method name would be IsRooted (first letter = capital letter)

and if you want to provide a more complete method to check if the device is rooted, then you might want to take a look at these stackoverflow answers Determine if running on a rooted device ...

--
Thanks @Taifun for informing me that. I have updated my extension and also added "Execute Shell commands" method and event.

--
Is the version in your first post current?

I tried it in the stock AI2 emulator and it said it was rooted,
but no shell commands came back with results.

See attached. 




--
@Taifun suggested me to run "Execute" method asynchronously, so I've been working on it to fix this.

--
@ABG I just built the new extension v3 for testing. Would you like test it? http://community.thunkable.com/t/testers-needed-for-root-checker-extension/1680?u=pavi2410

--
I tried a few user level commands in the stock AI2 emulator ...

ls  works, but I find it really bare bones (no -? or -al option from my unix days); I had to add slashes at the end of its directory names to go further down them. i.e.
ls sdcard/Appinventor/assets/  to see my Companion cruft in the emulator.  No file attributes, no create or modify dates.  But still usable.

date works.  

cat works on txt files, to standard output.

rm works.

No wild cards are accepted.

No error message output.
No error codes.

su       gave no response
su ls   gave no response.

To summarize, at the minimum there's enough here to write a directory explorer and cleanup utility.





--
If you are extending the functionality of this, consider adding two more outputs to the event,
in addition to the commandOutput:

errorCode  (0 = okay, other = error)
errorOutput  (secondary output stream of error text)

(This is based on my experience with unix shells.  I don't know if Android supplies these.)

--
Thanks @ABG for pointing out the errors.

As a Windows user, I do not know much about Linux commands. I only know what codecademy.com taught me - just the basics. So, I did not test it completely. I will try to implement the things you suggested.

--

How to Create A Root Checker App in MIT & How to make app that requires Root.


I want some Help in creating app to Check Root permission in MIT & How to make app that requires Root Permission.

--
try Pavrita's extension here Root Checker Extension v1

-- 
Thanks For your help.
Can you tell me that I am making a app wps pin tester and I want to know that how can I find that the router is wps enabled and how to Check pins on the particular router.



--
there are no such methods available in App Inventor
you could write your own extension and create a block yourself...

more information about how to create an extension see the App Inventor Extensions document
however that will be more advanced and will require some Java skills...

--

QR Code Reader Error


i want to ask why to make QR Code Reader Apps i always got this error when try to run the apps on my handphone

 ->error 1501 your device does not have a scanning application installed

Do i still have to install XZing Barcode Scanner ? Like this tutorial 

--
uncheck the UseExternalScanner property


--

2017년 5월 30일 화요일

navigator GPS


Hello there is a way to create a gps navigator like Waze or google maps?

--
There are many ways to use App Inventor along with the Google Map API.  The techniques can be adapted to mage your gps Navigator..  Here are some basic tutorials

Android, Where's My Car? for App Inventor 2
You parked somewhere near the stadium, but when the concert ends you don't have a clue where the car is. Fortunately you haven't lost your Android phone that never forgets anything, and you remember you have the hot new app, Android, Where's My Car?. With this app, you click a button when you park your car, and the Android uses its location sensor to record the car's GPS coordinates and address. Later, when you reopen the app, it shows you a map from where you are to the remembered location-- problem solved! With this tutorial you'll be able to download a created app and then study the annotated blocks below to better understand the app and App Inventor programming in general. This app covers: GPS, TinyDB, and using Activity Starter to open a map.

Map It: Displaying Locations on a Google Map
This tutorial shows how you can develop an app that allows you to record list of addresses and view the address on the Google Maps. It will also show you how view your current location on the Google Map.

Exploring with Location Sensor in AI2
The location sensor object is used to communicate with the global positioning satellite receiver (GPS) in your phone/tablet. When the LocationSensor communicates with the built-in GPS receiver, the GPS can determine the location of your device.  The sensor can also work with network/wifi location services.  Finding a location using the network uses very different techniques to determine a location. Location means, the device's present latitude and longitude or it can mean your street address.

Have you tried any of these tutorials Nando?

or very simply you could use ActivityStarter to navigate  as shown above if you turn your GPS on and allow LocationServices.


-- 

HELLO STEVE THANK YOU VERY MUCH FOR YOUR SO QUICK RESPONSE, WHAT YOU INDICATED ME HAS ALREADY DONE IN MY PROJECT HE MARK DOTS ON MAP AND USA ActivityStarter TO CALL A NATIVE GOOGLE BROWSER, WHAT I LOOK FOR IS A WAY TO CREATE MY PROPERTY BROWSER, LIKE THE WAZE FOR EXAMPLE.

-- 
Sorry.  I do not understand exactly what you want to do.  Your image posted is from WAZE.  What do you mean 'property browser?'

If you want to show  many different locations, use a Google Map API Static Map with multiple pins https://developers.google.com/maps/documentation/static-maps/intro#quick_example .  These examples can be replicated with AI2.

If you want a traffic layer use JavaScript to display https://developers.google.com/maps/documentation/javascript/examples/layer-traffic  

Here are other links:




Google has a Business Map API...perhaps that is what you are interested in?

Provide a better description of exactly what you want to do Nando and someone will provide more advice.  It appears you may already have created a StaticMap with pins using google.   You can do something similar using OSM.

Perhaps find the articles     
How to start OsmAnd and open the map with a place marker and  How to launch Waze to look for a specified location   described on Taifun's snippets http://puravidaapps.com/snippets.php 

-- 

Running AI2 in the badkground


I have seen some post over a year ago about the proposal.  Any updates on this subject?

--
Bad-k-ground: nice typo!
Everybody thinks it will be this this year... Keep your fingers crossed!

-- 

Duration format hh:mm:ss


do you know how to display duration between two instants in format HH:MM:SS?
For example 00:01:14
0 hours
1 minutes
14 seconds
?

--
I don't remember exactly how to do that but I think it is easy to do using timepicker component. A few time ago I found a very good example on the gallery, search for timepicker there and you will probably find it.

When I arrive home I can give you a hand if you don't succeed.

--
Please give me a hand ;)

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

--
here is a solution, it's a little bit complicated, probably someone comes up with a simpler solution...

--
I do not know whether it is simpler. In any case, it is different. 
From my count-down-to-2016 in the gallery, http://ai2.appinventor.mit.edu/#6702056039776256
Here is the relevant procedure:
--
BTW could you recommend any tutorial pertaining to clock duration thing? I mean I wanna make a timer with no variables.

--

time interval


I want to build an application simple enough as an accountant working overtime
I put two time picker, and I want the app to give me the time interval between them
Because the distribution of hours and minutes I keep getting an error of the abnormal data

I tried to look the forum and the network and did not find a solution .... I will be happy for any ideas

-- 

use Do it to debug your blocks, see also tip 4 here

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.

--


The whole thing is not as easy as it sounds and to calculate durations is quite hard. Therefore I spent my lazy sunday afternoon with making a little app.
Things to note: you do not want to have the app at the foreground while you are working overtime. Therefore the start time is stored in a TinyDB. If you do overtime again you must clear this time first.
The calculation of the duration in hours and minutes subtracts an hour. I cannot really explain it. It has something to do that your time will be in january 1970, but it works fine this way. I attached an .aia too.

--

this is other code, withclock and withoutclock

withoutclock you can use

--
That is a very nice solution!
In practice you still need a TinyDB though, because you do not want to loose the start time if the user closes the app while doing overtime.

--
@Juan, also take care not to work past midnight.
(Been there, done that).

--
OK Abraham, but user asks "put two time picker, and I want the app to give me the time interval between them", only difference beetween 2 TimePicker, not Date. This is only an example code.

--

I want make Overtime check in and check out app.!


I want make Overtime Check in and Check out application for my fellow co-works?

--
Maybe this thread can help you: time interval

-- 

TinyDB storage questions


When you store a list in a tag in tinyDB, when the app is reopened, is tinyDB tag's value still a list?  Can you add items to the list by using the add items to list block, the list being the call tinyDB.GetValue tag block?  I think that works, but I'm not sure.

--
Yes, the TinyDB values are persistent and will be available every time user starts the app.

Checkout my tutorial on list and tinydb here: https://amerkashi.wordpress.com/2014/05/12/lists/

-- 

How to program an interval between 2 sounds?


I need to put 2 sounds in sequence. When sound 1 finishes, sound 2 initiates. 

--
Do you know the length in time of the first sound? If you do you can start a clock when the first sound starts playing. Let's say the first sound is 5 seconds, then make a clock with 5000 ms and play the sound in the timer event. when the 2nd sound is played, disable  the clock.

-- 

-- 

Instantiate dynamic number of image objects


I am creating an app that connects to a server to display a bunch of images.
The problem is I don't know how many pictures will need to be displayed.
Therefore I need to create the image object in the code and add it to a table arrangement. How do you create a new image object through code?

--
App Inventor can't create components at runtime (dynamically) You have to pre-place everything you are going to use and be creative on how to use use it.
In this case, you can place 5 or 10 components and make them visible only if you need them. If you need more, then consider ceating a paging system, where you show 10 at a time, and the user touches a PREVIOUS and NEXT button to access the other.
Then you reuse the same 10 image component over and over.

-- 

canvas


Put on a background the image of good quality (city map), it is important to me. But with an increase in the application, it turned out that the quality is spoiled, and the pixels appear blurred. What to do?

--
1) If you used a jpg map image, try using a png image instead.   Png images behave better when magnified or reduced in scale.
2)  If the background map image is large (perhaps 2000 x 2000 pixels) and you place it in a Canvas that may be 320 x 480 pixels, does that make much sense?  AI2 can reduce images in size, however the algorithm may blur when the reduction or magnification are large.

This article might help 


Wonderful you have a quality map image, but you may need to reduce it in size to get the background image on your device to be sharp.

-- 

Blocks Editor Duplicate Issue


Hello, The block editor duplicates since the latest update when inserting always the blocks 20 times

--
Same issue here.

-- 
Here are some questions that your answers might help us pinpoint the issue:

Does this happen every time you drag a block? Or only from the drawer/backpack? Is it a specific block type or every block?

--
Same issue here.
Also if i want to use a mathematical function, it appears on the screen but i cannot move it.

-- 
@ Leon ... how about an example.  I cannot reproduce what you are doing ... I can move math functions anywhere.

@ Radu ... same what issue?

@ Janik  I duplicated more than 20 times with now issues

Developers, please provide a better explanation of the problem you see and post an small Project aia that demonstrates what is happening. PLEASE answer Evan's questions.
Here is another question.  Are you using the English language version of AI or one another language?

So far, no one I am aware can reproduce anything like what you guys are describing so an example would be appreciated.

-- 
I was just able to reproduce this Evan.



go to Sprite1, drag the block to the lower left corner of the blocks editor screen.... instead of bringing one copy of Sprite1,   I get dozens.   Se the number of yellow 'errors;

--
I can't seem to replicate this on Mac OS X 10.12.5 with Chrome 58.0.3029.110. Can you record a video of it happening and send it to me, just in case I'm not understanding the correct sequence of actions? I'll try to procure a Windows machine as well.

-- 
Sri, no can do a video.    The problem is not as reproducible as I thought.  It happens and if I were working on a critical project, boy would I be frustrated because it takes awhile to undo the damage.

I suspect it has to do with holding a mouse button during a drag on my Win10 box.    I will try to see (using a clean Project) whether I can get the effect to reproduce on demand.

-- 
Oh no, got another problem.  While researching the duplicate object creation   I get this

The circled block can move around in the advice message when moved by the mouse but it cannot leave that area.    Neither of the two buttons can be clicked.  To exit, I had to close AI.

-- 
That one I can reproduce. We will get a fix out over the weekend for that.

--
I send  trial i just made.
I made an aia after removing about 200 doubles.
The last one ( to fetch the time ) is not movable.
Maybe this will help


-- 
We have released nb156a that contains code to mitigate this issue. Unfortunately you will still need to delete the extra blocks but it should stop this from happening again in the future. If you continue to have problems once the problematic blocks are gone please let me know as soon as possible. We will continue to monitor the situation.

--
I got one of these developing my phone_scraper blocks just now.

My trackball is very bouncy, FYI.
I also work with buttons reversed, using my left hand.

A textbox.Text block fell off my drag before it could clear the
textbox component blocks pallete and landed with a couple of dozen
bouncy copies.  Strangely, they did not score yellow flags.

Eventually I was able to clear them by dragging my viewport away.

This was AFTER the fix mentioned in the release notes.

-- 
Easy way to clear the repetitive copies of a control spawned with release 156

Left click on the offending block.  Then hit the Delete key.  Keep deleting until the 50 or 60 or 80 so copies disappear.

Yes 156a did not fix the issue.   Evan says he has some more ideas to clear this bug.

--