New Version 2.06 now released on Google Play

515 views
Skip to first unread message

Dave

unread,
Mar 8, 2021, 7:29:52 AM3/8/21
to DroidScript
Hi Guys,

Version 2.06 is now available on Google Play or directly here:-


WARNING: Please read point 4 if you don't know about 'Scoped Storage' yet, as reading it will probably save you some big headaches!


These are the headline features:-

1. Premium users can now use the Android Job Scheduler to run regular background tasks, such as checking for updates or messages for your app etc.  These are more reliable than using Alarms and have more sophisticated options, such as only running a job when a wifi or cell connection is available.
  
For example to Schedule a job to run now and roughly every 10 minutes including after reboot, but only if a cell network is available:
  
    app.ScheduleJob( 10*60*1000, "now,repeat,persist,cell" )
Be aware that if you try to run jobs too frequently (less than 10-15 mins) then Android might warn the user that your app as being 'battery intensive'.  Also, the rate of job triggering will often slow down at night when your phone goes into low power mode. Remember that ultimately Android decides when to trigger the job and you cannot force it to run exactly when you want.  Accurate job or alarm triggering is no longer possible with Android (unfortunately).

2. With the new ide.MakePlugin method, you can now easily create DS plugins from existing or new JavaScript projects by simply placing the following code into your main JS file.  It will generate the necessary files if not already in your project.

function OnStart()
{
    //Package this project into a plugin and install it.
    ide.MakePlugin( "DemoPlugin" )
    
    //Test the plugin functionality.
    app.LoadPlugin( "DemoPlugin" )
    plg = app.CreateDemoPlugin()
    alert( plg.Test( "World" ) )
}

Note:  Your main plugin file no longer needs to be a .inc file, it should be .js instead from now on.

If you want to see an example of how to make a webview based DS plugin, check out the MapView project here:-  https://ds.justplayer.de/uploads/74

3. If you are a Wifi IDE user, then you might like to try out our new Chat Extension by going to the DS about box and enabling 'experiments', then refreshing your browser. This allows instant group chat features with code snippet pasting supported too. If this works out to be popular, then we may introduce it into the device IDE too.  It's currently a beta project, so don't be surprised if you find a bug or two.

4. DS now has support for Scoped Storage, which is a new feature of Android 10/11 that is catching more than a few people out at the moment!


If you uninstall DS and re-install it on Android 10, then you are likely to loose access to the /sdcard/* path in DS and your apps due to the new 'Scoped Storage' rules in Android. Also your Apps might suddenly seem to disappear.  This is because the /sdcard/DroidScript folder will have been mapped to the  /Android/data/com.smartphoneremote.androidscriptfree/files folder instead.  You can simply copy your current projects to this folder and continue as normal. 

If you don't uninstall DS and your phone upgrades to Android10, or you start off with an older version of DS, then upgrade to it, then your projects will stay in the old /sdcard/DroidScript folder.  

Just be aware that many of your App's users will be subject to scoped storage, so don't expect direct to access folders like /sdcard/Downloads anymore.

DroidScript tries to make the transition to scoped storage as painless as possible, by automatically mapping any /sdcard/* paths to the Android/data folder for you, so most of your old apps will still work as long as you aren't expecting to access files generated by other apps, as this is now blocked by Android for security reasons.

You can detect if scoped storage is active for your app by using the app.IsScoped() method.  You can also still access files in the /sdcard/Dowloads folder but you have to prompt the user to select files using the file choosing dialog and then pass the resulting content URI to the file handling methods or image loading methods.  Content URIs start with the pattern "content://" and need to be used when accessing files outside your App's scoped storage sandbox.  The new app.Path2Uri() method can be used to find the content URI of an image or video when given an traditional file path.

See discussion of accessing external files under scoped storage here:- https://groups.google.com/g/androidscript/c/NMmO1cw851c/m/oRunheQhBAAJ

5. New Cooler look for the Wifi IDE with dark mode the default look (now available for non-premium users too :)


Here is the full list of changes since the last official release:-

DS 206 
- Fix for new projects created in Wifi IDE having old 'holo' look.
- mui: Fix for DataTable column sorting with duplicate vals.
- Chat extension moved to 'experiments' mode.

DS 205
- Default theme for wifi ide is now dark.
- mui: SetOnSelectionStatus bug in CreateDataTable docs fixed.
- mui: Icons in CreateDataTable headers now showing properly.
- Fixed banner add clicks always going to Premium dialog.
- Improved reliability of language extension.

DS 204b1
- Added new "/Plugins" keyword to get path to plugins.
- Added gfx.GetJoystick() gets object containing joystick states.
- Added new gfx.multiTouch=true option to GameView (x/y vals will be arrays).
- Wifi IDE app icons is now refreshed after spk installs.
- GameView: Fixed gfx.Reload() not working on some devices.
- Enabled the download and install of .ppk files from the DroidStore.
- Fixed bug preventing multiple plugin installs at once.
- app.AutoWifi and app.AutoStart now deprecated in favour of ide.AutoWifi, , ide.AutoStart.
- app.AutoBoot() can now contain both 'app' and 'service' keywords at same time.
- Fixed app.IsStarted() to work for multi-page html apps.
- Added app.ScheduleJob() method to shedule background jobs (using Job.js file).
- Added 'Background Job' app template for premium users.
- Added app.PinScreen() method (screen pinning must be enabled in settings).

DS 203b1
- Fixed bug with SendDataGrams showing EADDRINUSE error.
- Added datagram buffer size options to Send/ReceiveDatagram (1k,2k,4k,8k,16k,32k,64k)
- Added new app.GetJoystickStates() method, returns single object with all states.
- Removed semi-colons from device code completion.
- Download component and WebView/Html Apps now support 'content-disposition' header.
- Added USE_FULL_SCREEN_INTENT permission if required.
- Removed deprecated funcs SetLanguage, Language2Code.
- Fixed obfuscation issues related to SetAppLanguage and GetAppLangCode.
- Added app.CreateCanvas() method, creates blank image with auto-update turned off.
- Fixed SET_ALARM permission having wrong path.
- Added new ide.MakePlugin method (turns current project into a plugin and installs it).
- Updated Wifi IDE toolbar and button styles.
- Scoped storage state remembered from first run (safe to install your APKs on Android 10)
- Added app.IsScoped() method to indicate 'scoped storage' on Android 10+.
- Added SetOnRequest() to detect all WebView requests (params: url,method,isMain,isRedirect).
- Added Stop() method to WebView, cancels current page load.
- Added SetBlockedUrls() to WebView, comma seperated list of urls to block.

Enjoy :)

Dave

unread,
Mar 8, 2021, 7:35:52 AM3/8/21
to DroidScript
P.S.  Please use  /Storage/* file paths instead of /sdcard/* file paths in your Apps from now on .

(case is important, so make sure you have a capital S in Storage)

Alan Hendry

unread,
Mar 9, 2021, 5:18:47 AM3/9/21
to DroidScript
Hi,
Android 10 Go, DS 2.06
I'm getting /storage/... (with lower case s) from
GetPrivateFolder("Pictures","External")
GetExternalFolder()
GetSpecialFolder("Pictures") 
Regards, ah

Dave

unread,
Mar 9, 2021, 10:44:04 AM3/9/21
to DroidScript
Paths with lowercase /storage/... may be valid full paths for that device.  It's perhaps a bit confusing but they are two different things.  Using upper case /Storage/ in DS methods allows the path to be mapped to either the root of the sdcard or; in the case of Scoped Storage, to the folders /Android/data/...  

The functions you listed above, will return the full paths to the requested folders, which on many devices start with /storage/...
Reply all
Reply to author
Forward
0 new messages