Android Question How to copy .bas files in the application folder on the PC to the phone via USB?

RB Smissaert

Well-Known Member
Licensed User
Longtime User
I have code to view (and search and other options) .bas files of an app on the phone.
For this I copy the files manually via USB through the PC file explorer.
I would like to automate this, so the phone app will do this for me, but not sure now how to do this.

RBS
 

RB Smissaert

Well-Known Member
Licensed User
Longtime User
More information needed. It is not trivial to directly connect to the PC file system.

Related resources:
SMB: https://www.b4x.com/android/forum/threads/jcifs-ng-smb-client-smb2.104560/#content (directly connect)
MTP: https://www.b4x.com/android/forum/threads/pybridge-accessing-mtp-devices.167211/#content (for a B4J app)
FTP Server: https://www.b4x.com/android/forum/t...d-with-socket-and-asyncstreams.74320/#content (B4J app)
Or jServer (B4J app)
OK, in that case I am not sure it is useful to code this as it is only to access the .bas code files on the phone.
Copying these from the PC only takes a few seconds.
Would it be useful to give the option when compiling the app to add these code files to app, so make them somehow accessible?

RBS
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Do you mean you want to view B4X source code on your phone?
What is the point?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Would it be useful to give the option when compiling the app to add these code files to app, so make them somehow accessible?
100% NO. It does not make any sense to add the source of an app to it. No matter in what language it is written.
 
Upvote 0

RB Smissaert

Well-Known Member
Licensed User
Longtime User
Do you mean you want to view B4X source code on your phone?
What is the point?
As I see it there is some point:
Say you are using the app away from the PC and you notice there is something not quite right.
You then have the option to look directly at the source code and see what might be coded wrong.

RBS
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
As I see it there is some point:
Say you are using the app away from the PC and you notice there is something not quite right.
You then have the option to look directly at the source code and see what might be coded wrong.

RBS
Why not use version control such as GitHub so you can view your code from the browser?
 
Upvote 0

RB Smissaert

Well-Known Member
Licensed User
Longtime User
Why not use version control such as GitHub so you can view your code from the browser?
Not familiar with GitHub, would that work off-line?
The other benefit is that you could see directly the source code from an error in the app.
Of course it would need to be optional as normally you would not want to disclose the source code.

RBS
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Not familiar with GitHub, would that work off-line?
The other benefit is that you could see directly the source code from an error in the app.
Of course it would need to be optional as normally you would not want to disclose the source code.

RBS
If you compile the APK in release (not obfuscated and not using Try-Catch) then the error message will show which line of code causing the error.
You can't do anything in the phone to fix the code.
In what situation you need to know the error code so urgently but you can't even debug or recompile the app without a PC?
 
Upvote 0

RB Smissaert

Well-Known Member
Licensed User
Longtime User
If you compile the APK in release (not obfuscated) then the error message will show which line of code causing the error.
You can't do anything in the phone to fix the code.
In what situation you need to know the error code so urgently but you can't even debug or recompile the app without a PC?
I found it useful when using a complex route instruction app. I understand you can't fix it there and then, but
it does help to see what is going wrong in a particular situation.

RBS
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
I found it useful when using a complex route instruction app. I understand you can't fix it there and then, but
it does help to see what is going wrong in a particular situation.

RBS
Why not write the error messages into a log file or sqlite?
 
Upvote 0

RB Smissaert

Well-Known Member
Licensed User
Longtime User
Why not write the error messages into a log file or sqlite?
Yes, you could, but I still find it useful to see there and then (eg when using a complex map route) to see the error, the actual situation (eg walking the route)
and the source code at the same time.
Never mind, I can see it is not worth it to automate this.

RBS
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
.bas file is just a text file.
I don't know whether you can archive the files into a zip file before compiling using CustomBuildAction.
When the app runs, extract the files out in File.DirInternal to read into an Edit Text view like any text file.
Just use it for development purpose, not to distribute as your production app.
 
Upvote 0

RB Smissaert

Well-Known Member
Licensed User
Longtime User
.bas file is just a text file.
I don't know whether you can archive the files into a zip file before compiling using CustomBuildAction.
When the app runs, extract the files out in File.DirInternal to read into an Edit Text view like any text file.
Just use it for development purpose, not to distribute as your production app.
>>
Just use it for development purpose, not to distribute as your production app.

Yes, that is the idea.
I think I will keep it as it is, all working fine.

RBS
 
Upvote 0
Top