In case you are curious how the parse procedure looks like, here you are ;-)
Note: with the extension feature, this workaround is now obsolete. Thank you MIT!
Now you can use my Telephony Manager Extension instead.
This example provides the device specific info Android Version, Language and Device type
using an embedded HTML/JavaScript document which supplies some info from the Navigator object.
The HTML file info.html is uploaded as asset to App Inventor.
There is one special thing to consider for HTML documents uploaded as assets into App Inventor:
During development, you have to use the development path to the embedded HTML document.
file:///mnt/sdcard/AppInventor/assets/info.html
Before packaging the app, use the production path.
file:///android_asset/info.html
You probably also might be interested in the example How to get the Device ID within App Inventor calling a Java app
and How to get the Phone Number of the Device with App Inventor .
Note: Andrea found an alternative way to detect the language of a device with the text-to-speach component,
how it works, see here. Thank you Andrea!
For newer Android versions, the navigator.appVersion object does not provide the language anymore.
I therefore added an if statement in the logic and read the language from the navigator.language object for newer Android versions now.
A screenshot of the parse procedure you can find here
<!doctype html> <head> <meta name="author" content="puravidaapps.com"> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Info</title> </head> <body>
<script type="text/javascript">
// print the result to the page title
window.document.title = navigator.appVersion + ";language=" + navigator.language;
</script>
</body> </html>
Q1: I have a problem with the select list item block. When I first time open the my app I see a error message
"Select list item: Attempt to get item number 2 of a list of length 1".
A: try to add an else if length of list get listResult > 2 statement.
Q2: Both, file:///android_asset/info.html and file:///mnt/sdcard/AppInventor/assets/info.html don't exist, what can I do now?
A: You have to upload a file called info.html as asset into App Inventor for this to work. You can create the file info.html
from my example or you can create it yourself (see chapter HTML/JavaScript above).
Tested successfully on HTC Desire running Android 2.2, Samsung Galaxy Tab 10.1N running Android 3.2 and Nexus 5 running Android 5.0.1.
Developing and maintaining snippets, tutorials and extensions for App Inventor takes a lot of time.
I hope it saved some of your time. If yes, then you might consider to donate a small amount!
or donate some mBTC to Address:
1Jd8kXLHu2Vkuhi15TWHiQm4uE9AGPYxi8
Thank you! Taifun
Download aia file for App Inventor
Back to top of page ...
This work by Pura Vida Apps
is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
with attribution (name=Pura Vida Apps and link to the source site) required.