Comments (17)
You can not write files that are inside the assets
folder because at the run time these files are no more in assets
.
You can read/write files in users directory
Check here
from androidjs.
You can not write files that are inside the
assets
folder because at the run time these files are no more inassets
.You can read/write files in users directory
Check here
thanks for the answer
but how can I defiene "app" ? I used this but wont help:
const app = require ( 'androidjs' ).app;
from androidjs.
You can not write files that are inside the
assets
folder because at the run time these files are no more inassets
.
You can read/write files in users directory
Check herethanks for the answer
but how can I defiene "app" ? I used this but wont help:const app = require ( 'androidjs' ).app;
app
module is given in front process
from androidjs.
app
module is given in front process
but I need to deal with it in back process, is there any chance to get the 'userData' Folder's Path, in order to write on it, in Back process?
from androidjs.
app
module is given in front processbut I need to deal with it in back process, is there any chance to get the 'userData' Folder's Path, in order to write on it, in Back process?
You can use IPC
to share information between front
and back
process.
from androidjs.
You can use
IPC
to share information betweenfront
andback
process.
I used that but in Mobile it immediately closes:
// ------- send App Location to back
let path = app.getPath('userData');
front.send ( 'here' , path );
back.on ( 'here' , function (data) { const here = data; } );
answer = Object.assign ( {} , answer_template );
answer[ 'stat' ] = 'looking_in';directories = fs.readdirSync ( here );
answer[ 'retrieved_data' ] = directories;
back.send ( 'Hey_you' , answer );
from androidjs.
You can use
IPC
to share information betweenfront
andback
process.I used that but in Mobile it immediately closes:
// ------- send App Location to back
let path = app.getPath('userData');
front.send ( 'here' , path );back.on ( 'here' , function (data) { const here = data; } );
answer = Object.assign ( {} , answer_template );
answer[ 'stat' ] = 'looking_in';
directories = fs.readdirSync ( here );
answer[ 'retrieved_data' ] = directories;
back.send ( 'Hey_you' , answer );
You have to read read operations inside the callback function because javascript is async or you can use promise
from androidjs.
You can use
IPC
to share information betweenfront
andback
process.I used that but in Mobile it immediately closes:
// ------- send App Location to back
let path = app.getPath('userData');
front.send ( 'here' , path );back.on ( 'here' , function (data) { const here = data; } );
answer = Object.assign ( {} , answer_template );
answer[ 'stat' ] = 'looking_in';
directories = fs.readdirSync ( here );
answer[ 'retrieved_data' ] = directories;
back.send ( 'Hey_you' , answer );You have to read read operations inside the callback function because javascript is async or you can use promise
Did you write this whole thing inside the ipc callback
from androidjs.
Did you write this whole thing inside the ipc callback
this part in front:
// ------- send App Location to back
let path = app.getPath('userData');
front.send ( 'here' , path );
this part in back:
back.on ( 'here' , function (data) { const here = data; } );
answer = Object.assign ( {} , answer_template );
answer[ 'stat' ] = 'looking_in';fs.readdir ( here , (err, directories ) => {
answer[ 'retrieved_data' ] = directories;
back.send ( 'Hey_you' , answer );} );
I changed readdirSyc
to readdir
, but still it closes
from androidjs.
Did you write this whole thing inside the ipc callback
this part in front:
// ------- send App Location to back
let path = app.getPath('userData');
front.send ( 'here' , path );this part in back:
back.on ( 'here' , function (data) { const here = data; } );
answer = Object.assign ( {} , answer_template );
answer[ 'stat' ] = 'looking_in';
fs.readdir ( here , (err, directories ) => {answer[ 'retrieved_data' ] = directories;
back.send ( 'Hey_you' , answer );} );
I changed
readdirSyc
toreaddir
, but still it closes
You have to write whole dependent code inside the back's callback.
Do you know how javascript works ?
from androidjs.
Did you write this whole thing inside the ipc callback
this part in front:
// ------- send App Location to back
let path = app.getPath('userData');
front.send ( 'here' , path );this part in back:
back.on ( 'here' , function (data) { const here = data; } );
answer = Object.assign ( {} , answer_template );
answer[ 'stat' ] = 'looking_in';
fs.readdir ( here , (err, directories ) => {answer[ 'retrieved_data' ] = directories;
back.send ( 'Hey_you' , answer );} );
I changed
readdirSyc
toreaddir
, but still it closesYou have to write whole dependent code inside the back's callback.
Do you know how javascript works ?
it has been summarized here, it is a part of over 1500 lines of coeds,
this part will be triggered in appropriate time: (it is a tiny part of a function named looker, which will call in later, and if I set the here
to /sdcard/www/content
it works fine )
answer = Object.assign ( {} , answer_template );
answer[ 'stat' ] = 'looking_in';
fs.readdir ( here , (err, directories ) => {answer[ 'retrieved_data' ] = directories;
back.send ( 'Hey_you' , answer );
from androidjs.
Did you write this whole thing inside the ipc callback
this part in front:
// ------- send App Location to back
let path = app.getPath('userData');
front.send ( 'here' , path );this part in back:
back.on ( 'here' , function (data) { const here = data; } );
answer = Object.assign ( {} , answer_template );
answer[ 'stat' ] = 'looking_in';
fs.readdir ( here , (err, directories ) => {answer[ 'retrieved_data' ] = directories;
back.send ( 'Hey_you' , answer );} );
I changed
readdirSyc
toreaddir
, but still it closesYou have to write whole dependent code inside the back's callback.
Do you know how javascript works ?it has been summarized here, it is a part of over 1500 lines of coeds,
this part will be triggered in appropriate time: (it is a tiny part of a function named looker, which will call in later, and if I set thehere
to/sdcard/www/content
it works fine )answer = Object.assign ( {} , answer_template );
answer[ 'stat' ] = 'looking_in';
fs.readdir ( here , (err, directories ) => {answer[ 'retrieved_data' ] = directories;
back.send ( 'Hey_you' , answer );
Yeah, I am not saying to write whole thung inside the callback but you have to write whole code which are dependent on here
inside the callback
from androidjs.
Yeah, I am not saying to write whole thung inside the callback but you have to write whole code which are dependent on
here
inside the callback
so do you mean this code :
back.on ( 'here' , function (data) { const here = data; } );
will not set here
globally?!
from androidjs.
Yeah, I am not saying to write whole thung inside the callback but you have to write whole code which are dependent on
here
inside the callbackso do you mean this code :
back.on ( 'here' , function (data) { const here = data; } );
will not set
here
globally?!
No, not at all because of async behaviour of javascript.
from androidjs.
Yeah, I am not saying to write whole thung inside the callback but you have to write whole code which are dependent on
here
inside the callbackso do you mean this code :
back.on ( 'here' , function (data) { const here = data; } );
will not set
here
globally?!No, not at all because of async behaviour of javascript.
so How can I send here
to back at the starting of the App and keep here
for entire Time and use it as other const
vars?
from androidjs.
Not possible to save the value of here
because of js async behaviour.
I used the same concept in sample story app
, you can check soruce for the reference.
from androidjs.
Hi its been a while nobady make a comment.
Please im trayng to read files im the back. but it does not work outside of appData folder.
can anybody please giveme me some info.
i added
...
"permission": ["android.permission.INTERNET", "android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.READ_EXTERNAL_STORAGE"],
...
in the package.json
without siccess.
note that if i run the app im the pc and in a virtual android machine i have it works, but in a fone it does not work outsidr of appData.
hope anybody read this and help.
from androidjs.
Related Issues (20)
- cannot use ajax with jquery
- error in window.open();
- Node integration in frontend? HOT 1
- display: grid; HOT 15
- DOM problem HOT 1
- status bar and bottom bar not dissapearing no matter what
- Do you put the "app.location.get();" on the back or front?
- ️🔥 How/Where can we modify AndroidJS java base or extend androidjs react native layer through npm react native addons ?
- Failed to build apk
- Failed to load signer "signer #1" HOT 2
- Application startup delay
- Module "node:fs" crashes the app
- no apk HOT 1
- ReferenceError: TextDecoder is not defined
- APK installation fails after building for release
- MediaRecorder not accepted in browser HOT 1
- vue-cli
- build exe for desktop app
- ReferenceError: fetch is not defined (at backend) ???
- Let user choose PORT or change default PORT from 3000
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from androidjs.