beneroth changed the topic of #picolisp to: PicoLisp language | The scalpel of software development | Channel Log: https://libera.irclog.whitequark.org/picolisp | Check www.picolisp.com for more information
seninha has joined #picolisp
seninha has quit [Remote host closed the connection]
seninha has joined #picolisp
kuao has quit [Quit: Connection closed for inactivity]
seninha has quit [Remote host closed the connection]
seninha has joined #picolisp
kced has quit [Remote host closed the connection]
kced has joined #picolisp
kced has quit [Client Quit]
seninha has quit [Remote host closed the connection]
beneroth has quit [Quit: Leaving]
<tankf33der> kced: i do.
<tankf33der> Morning all
<abu[m]> Good morning tankf33der!
rob_w has joined #picolisp
<Hunar> Hello abu :) if Camera permission was disabled in PilBox then this (permit "android.permission.CAMER") or simple (camera?) makes a popup to enable it, but this doesn't make a popup (permit "android.permission.WRITE_EXTERNAL_STORAGE") what am i missing
<Hunar> typo: CAMERA
<abu[m]> Hi Hunar!
<abu[m]> Not sure. Perhaps it has to be enabled in AndroidManifest.xml?
<Hunar> I saw it in the AndroidManifest.xml
<abu[m]> As I said, I have not investigated the storage issue
<Hunar> Hmm, the issues became related :/ camera in webview needs that permission (as far as I understood)
<abu[m]> hmm
<abu[m]> Seems WRITE_EXTERNAL_STORAGE was in the Manifest until April 21
<abu[m]> Probably I removed it due to stupid Android changes
<Hunar> 😶
<abu[m]> It is sooo tedious
<abu[m]> The rules in Android change with each SDK version
<abu[m]> And you must comply otherwise you cannot release in PlayStire
<Hunar> I understand :(
<abu[m]> I don't remember well, but WRITE_EXTERNAL_STORAGE became useless. To access scoped storage, other mechanisms are needed, but I don't know
<abu[m]> Seems it can be done at runtime with the right Java calls
<abu[m]> But back then I did not find any concrete example, or did not understand the whole issue, so I did not investigate furher ;)
<abu[m]> My impression was that with proper knowledge it can be done with plain (java ..) calls in PilBox (or: it was my hope)
<Hunar> Ah, in that case I'll do some research to see if I can solve it without android studio (which I dont have)
<abu[m]> That would be nice!
<abu[m]> If necessary, I could add permission(s) to the Manifest and release
<abu[m]> if you can tell me what is needed
<Hunar> That would help :) add WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE along with MANAGE_EXTERNAL_STORAGE I don't know what would work :/
<Hunar> The third one is for "request all files access" which needs this intent "ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION"
<abu[m]> OK, great! Will do
<Hunar> :D
<abu[m]> Building
<abu[m]> I'd like to know if these three permissions are really needed
<abu[m]> (and if they are useful of course)
<abu[m]> I also hope they are not harmful. Don't remember why I removed them. Conflict with newer Android versions?
<abu[m]> Android development is a total mess :(
<abu[m]> BTW, I also don't have Android Studio
<abu[m]> I use the simple command line tools
<abu[m]> sdkmanager
<abu[m]> And a simple shell skript to build
abu[m] has quit [Quit: Bridge terminating on SIGTERM]
Hunar has quit [Quit: Bridge terminating on SIGTERM]
abu[m] has joined #picolisp
Hunar has joined #picolisp
<Hunar> Thanks for the build :) the permit of write made the popup now I can access /sdcard and install pilbox miniapps by just opening the .tgz file and seleting PilBox
<Hunar> however the (permit "android.permission.MANAGE_EXTERNAL_STORAGE") didn't do anything .. and the browser app still cant open camera in webview
<abu[m]> So read/write permission did improve something :)
<Hunar> Yes :D
<abu[m]> good, let's keep it
<Hunar> perhaps some java code is needed during the creation of webview?
<abu[m]> Perhaps, but I think all these calls could be done at runtime too
<abu[m]> The managed access looks necessary too: "Allows an application a broad access to external storage in scoped storage"
<Hunar> I don't understand java :| what is that code trying to do?
<abu[m]> It overrides a method
<abu[m]> However, it assumes a class WebChromeClient
<abu[m]> which is not used by PilBox. It uses plain WebViewClient
<abu[m]> The android class reference says nothing about it! "Summary" is empty ;(
<abu[m]> PilBox uses PilView.setWebViewClient()
<abu[m]> I don't know what consequences it has if we change this
<Hunar> I did some more research, it looks like that is the only way :| after the line
<Hunar> PilView.setWebViewClient();
<Hunar> PilView.setWebChromeClient(...
<Hunar> you need to add this line
<Hunar> I guess this doesn't work if the phone didn't have chrome installed? not sure.. like huawei
<abu[m]> Oh, hmm, I see
<abu[m]> No idea what it implies
<abu[m]> Perhaps it still can be done without building complete new PilBox?
<abu[m]> Something with (java (; CONTEXT GUI PilView) ...
<Hunar> This is the explanation I think
<Hunar> I have to dig deep and learn (java ...) then :)
<abu[m]> Yeah :)
<abu[m]> Setting an object is easy. The problem is to define the method. IIRC PilBox has only ways to define methods for interfaces
<Hunar> good luck to me :)
<Hunar> another thing I forgot to mention, long messages through matrix messes up the IRC log .. it shows a part of the long text then puts a link which doesnt work
<abu[m]> oh
<Hunar> here is an example
<Hunar> When I was using web.libera.chat long messages would become broken into multiple messages
<abu[m]> You mean the "full message at"? Works here.
<Hunar> It doesnt work here :|
<Hunar> {"errcode":"M_NOT_FOUND","error":"Not found","mr_errcode":"M_NOT_FOUND"}
<Hunar> I prefer breaking up the message since its searchable through the log
<abu[m]> I look at the log in w3m
seninha has joined #picolisp
<Hunar> I just tried w3m, same thing.. the difference is the error is downloaded instead of viewed
<abu[m]> Here it downloads and displays in a viewer
<abu[m]> on Termux
<abu[m]> Anyway, the problem is the webView client
<abu[m]> Setting a chrome client is not so difficult: http://ix.io/4ahu
<abu[m]> The problem is overriding the method
<abu[m]> Oh! I'm stupid.
<abu[m]> There is already a WebChromeClient in PilBox!
<abu[m]> src/de/software_lab/pilbox/PilBoxActivity.java
<abu[m]> But, strange, this returns NIL: (java (; CONTEXT GUI) 'runOnUiThread (java (; CONTEXT GUI PilView) 1 'getWebChromeClient))
<abu[m]> I don't understand why
<abu[m]> OK, I add onPermissionRequest()
<abu[m]> Done! ☺
<abu[m]> Can you try with https://picolisp.com/pub/pilBox.apk ?
<Hunar> Wait, i was on the java learning jurney and was struggling to understand why (scl 6) (java "java.lang.Math" 'pow (-6 . 4.0) (-6 . 3.0)) doesnt work
<Hunar> didn't get notification of your messages
<Hunar> I'll try :D
<abu[m]> good :)
<abu[m]> (java "java.lang.Math" 'max 3 4) -> 4
<Hunar> YAAAY camera now works :D open webcamtests.com in PilBox browser miniapp
<abu[m]> yay!!
<Hunar> My project can finally begin :D
<abu[m]> ☺
<Hunar> the 'max works, but pow didn't .. it says java.lang.NoSuchMethodException: pow([Ljava.lang.Class;@30206a9)
<abu[m]> (java "java.lang.Math" 'pow (6 . 3.0) (6 . 2.0))
<abu[m]> -6 is float, probably max expects double
<abu[m]> java.lang.NoSuchMethodException
<Hunar> I got the example from picolisp.com/wiki/?javaCode
<abu[m]> Ah, I see! This is from the predecessor of the Android interface I think
<abu[m]> or is java.lang in Android different?
<Hunar> I found the website, it is also double in android
<Hunar> if -6 is float what is double
<abu[m]> just 6
<Hunar> Oh, wasn't listed in the wiki page I linked, it says negative is double .. outdated :)
<abu[m]> yeah
<abu[m]> It is like in 'native'
<Hunar> Ah, great
<abu[m]> But native uses (12.3 . 1.0)
<abu[m]> So not the same :(
<abu[m]> Now I tried the camera in the PilBox browser. It is no longer blank, but gives only a black rectangle
<abu[m]> How to give permission?
<Hunar> I prefer native
<abu[m]> 'permit'?
<abu[m]> Yeah, native is more general
<Hunar> I used (permit "android.permission.WRITE_EXTERNAL_STORAGE")
<abu[m]> I gave all permissions, but still black
<Hunar> I guess my code isn't good .. I deleted alot of stuff
<Hunar> I'll rewrite some code tonight
<abu[m]> ok :)
<Hunar> quick question
<Hunar> how do i open local server in PilBox browser? on chrome it works but here it says net::ERR_SSL_PROTOCOL_ERROR
<abu[m]> You mean localhost?
<Hunar> yes
<Hunar> I did "python -m http.server"
<Hunar> in ternux
<Hunar> termux*
<abu[m]> I use something like http://localhost:22154/...
<Hunar> ah, didn't think that http:// is required
<abu[m]> I start a local pil server in Termux's .profile
<Hunar> can you give me a small explanation :)
<abu[m]> I prepare, removing passwords etc
<Hunar> :)
<abu[m]> .profile starts run
<abu[m]> run checks for mails, and starts a local server for various tasks and displays
<abu[m]> .profile also starts tmux on the first terminal
<abu[m]> and does a wake lock
<Hunar> Cool :)
<abu[m]> I get a notification if a mail is available
<abu[m]> The second notification is from other servers via an ssh tunnel
<abu[m]> And, to make it complete: I access from the PilBox browser (or also from Chrome if needed) as http://localhost:22154/...
<abu[m]> But I still wonder why the camera does not work here. What did I forget?
<abu[m]> PilBox has all 5 permissions
<Hunar> for me it also doesnt work in chrome .. I don't know what happened
<abu[m]> Here it works in Chrome but not in PilBox
<abu[m]> Only *one* possible? ;)
<Hunar> ah, I was confusing myself with local ip, when I use localhost it works in chrome
<abu[m]> and in PilBox?
<Hunar> on pilbox its like your's black rectangle only
<abu[m]> oh :(
<Hunar> but why would webcamtests.com work, the problem cant be pilbox, right?
<abu[m]> Yeah, this one works
<abu[m]> It did *not* work before today's changes?
<abu[m]> Yes, just re-installed 20220906
<abu[m]> does not wor
<abu[m]> k
<Hunar> Yeah, it worked when you send the apk
<Hunar> But wait, I just removed storage permission from PilBox and camera webcamtests.com still works .. I guess it wasn't needed after all?
<Hunar> only those java lines needed to be added
<abu[m]> Maybe
<abu[m]> At least MANAGE_EXTERNAL_STORAGE looks unnecessary
<Hunar> Yeah, i agree
<abu[m]> Can you try to make it work in PilBox?
<Hunar> I'll try :D
<abu[m]> Then I remove the permissions perhaps
<abu[m]> (keep it minimal ;)
<Hunar> You mean removing the write and read in the manifest?
<abu[m]> yep
<abu[m]> and manage
<Hunar> but, I like having access to my sdcard :)
<abu[m]> ok, right
<Hunar> only remove manage :)
<abu[m]> I think these permissions are not enough. Needs to enable "scoped" storage (on Android >= 10)
<Hunar> I like to have this process if I wanted to install a pilbox miniapp on my friend's phone (just install PilBox on play store, then I'll send this file to you, open it and choose PilBox) that is the simplest way to install an app for a friend
<Hunar> which requires storage access :)
<abu[m]> yes, I'd like to enable it too, I just don't know what it involves
<abu[m]> I think I removed it because:
<abu[m]> There is a lint warning in AS with regards to android.permission.WRITE_EXTERNAL_STORAGE. The warning says that the permission will no longer provide write access when targeting Android 10 and above
<Hunar> Hmm, I have android 9
<Hunar> No worries :) as long as it would potentially be re enabled in the future :|
<abu[m]> I have 11, and some people start with 13 now
<abu[m]> So I want a portable solution
<abu[m]> Just google for "android scoped storage". Lots of explanations but not clear to me what to do :(
<abu[m]> In 10 you can still request "legacy" access, but no longer in 11 and above
<abu[m]> And as I want to release to PlayStore, I *must* target SDK 31 which is Android 12
<abu[m]> if not, I cannot upload updates in a month or so
<Hunar> I hate it when google depricates android versions :( .. I remember having android 2.3.4 for years because the phone was working fine, but no app was made for it so I had to upgrade
<abu[m]> Yeah, I hate everything around Android and Google restrictions
<Hunar> what is currently the minimum android version that can install PilBox?
<abu[m]> MINSDK=21
<abu[m]> which is (5.0) Lollipop
<Hunar> Hmm, I'm good for a few years 😅
<abu[m]> Not sure if everything still works though
<abu[m]> I cannot test on all versions
<abu[m]> Someone wrote to me that it did not even start on 12 for example
<abu[m]> Needed a flag in notification
<abu[m]> Then it seems to work
<abu[m]> But I wouldn't have noticed ;)
<abu[m]> So many obscure changes witfn each Android version
<Hunar> My mom has android 5 I think, I'll try it tonight :)
<abu[m]> Good!
<abu[m]> We need many many testers in the community ;)
<Hunar> Would a virtual device work for testing?
<abu[m]> Yes, most probably
<abu[m]> Once back to the permissions
<abu[m]> If I remove read and write external again, something does not work for you?
<Hunar> I think it would still work :) .. I'll go home now .. just found browserstack.com which claims to test apps
<Hunar> goodbye for now
<abu[m]> ok, bye!
clacke has quit [Remote host closed the connection]
rob_w has quit [Remote host closed the connection]
<abu[m]> So I removed the three memory permissions again. Looks more correct to me.
<Hunar> I hope it still works now :)
<abu[m]> Looks like ... though not yet in PilBox
<abu[m]> fyi: I'm currently using http://ix.io/4aiO
<abu[m]> I start it locally with the above run script, and access as http://localhost:22154/.../feed.html
<abu[m]> Works fine in Chrome on Android
<tankf33der> my pastebin service will be here pb1n.de
<tankf33der> setup in progress.
<abu[m]> 👍
<Hunar> Bad news, my mom's android is 5.1.1 and the play store doesn't list PilBox, I downloaded it manually, the installation page opened but after pressing install it fails
<abu[m]> Probably it is 32 bit hardware
<abu[m]> PlayStore lists only Arm64 with >= 5.0
<Hunar> I can check that :)
<abu[m]> At Android 5 times not many devices were 64 bits
<abu[m]> My first one was a Nexus 9 tablet. It had Lollipop and Arm64 :)
<abu[m]> 2015
<Hunar> 64bit was the problem, it's armeabi-v7a
<abu[m]> An emulator for all versionj would be nice
seninha has quit [Quit: Leaving]
seninha has joined #picolisp
seninha has quit [Remote host closed the connection]
seninha has joined #picolisp
<Hunar> I still don't know what is wrong, but I have some updates.. I found a short code from other people and it's a single html file ix.io/4ajD this works on chrome but in PilBox browser sometimes its a black screen sometimes its blank, BUT the camera is being accessed, my phone camera (hardware) makes a small noise when it's launched, and it does make the noise through PilBox browser so I have no idea what's wrong
<abu[m]> hmm, also https://webcamtests.com is a bit strange in PilBox. It shows a correct stream for a second, then starts a very long check
<abu[m]> But this is the same in Chrome too
<Hunar> I thing it's a part of the testing that the website does, on pc it takes afew seconds
<Hunar> think*
<abu[m]> looks like
seninha has quit [Remote host closed the connection]
seninha has joined #picolisp