Is it possible to save and retrieve a Gesture using SharedPreferences? - android-gesture

/res/raw doesn't appear to be an option and saving to SD is fine but i'd prefer to avoid that dependency

Investigating this SharedPrefs appears to be impossible and a bad idea. GestureLibrary.fromPrivateFile() does the job saving the file privately off SD.

Related

Flutter cached image is it possible to reload image instead of getting the cached image?

I'm using the package flutter_cached_network_image to load images from firebase. When a user updates his profile picture (filename is still the same) the image that is loaded is still the same as the one before the update because it is loaded from cache (because it still has the same url as before).
Is it possible to clear the picture from the cache so the new image is loaded?
Apparently there is no solution at the moment. See here: https://github.com/Baseflow/flutter_cached_network_image/issues/77
I use the version of the image in the address to get around this. Something like: https://example.com/image.jpg?version=14
I had the same issue. This helped me this:
imageCache.clearLiveImages();
imageCache.clear();
_bloc.add(ReloadEvent());
Cleaning cache and rebuilding widgets after successfully updating photo.
Like #EderBaum said, you can force puting an additional query string input, the value depends of the effect that you want, for example:
1 - Never cache
http:urlofresource.com/yourimage.jpg?version={NewRandonNumberGenerated}
You can use Random class to achieve this.
2- Reload cache based on app version
Same that before, but now, you use an version information that you can put into your global state or somewhere else to retrieve information after an update
3 - Use normal cache
Just leave the widget do the job.

Symfony Gaufrette create a copy of an image

I'm using a Symfony Gaufrette for storing images in a filesystem. It works fine when I store an image first time. But I also need to create a copy of the image after it was uploaded to the filesystem. Is there any way to do it?
I use this function for writing:
$filesystem->write($imagepath, file_get_contents($answer->get('imageObject')->getData()));
I was fighting all day long to make Gaufrette work with my Symfony2 app and Amazon S3 ... whenever I've made a step forward I had to take another fight ...
Finally I've switched to Flysystem and all my problems were gone ...
It's much better written and it just works (although config is almost the same).
Unfortunately copy() method now is not implemented in Gaufrette(you can see it in Adapter interface), so the only way to copy file using this library is to use read() and write() methods.

Using saveEventually() instead of save() or saveInBackground() for ParseUser or ParseObject

Looking at Parse documentation, there is a saveEventually() method that can be used in place of save() and saveInBackground().
Can I use this function everywhere in my code in place of save and saveInBackground so I don't have to worry about the user switching between being offline and online and I won't have to handle saving in situations where there is no connectivity? Are there any drawbacks to using this approach?
According to Parse's iOS guide:
Most save functions execute immediately, and inform your app when the save is complete. If you don't need to know when the save has finished, you can use saveEventually instead. The advantage is that if the user currently doesn't have a network connection, saveEventually will store the update on the device until a network connection is re-established. If your app is closed before the connection is back, Parse will try again the next time the app is opened.
So you will use save if you need the callback when the save has finished. I think you can use both depending on the situation you are handling.

Creating an encrypted save file

I'm trying to make a game in Ruby, and my latest addition is to save files, however, I'm having a major problem with encrypting them.
I already got the saving and loading methods set up, but I don't want to save them in plain-text, because that's begging for cheating. No matter what, the methods I use to try and store them encrypted, compressed, etc., all seem to spring some error on me.
What's the best method for saving text in a file? The only important thing is that the file can't be opened and edited.
You can use crypt gem to encrypt/decrypt your file.
But keep in mind that if your users can view your Ruby script, there's basically no way to hide your data, since any encryptions requires some kind of keys.

BackgroundTransferService: what are some of the details of its operation?

I kick off 5 uploads (of varying size) via the BackgroundTransferService. I have the following questions about the way it works:
It seems that on the emulator it does 2 uploads at a time. Is this how it works on the actual device? Can I programmatically change this behavior?
Can I count on the uploads going out in the order that I submitted them? I seem to be getting conflicting results in my testing.
When I inspect the BackgroundTransferService in my application, does it contain requests from other apps as well or just mine?
Do I need to reconnect events for all the BackgroundTransferRequest objects when coming back from being tombstoned? What about coming back from being reactivated?
Do I need to disconnect events from the BackgroundTransferRequest when I remove it from the BackgroundTransferService.Requests collection?
When I try to upload a non-existing URL:Port (on the localhost), the TransferStatus is reported as WaitingForNonVoiceBlockingNetwork. The upload never actually completes/fails. Is this how it is on the device? Should I remove the request when it encounters this TransferStatus?
You cannot influence the behaviour of the BTS. If you don't like the way it works you can write the transfer functionality as part of your own application but then you have to handle running in the background yourself.
There is no guarantee on sequence.
The BTS may be handling requests from other apps but you won't be able to see the details. Requests() will only return details for your app.
Surely a quick test will tell you this.
It's good practice to.
Have you checked the TransferError property whe you reach this situation? This is a perfectly valild status in other situations and so you shouldn't treat this as a automatic fail.

Resources