The very least you can do is use application-specific storage for your
timestamp value.
The memory card is accessible and writable by anyone, including other
applications and the user, and storing the timestamp as text is
practically begging for someone to mess with it.
I'd suggest you use SharedPreferences:
http://developer.android.com/reference/android/content/SharedPreferences.html
... which can write and read "long" type values (your timestamp).
Shared prefs are cleared when the app is uninstalled, so doing this and
installing again will start your trial period again. But without an
off-phone (server) storage, there is not much you can do anyway.
-- Kostya
05.02.2011 17:30, MobileVisuals пишет:
I saw your posting about the DataOutputstream now, so I try that
instead of PrintWriter. I know that these files can be changed by
users, but most people don'tknow how to do that. Do you know a better
idea for a trial version? I don't have time for a server based
solution.
On Feb 5, 9:52 am, Kostya Vasilyev<[email protected]> wrote:
#...)
You do know that files stored on the memory card can be very easily
changed by the user?
-- Kostya
05.02.2011 11:44, MobileVisuals пишет:
I am making a timelimited trial version of a live wallpaper app. I
need to store the timestamp on the SD card, to keep track of the
trialperiod. I can get the current time with
long currentTime=System.currentTimeMillis();
I want to store this with a FileOutputStream object. The problem is
that FileOutputStream only has write methods for byte vectors. Byte
can only be up to 128, and timestamps are bigger numbers than that. I
assume that I have to convert the timestamp number, which is a long,
into a byte vector. Is there any easy way to do this?
Or is there any other way of storing the long value without using the
write methods for byte vectors?
--
Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com
--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en