Nativescript - file system overwrite not working on Android
up vote
1
down vote
favorite
I'm new to NativeScript.
I'm using nativescript-plugin-firebase
to download the photo of the user and save it into /data/user/0/{APP_ID}/files/telerik-logo-downloaded.png
.
Firebase Storage Native API Example:
var fs = require("tns-core-modules/file-system");
// let's first determine where we'll create the file using the 'file- system' module
var documents = fs.knownFolders.documents();
var logoPath = documents.path + "/telerik-logo-downloaded.png";
// this will create or overwrite a local file in the app's documents folder
var localLogoFile = documents.getFile("telerik-logo-downloaded.png");
// now download the file with either of the options below:
firebase.storage.downloadFile({
bucket: 'gs://n-plugin-test.appspot.com',
remoteFullPath: 'uploads/images/telerik-logo-uploaded.png',
localFile: fs.File.fromPath(logoPath),
localFullPath: logoPath
}).then(
function (uploadedFile) {
console.log("File downloaded to the requested location");
},
function (error) {
console.log("File download error: " + error);
}
);
When there's a change(e.g. user uploads a new photo), I will download the photo with the Firebase Storage Native API and overwrite the existing one.
var localLogoFile = documents.getFile("telerik-logo-downloaded.png");
this code above should overwrite the local file if it's existing.
In the result, the new photo will be shown on iOS but not Android. For Android, it's still the old photo.
May anyone help? Thank you~
javascript android filesystems nativescript firebase-storage
add a comment |
up vote
1
down vote
favorite
I'm new to NativeScript.
I'm using nativescript-plugin-firebase
to download the photo of the user and save it into /data/user/0/{APP_ID}/files/telerik-logo-downloaded.png
.
Firebase Storage Native API Example:
var fs = require("tns-core-modules/file-system");
// let's first determine where we'll create the file using the 'file- system' module
var documents = fs.knownFolders.documents();
var logoPath = documents.path + "/telerik-logo-downloaded.png";
// this will create or overwrite a local file in the app's documents folder
var localLogoFile = documents.getFile("telerik-logo-downloaded.png");
// now download the file with either of the options below:
firebase.storage.downloadFile({
bucket: 'gs://n-plugin-test.appspot.com',
remoteFullPath: 'uploads/images/telerik-logo-uploaded.png',
localFile: fs.File.fromPath(logoPath),
localFullPath: logoPath
}).then(
function (uploadedFile) {
console.log("File downloaded to the requested location");
},
function (error) {
console.log("File download error: " + error);
}
);
When there's a change(e.g. user uploads a new photo), I will download the photo with the Firebase Storage Native API and overwrite the existing one.
var localLogoFile = documents.getFile("telerik-logo-downloaded.png");
this code above should overwrite the local file if it's existing.
In the result, the new photo will be shown on iOS but not Android. For Android, it's still the old photo.
May anyone help? Thank you~
javascript android filesystems nativescript firebase-storage
hello @felicia, may I ask how do you load the photo?
– vann_goh
Nov 9 at 13:20
Thanks for replying @vann_goh, this wayimg.src = logoPath
, is there any problem?
– Felicia
Nov 9 at 13:22
may you try to change the way you load the photo as I comment below? Tell me if it works ;)
– vann_goh
Nov 9 at 13:26
Oh yeah!!! Thank you soooo much @vann_goh!!! It works
– Felicia
Nov 9 at 14:27
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'm new to NativeScript.
I'm using nativescript-plugin-firebase
to download the photo of the user and save it into /data/user/0/{APP_ID}/files/telerik-logo-downloaded.png
.
Firebase Storage Native API Example:
var fs = require("tns-core-modules/file-system");
// let's first determine where we'll create the file using the 'file- system' module
var documents = fs.knownFolders.documents();
var logoPath = documents.path + "/telerik-logo-downloaded.png";
// this will create or overwrite a local file in the app's documents folder
var localLogoFile = documents.getFile("telerik-logo-downloaded.png");
// now download the file with either of the options below:
firebase.storage.downloadFile({
bucket: 'gs://n-plugin-test.appspot.com',
remoteFullPath: 'uploads/images/telerik-logo-uploaded.png',
localFile: fs.File.fromPath(logoPath),
localFullPath: logoPath
}).then(
function (uploadedFile) {
console.log("File downloaded to the requested location");
},
function (error) {
console.log("File download error: " + error);
}
);
When there's a change(e.g. user uploads a new photo), I will download the photo with the Firebase Storage Native API and overwrite the existing one.
var localLogoFile = documents.getFile("telerik-logo-downloaded.png");
this code above should overwrite the local file if it's existing.
In the result, the new photo will be shown on iOS but not Android. For Android, it's still the old photo.
May anyone help? Thank you~
javascript android filesystems nativescript firebase-storage
I'm new to NativeScript.
I'm using nativescript-plugin-firebase
to download the photo of the user and save it into /data/user/0/{APP_ID}/files/telerik-logo-downloaded.png
.
Firebase Storage Native API Example:
var fs = require("tns-core-modules/file-system");
// let's first determine where we'll create the file using the 'file- system' module
var documents = fs.knownFolders.documents();
var logoPath = documents.path + "/telerik-logo-downloaded.png";
// this will create or overwrite a local file in the app's documents folder
var localLogoFile = documents.getFile("telerik-logo-downloaded.png");
// now download the file with either of the options below:
firebase.storage.downloadFile({
bucket: 'gs://n-plugin-test.appspot.com',
remoteFullPath: 'uploads/images/telerik-logo-uploaded.png',
localFile: fs.File.fromPath(logoPath),
localFullPath: logoPath
}).then(
function (uploadedFile) {
console.log("File downloaded to the requested location");
},
function (error) {
console.log("File download error: " + error);
}
);
When there's a change(e.g. user uploads a new photo), I will download the photo with the Firebase Storage Native API and overwrite the existing one.
var localLogoFile = documents.getFile("telerik-logo-downloaded.png");
this code above should overwrite the local file if it's existing.
In the result, the new photo will be shown on iOS but not Android. For Android, it's still the old photo.
May anyone help? Thank you~
javascript android filesystems nativescript firebase-storage
javascript android filesystems nativescript firebase-storage
edited Nov 9 at 14:17
Frank van Puffelen
220k25361387
220k25361387
asked Nov 9 at 10:54
Felicia
304
304
hello @felicia, may I ask how do you load the photo?
– vann_goh
Nov 9 at 13:20
Thanks for replying @vann_goh, this wayimg.src = logoPath
, is there any problem?
– Felicia
Nov 9 at 13:22
may you try to change the way you load the photo as I comment below? Tell me if it works ;)
– vann_goh
Nov 9 at 13:26
Oh yeah!!! Thank you soooo much @vann_goh!!! It works
– Felicia
Nov 9 at 14:27
add a comment |
hello @felicia, may I ask how do you load the photo?
– vann_goh
Nov 9 at 13:20
Thanks for replying @vann_goh, this wayimg.src = logoPath
, is there any problem?
– Felicia
Nov 9 at 13:22
may you try to change the way you load the photo as I comment below? Tell me if it works ;)
– vann_goh
Nov 9 at 13:26
Oh yeah!!! Thank you soooo much @vann_goh!!! It works
– Felicia
Nov 9 at 14:27
hello @felicia, may I ask how do you load the photo?
– vann_goh
Nov 9 at 13:20
hello @felicia, may I ask how do you load the photo?
– vann_goh
Nov 9 at 13:20
Thanks for replying @vann_goh, this way
img.src = logoPath
, is there any problem?– Felicia
Nov 9 at 13:22
Thanks for replying @vann_goh, this way
img.src = logoPath
, is there any problem?– Felicia
Nov 9 at 13:22
may you try to change the way you load the photo as I comment below? Tell me if it works ;)
– vann_goh
Nov 9 at 13:26
may you try to change the way you load the photo as I comment below? Tell me if it works ;)
– vann_goh
Nov 9 at 13:26
Oh yeah!!! Thank you soooo much @vann_goh!!! It works
– Felicia
Nov 9 at 14:27
Oh yeah!!! Thank you soooo much @vann_goh!!! It works
– Felicia
Nov 9 at 14:27
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
accepted
I guess your problem is the way you load the imageSource.
It should already overwrite the file, try this
img.src = imageSource.fromFile(logoPath)
instead of
img.src = logoPath
Hope it helps! Cheers!
add a comment |
up vote
0
down vote
With Android image won't be refreshed if it's the same url again. Try setting the image source to null
and then set it back to your path again.
I found the answer above, also I wish I could upvote your answer as well! Thank you sooo much @Manoj
– Felicia
Nov 10 at 4:48
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
I guess your problem is the way you load the imageSource.
It should already overwrite the file, try this
img.src = imageSource.fromFile(logoPath)
instead of
img.src = logoPath
Hope it helps! Cheers!
add a comment |
up vote
0
down vote
accepted
I guess your problem is the way you load the imageSource.
It should already overwrite the file, try this
img.src = imageSource.fromFile(logoPath)
instead of
img.src = logoPath
Hope it helps! Cheers!
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
I guess your problem is the way you load the imageSource.
It should already overwrite the file, try this
img.src = imageSource.fromFile(logoPath)
instead of
img.src = logoPath
Hope it helps! Cheers!
I guess your problem is the way you load the imageSource.
It should already overwrite the file, try this
img.src = imageSource.fromFile(logoPath)
instead of
img.src = logoPath
Hope it helps! Cheers!
answered Nov 9 at 13:25
vann_goh
221110
221110
add a comment |
add a comment |
up vote
0
down vote
With Android image won't be refreshed if it's the same url again. Try setting the image source to null
and then set it back to your path again.
I found the answer above, also I wish I could upvote your answer as well! Thank you sooo much @Manoj
– Felicia
Nov 10 at 4:48
add a comment |
up vote
0
down vote
With Android image won't be refreshed if it's the same url again. Try setting the image source to null
and then set it back to your path again.
I found the answer above, also I wish I could upvote your answer as well! Thank you sooo much @Manoj
– Felicia
Nov 10 at 4:48
add a comment |
up vote
0
down vote
up vote
0
down vote
With Android image won't be refreshed if it's the same url again. Try setting the image source to null
and then set it back to your path again.
With Android image won't be refreshed if it's the same url again. Try setting the image source to null
and then set it back to your path again.
answered Nov 9 at 14:16
Manoj
2,7791916
2,7791916
I found the answer above, also I wish I could upvote your answer as well! Thank you sooo much @Manoj
– Felicia
Nov 10 at 4:48
add a comment |
I found the answer above, also I wish I could upvote your answer as well! Thank you sooo much @Manoj
– Felicia
Nov 10 at 4:48
I found the answer above, also I wish I could upvote your answer as well! Thank you sooo much @Manoj
– Felicia
Nov 10 at 4:48
I found the answer above, also I wish I could upvote your answer as well! Thank you sooo much @Manoj
– Felicia
Nov 10 at 4:48
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53224334%2fnativescript-file-system-overwrite-not-working-on-android%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
hello @felicia, may I ask how do you load the photo?
– vann_goh
Nov 9 at 13:20
Thanks for replying @vann_goh, this way
img.src = logoPath
, is there any problem?– Felicia
Nov 9 at 13:22
may you try to change the way you load the photo as I comment below? Tell me if it works ;)
– vann_goh
Nov 9 at 13:26
Oh yeah!!! Thank you soooo much @vann_goh!!! It works
– Felicia
Nov 9 at 14:27