Alternative implementation on Android was: HTML5/DukeScript and access local files/filenames?

26 views
Skip to first unread message

Jaroslav Tulach

unread,
Aug 13, 2016, 5:22:53 AM8/13/16
to Baltic DukeS, DukeScript
Hello Andreas.

> Thanks for your quick reply

I've just found your message in my unanswered box, sorry for the delay.

2016-07-30 8:33 GMT+02:00 Baltic DukeS <ap...@czerniak.eu>:
Hi Jaroslav,
 
I would like to develop a sample application (under NetBeans 8.1) for a browser&android client to choose a document and send this to the jersey server and return an id.

There is an example of providing alternative functionality on different platforms in my MineSweeper game. In the following commit
https://github.com/jtulach/minesweeper/commit/2eef6d95b841a710051b0e9a5f9d77ede9ad2f54
I define `OpenURL` API class in the "js" module (which every platform version can see). Then I register a NetBeans specific implementation to open the URL in a NetBeans specific way. I think this approach can be used for your case as well. 

> and links to Android file-chooser. Sorry I forgot, I use/test DukeScript on a (hardware) Android version 5.1.1.
> Is there a blog entry, information text, or source code that describe: How can I use methods target-depends e.g., on android? I haven't seen an example yet.

One needs reference to application context in case of Android. One way to obtain it is to do the same as I did in my Karel game where I defined my own activity which got all necessary (access to storage in this case) and only then it delegated to DukeScript activity: https://github.com/jtulach/karel/commit/ea5ac217dbe60bc43d75755bef56c8586211131b
 
btw. the dependency for com.dukescript.libraries is v0.2 , can I switch/upgrade it to v0.3 (I found it under 'dependency search')?

I think it should be possible. As far as I know the com.dukescript.libraries don't use any fancy features of HTML/Java, so they should work with any version.
-jt
 
Am Freitag, 29. Juli 2016 12:00:29 UTC+2 schrieb Jaroslav Tulach:
Hello Andreas,
thanks for giving DukeScript a try.

I don't think DukeScript does anything special to handle/disable file selection. I did a quick search and found http://stackoverflow.com/questions/23568792/android-4-4-webview-file-chooser-not-opening - looks like there is a problem with file upload in a WebView on some Android versions.

Hard to say what is the best way to workaround it. One option is to write native Android code to open [real file chooser intent](http://stackoverflow.com/questions/7856959/android-file-chooser) and put it into client-android and use it conditionally.
-jt


2016-07-29 1:07 GMT+02:00 Baltic DukeS <ap...@czerniak.eu>:
Hi,

I'm new to DukeScript and wrote my first project after some sample projects from website and leanpub.

Is there an way to get an file / filename under Android via DukeScript?
I try 
[...]
<form>
 
<input  type="file"  />
 
<input  type="file" accept="image/*;capture=camera" />
</form>

but "for Android" nothing happens. Under "on Web" no problems the file chooser dialog opens.
I test the same in the Browser under Android and it works but from DukeScript.

There are any (other) hints to get a filename from local storage?

Thanks in advanced.
Andreas.
--
You received this message because you are subscribed to the Google Groups "DukeScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dukescript+...@googlegroups.com.
Visit this group at https://groups.google.com/group/dukescript.
To view this discussion on the web visit https://groups.google.com/d/msgid/dukescript/e33e345a-f65b-469a-85db-bcd1b4fd91c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Reply all
Reply to author
Forward
0 new messages