2016년 12월 15일 목요일

Please let AI create app-speific folder on the MicroSD at app install time


Android version 4.4 and above does not allow applications you install to write to user-installed MicroSD cardsQuoted from here:

The WRITE_EXTERNAL_STORAGE permission must only grant write access to the primary external storage on a device. Apps must not be allowed to write to secondary external storage devices, except in their package-specific directories as allowed by synthesized permissions. Restricting writes in this way ensures the system can clean up files when applications are uninstalled.

 So still there is a way for the app to write on the MicroSd, but it should be on the package-specific directory.Namely it should be inside the folders:


Normally the folder /Android/data/ is created on the MicroSD card by Android at app install time. But if for some reason the folder doesn't exist in your device, you need to use a system file managerapp to create it. App itself can write inside this folder but it doesn't have the permission to create it.

I checked the apps created by AI and it seems it does not create app-specific directory inside the data or the obb folders in the MicroSd. Even not all playstore apps are creating such app-specific directories in the MicroSd. It seems there is some way to do this at installation time.

I ask the gurus here, how to let the app create these folders in the MicroSd at instalation? Is there any manifest editing required to do so? Any chance that the creators of AI will include this capability in future releases?

Without this app-specific folders created at installation time, the microSd is almost useless for all AI created apps for Kitkat and above!

--
Maybe one of the file extensions can help?
See the extensions section of this FAQ:

-- 
Nope. Did not find any.. Thanks for trying to help though :)

-- 
I can create folder by saving a tiny canvas specifying the whole path and deleting the png after.

Please check these search results I got when searching on the forum for "create folder"

https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!searchin/mitappinventortest/create$20folder%7Csort:relevance

Is this what you need?

-- 
This would work for me too if my path is referring to sdcard which is the internal memory. 

My issue is for the removable secondary storage which some call it external storage (removable MicroSD card). Kitkat and above does not allow to create the folder inside MicroSD card. Unless I create the folder manually in the same name of my package name and inside /Android/data folder of the MicroSd card. The path is for my Gnote3 should be like this:

file:///mnt/extSdCard/Android/data/appinventor.ai_abc.xyz/

the blue folder name cannot be created unless I create it manually!

There is someway to create this app-specific folder in the removable storage (extSdCard) at installation time. How can we achieve this? Without it,  ALL AI applications cannot use the external Sdcard.

-- 

I think you may have missed Italo's point. The search results he linked to indicate a potential solution to your problem. Specifically, the Canvas.SaveAs function will attempt to create every directory on the path you give a file name (via FileUtil.getExternalFile). You can use this mechanism to create the appropriately named directory programmatically in your app. Simply do this before you attempt to write other content to the intended directory.



-- 
I really wished you were right!

Have a look on the attached aia file. And below is a picture too.

I tried this as below, and it did not create the folder in the external SD card (the removable SD card). If you want to try it, you have to modify the path to your External removable SDcard path of your device (because it is device specific; mine was Galaxy S5 Android 6.0.1) . You can find the path of your external sd card in any file manager program in your phone.

The statement of Android documentation is clear that creating a folder in the external removable storage is not permitted UNLESS the folder created at installation time:

The WRITE_EXTERNAL_STORAGE permission must only grant write access to the primary external storage on a device. Apps must not be allowed to write to secondary external storage devices, except in their package-specific directories as allowed by synthesized permissions. Restricting writes in this way ensures the system can clean up files when applications are uninstalled.

  App itself can write inside this folder but it doesn't have the permission to create it.


-- 
For my above example, it seems that the save as for the canvas do not use absolute path. the path:

file:///storage/.....

will be treated as a relative path, and it will create a folder named "file:" inside the internal storage, instead of using the absolute path to write to the external secondary removable SdCard storage. However, extensions like the Taifun File extension can use such full absolute paths without problem. For example that same path above can be used to read an image into the canvas from the external storage. But it fails to write to the external storage using the same path. It will fails to create such folders inside the external storage, but able to write such folders inside the internal sdcard storage if I give it  full absolute path to the internal sdcard storage.

I don't know how to use absolute path with the save as for the canvas in order to be able to write or read from the external storage in the above example. But as I said, in the Taifun extension it will give me a permission error to create any folder in the external secondary storage, but without any problem if the path was the full absolute path to the internal storage.


-- 
I received this link from Jeff, probably we can add this into the file extension...
I will check and will let you know soon... 

I did some Googling about this and found this URL:



-- 

GIF ANIMATION


there are some weakness in this compiler for example :
1- GIF animated file can not be loaded on the phone  

if anyone have a good suggestion i will be happy to hear that 

--
Please use the search box on top of this forum page before starting a thread. There's a lot of user who asked these common questions before and the answers are always the same.

These are the results of searching for  "gif animation"



-- 

Lire un fichier PDF avec une application App Inventor (Read a PDF with App Inventor app)


Hello everyone. I am new to programming the application, and therefore new in programming with App inventor 2. I have a big problem and is counting on you to help me. For our Christmas leave draft, he was asked to create an application with App Inventor that reads PDF file saved in a database which can be updated file. My problem is the code that retrieves a file in the database and open it with a PDF reader. Please help me.

-- 
Hi, if you are new to programming, there are many tutorials (all in English!) In this free book (they are PDFs file too!):

I think for Vorte implementation there is a need for a TinyDB or TinyWebDB for your basic data and a ActivityStarter for your PDF reader to open.

-- 
How to view a pdf document

Pdf Extension to open pdf files and render a specific page (without using an external app).

-- 
Thanks for the link. My app works nicely.

--

Send a bluetooth-signal from a second screen


I have an App Inventor programm with 2 screens. From the first screen I send BT-signals and it works well. Now I want to send other BT-signals to the same source from the screen two by click on an button. How can I put a relation to the BT- component defined as a Non-Visible-Component on screen one?

-- 
use only one screen, else for bluetooth you have to reconnect in other screens, which does not make much sense

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 AppInventor and another example from Cyd

-- 
thanks for your important hints. It were new information for me and this is a sentence I read at one of the links:

All this, of course, comes at the price of increased program complexity in the blocks that handle the view switching -- it’s much simpler to add a new screen for each new view and not have to worry about view switching logic.  You can work that way for small numbers of screens. 

My App will only get 2 screens and I would like to learn the procedure to realise my question.
So it would be nice, if you tell me something to this solution.


-- 
As far as I know, BT only works from Screen1

-- 
This is very simple Freddy.  The Bluetooth component will work correctly only from ONE screen.  If a developer uses multiple screens and uses Bluetooth to control a device from screen A and the app switches to screen B, the app will lose the Bluetooth pairing connection.  This is the way the AI2 Bluetooth object works.  All Developers must program around this limitation if they do not want to lose a connection.  The programming SOLUTION is to not use multiple screens if your app uses a Bluetooth connection.  You are correct that switching screens can work efficiently for a small number of screens if a developer does not use the Bluetooth component or is willing to pass data between screens using a TinyDB.

-- 

Latest Mac setup tools deploy outdated companion


The latest Mac setup tools deploy emulator with outdated companion code.  Cannot update companion code with autoupdate because AppInventor will not connect to the emulator...because the companion code is too old.  Unless there is some trick with downloading the apk and installing it in the emulator somehow, which I see zero information on doing, this is dead in the water.

-- 
Solved it.  

# Fix outdated AI Companion for MIT AppInventor 2 on MacOS
# After install of latest setup tools, download AI2 Companion apk
# Ensure path to adb is set, or command is aliased, (or use full path, etc)

: export PATH=$PATH:/Applications/AppInventor/commands-for-Appinventor
: adb -e install -r ~/Downloads/MITAI2Companion.apk
1876 KB/s (3828897 bytes in 1.992s)
        pkg: /data/local/tmp/MITAI2Companion.apk
Success
rm failed for -f, Read-only file system

# not sure what it tried to delete; but please don't use rm -f!

# Restart emulator from AppInventor
# Reconnect and you're good to go
~                                

-- 


Re: Moving Silver AIA to Gold?


Did not import my silver project, I have an important project to import but gold gives a bug and says that it is not compatible

-- 
If you are importing a Silver app that has Vertical or Horizontal Scroll Arrangements, it will throw an error on import. You need save as in Silver and edit that copy first, to get rid of VSA or HSA. Then export and import.

-- 
I need another solution because I have 13 horinzontal or vertical layout, because the menu I made in layout and the transition of screens too, because not to pter that change the package name outside of appybuild I made the screens in layout using visible and visible visible False, it's all on one screen only the transition is by layout, everything I have is inside the layouts


-- 
It may be better to keep your app in SILVER instead of importing into GOLD


--
Let me know, can I access both? Because in the future I will write a new version in gold, because I found it interesting because I have some application that I can not import in silver made in the app inventor mit that the gold imported, so I am using both for now

-- 
Mainly now I have 800 user yet and 30% use daily but I had problem with admob, and I have to change the name of the application package to return to display ads


-- 
I always mention Appybuild for friends.


-- 
I just had a doubt, I have a xxx.yyy.xxx package in silverand I change it to xxx.yyyy, but the question is when I write it in gold with the name xxx.yyyy can I upgrade my app in the playstore? I know I need to import the key from silver to gold, have I already done a test updating the app made in silver and updating the same made in gold?


-- 

Moving Silver AIA to Gold?


Is there any word yet on moving current Silver apps to Gold? Or a conversion app to all the move?

-- 
You can export all, but import one by one

-- 
Ok, thanks.

-- 

Include my app in the sharing apps list


Is there a way to include my app in the sharing apps list? For example, when you are in the gallery and want to share a picture, you click share, then a bunch of apps appear at the bottom. Is there a way to include my app?


--
you can try to set an intent filter in the manifest of your app, see this snippet http://stackoverflow.com/a/5097734/1545993

to modify the manifest, you can use 

in case you get it running, you might want to provide a description of what exactly needs to be done

-- 
Can an extension be made for this instead of modifying the manifest manually?

Like for an example, if the user is in the gallery, the user can share a photo, then choose my app. When the app opens, it knows that a photo has been sent to the app then do something with it.

-- 

Can an extension be made for this instead of modifying the manifest manually?
currently not, because extensions can't modify the manifest, only permissions can be added, nothing else...


-- 
Thanks to work by William Byrne this should be possible as an extension in the next companion release. Ref: https://github.com/mit-cml/appinventor-sources/commit/c976f01e1431525a54449c0e1dfcc1c16917d309

--

@MindBlown


--