App Reference, Check LIcense, ads

195 views
Skip to first unread message

Alan Hendry

unread,
Aug 13, 2020, 9:20:05 AM8/13/20
to DroidScript
Hi,

A few more things in the App Reference ...

I was just trying to run Examples in App Reference (ChooseFile, ChooseImage, etc) but was just getting a black screen. (Not sure if it's relevant hat Chrome had been updated). Closing DS app and re-starting seemed to clear the problem.

If the phone doesn't have an extra memory card installed, I presume GetExternalFolder returns null. Ditto for ChooseFile, ChooseIamge, etc if not found.

Reference for GetExternalFolder has the word "smth" - probably something.

GetMediaFile reference says "media file be like" and
"The folder to that file will be created automatically"

Example for Get Data - Random Value gives error btn_OnTouch is not defined.

Check License ...

The app Reference doesn't seem to give much detail on CheckLicense.
The wiki says 'pass in the long key which can be found in the “Services and API's” section of the developer console.' Not sure where that is. 

Ads ...

The wiki seems to document concerns with LeadBolt ads.
I tried to sign up with Admob (Google) but get message
"... you cannot use AdMob at this time".
Anyone got any advice/examples?

Regards, ah

Symbroson

unread,
Aug 13, 2020, 9:55:38 AM8/13/20
to DroidScript
thanks for the reference notes - i'll look into it. you'll see the changes tomorrow on symdstools.github.io/Docs or in the DocsPreview tool

Symbroson

unread,
Aug 13, 2020, 3:35:07 PM8/13/20
to DroidScript
as long as the samples swork again I assume its a random bug. If you can't reproduce it its not worth looking into it

GetExternalFolder returns an empty string if not existant (which can be interpreted as false similar to 0 in javascript)

Not sure what your problem with "The folder to that file will be created automatically" is, but i've rephrased it anyway

The key is located in the GPlay Developer console - you should know the console if you've uploaded an apk to the PlayStore yet

I don't know which wiki you're referring to - The inofficial wiki doesn't have CreateAdView documented at all, and the premium sample and the official documentation describe AdMob use.

In any case I don't know what the error you describe means or how to fix it
Check out the links in the CreateAdView docs

Alan Hendry

unread,
Aug 14, 2020, 5:18:55 AM8/14/20
to DroidScript
Hi,
I suspect that I applied a Chrome update while DS was open. I don't know if that caused the problem. Restarting the app fixed it.
Not sure why GetMedia would create a folder.
Soz, I was looking for  developer console in the app.
Hmm, I can't seem to find the page on the wiki or group (it mentioned problems with Leadbolt).
I have two Google Accounts (work and personal) but Admob gives the same message, and it isn't covered by the online help.
I was hoping for anyone's experience on setting up (Admob, Leadbolt, other), income, etc 
Regards, ah

Alan Hendry

unread,
Aug 17, 2020, 8:58:54 AM8/17/20
to DroidScript
Hi,

(to repeat)  Not sure why GetMediaFile would need to create a folder.

T(key,language) seems to exist (non-premium). I've set up a lang.json file outside of DS. 
When I ry to add any Asset  it doesn't seem to work. 
(3rd icon in bottom row of Edit, then + button, find file, tap it or long press file ticked and touch Open).
Same for lang.json, jpg, jpeg, pdf.  

Some phones now advertise as having 3 cameras. GetCameraCount() can get number of cameras. 
CreateCameraView seems to support Front and Back (omit option Front) only.

The app reference states that spinner onchange receives item and index, and checkbox ontouch gets checked (true/false).
Does button ontouch get a value passed? If not, then I presume I can this.GetText() for example.

Regards, ah

Symbroson

unread,
Aug 17, 2020, 11:37:59 AM8/17/20
to DroidScript
Because the media file location is standardized on android. If the folder would not exist but still returns the file path you won't be able to save to that file because the path is invalid

btn.ontouch dont accepts arguments as the docs say. this.GetText will work or set a this.data.myvalue on the control

Alan Hendry

unread,
Aug 18, 2020, 4:40:29 AM8/18/20
to DroidScript
Symbroson,

Not sure we're on the same wavelength (or modulation or encoding).
As far as I can see GetMediaFile is given a File Name and Extension, and returns the path for that file.
So I don't see why it would ever create a folder,  but the app reference says ""The folder to that file will be created automatically".

I'm not very good with objects. 
I think you mean I can set an additional property for the text object (possibly in a loop setting a count in the property)
textobject.data.myvalue = 4 (or  = i where i is a loop counter)
then (use one ontouch function for multiple text objects) and check which one was touched
if (this.data.myvalue == 4) ... 

I note that ontouch for an image passes an event, of which the first value is an app object. 
I presume we could add a property as above or use SetName and GetName

Regards, ah

Steve Garman

unread,
Aug 18, 2020, 5:07:07 AM8/18/20
to DroidScript
@Alan
The polite behaviour for any Android app to store pictures of its own is to create a subfolder (named after the app) in the standard Pictures folder.

GetMediaFile specifies a file name which you provide, a sortable string of the current date-time and the extension which you provide.

The folder included in the full file path returned includes the appname but if you try to write to that folder and it does not exist, the write will fail.

So when you indicate to DroidScript that you are going to need that folder (by using GetMediaFile) DroidScript ensures that it exists.

Alan Hendry

unread,
Aug 18, 2020, 9:06:09 AM8/18/20
to DroidScript
@Anyone,
I still can't get Add Asset to work (in the App, Edit screen, 3rd icon at bottom, click plus, find file, tap it or long press and Open)
@Steve, thanks for the explanation.
Still not sure that I understand what GetMediaFile does. 
The more I look at it, the more confused I get.
If I run the app reference example I believe it looks for file "Hello World" with extension ".png.".
It returns /storage/emulated/0/Pictures/Hello World/20200818_133735040.png.
emulated/0 seems to be a reference (a bit like a Windows shortcut), then PIctures,
then Hello World (presumably the app name written in DS), then the current date and time (?), and extension.
In File Manager, Internal Storage, Pictures, Hello World I see no items (is this related to GetPrivateFolder?)
Or in Internal Storage, Droidscript, Hello World, Img I see Hello World.png.
From your explanation if folder /storage/emulated/0/Pictures/Hello World didn't exist then it would create it.
Is it possible for two Hello World.png to be out there? If so then what does GetMediaFiles return?
Is it copying Hello World.png to 20200818_133735040.png?
I tried using the string returned in CreateImage, but it doesn't seem to work.
Regards, ah


Symbroson

unread,
Aug 18, 2020, 10:10:40 AM8/18/20
to DroidScript
at that point I'm not sure if you understand what a file system is and how they work. Are you a main apple user or do you just have a smartphone and no desktop PC?

/storage/emulated/0 is the android home directory. /sdcard/ is just a soft link to that folder

then Hello World (presumably the app name written in DS), then the current date and time (?), and extension.
that is correct, although you can choose any folder you want as you can specify the name as first argument
https://symdstools.github.io/Docs/docs/app/GetMediaFile.htm if you didn't check that out already which would be very disappointing

In File Manager, Internal Storage, Pictures, Hello World I see no items (is this related to GetPrivateFolder?)
Of course not - it just returns the file path - it doesnt create the file. You can use the returned path to save a file to it

Or in Internal Storage, Droidscript, Hello World, Img I see Hello World.png.
that has nothing to do with GetMediaFile - Thats the DroidScript project directory

From your explanation if folder /storage/emulated/0/Pictures/Hello World didn't exist then it would create it.
almost - in the best case it will create the directory "Pictures/FOLDERNAME/DATE" recursively
that means if any parent directory of "Pictures/FOLDERNAME/DATE"is missing it will create that first too

Is it possible for two Hello World.png to be out there? If so then what does GetMediaFiles return?
That question doesn't make any sense. Did you never work with file systems before?
Of course you can have A/B/HelloWorld.png and A/C/HelloWorld.png as two separate files.
FileSystems are basically tree structures and of course you can have identical nodes but only in different locations and thats why they're still different files

Is it copying Hello World.png to 20200818_133735040.png?
No, again GetMediaFile has nothing to do with copying files - it even is completely unrelated to anything of DroidScript

I tried using the string returned in CreateImage, but it doesn't seem to work.
Because your are supposed to WRITE files TO it - you cannot read from an invalid file path.
Again GetMediaFile just creates the parent folders and returns the file path which you can use later on to write files to that path - It does not create any file itself or even write to it

Alan Hendry

unread,
Aug 18, 2020, 11:12:04 AM8/18/20
to DroidScript
Symbroson,
Thanks for the long response.
I think I understand Windows (and IBM mainframe) files reasonably well 
Several things led me to be completely confused.
I presumed the parameters passed in (Hello World and .png) were a file name and extension, not app name and extension.
GetMediaFile returns /storage/emulated/0/Pictures/Hello World/20200818_133735040.png which looks to me like a file name, 
Still not sure if this is the actual folder name (including the date_time stamp and .png).
I think the reference could say something like -
   Given an app name and an extension then the method will return the folder where the app should store files with that extension,
   And if that folder does not exist then it will create it.
Add Asset still doesn't seem to work.
Regards, ah

Symbroson

unread,
Aug 18, 2020, 11:23:54 AM8/18/20
to DroidScript
how can something that simple be that hard

I admit the first argument "appName" is missleading - it should be folderName but as you should use the app name (app.GetAppName) for it because that is standard its called appName
It doesnt even matter that you think that its a file or a folder it is very clear IMO that you're supposed to use your app name there

The returned string is not a file name its a file path

Still not sure if this is the actual folder name
why in the world would "/storage/emulated/0/Pictures/Hello World/20200818_133735040.png" be a folder

Please explain your thoughts. I used to be a very patient person but I have an very nerve-racking time trying to explain the same simple thing over and over

Alan Hendry

unread,
Aug 18, 2020, 12:08:08 PM8/18/20
to DroidScript
Symbroson,
Initially I thought that the ingoing parameter was app name, 
but somewhere along the line I got confused and thought it was looking for a file "Hello.World.png").
I probably didn't understand the term "file path" (entire folder address and file name).
So the method has returned a file path that I can write to.
   filepath = app.GetMediaFile(app.GetAppName(),".png");
   ... create image object and draw on it ...
   imageobject.Save(filepath);
(Unless I'm still confused.com)
Thanks for your forbearance, ah

Reply all
Reply to author
Forward
0 new messages