• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Storing permanent data

 
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For licensing of my app, I am storing trial start date. And then after 7 days the trial will expire. Problem is user can simply click on "Clear Data" under manage applications and my trial start date will become null and my app will assume the application has just been downloaded and will start trial period again. Is there a way to store data so it cannot be deleted until application is uninstalled?

The only thing I could think of is give limited access for trial users and full access for licensed users. But I would really like to give full access for 7 days.

Thanks
Imad
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not store it in a file with an odd name? Then use Java IO to read the file. Make the file read-only.

Still crackable, but gets a lot of those that would just clear data.

Mark
 
Ranch Hand
Posts: 633
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can create a file insdcard or in application. If you have created file in application like then when application is uninstalled that file has been also deleted and you can't create file outside the application (except in sdcard) so you have to store the record of users on server side (i.e who have first installed trial application so next time they must have to buy standard version and not allowed for trial version). In sdcard create file as
 
Muhammad Imad Qureshi
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Pramod. But that means I'll be relying on the fact that SD card is available. I don't know if that's a reasonable assumption. If I create a file inside the application then I run the same risk a I did when I was storing data in "SharedPreferences". If user clicks "Clear Data", my values are gone. I think the best option for me is to give limited access for unlicensed version and full access for licensed version.

Thanks
Imad
 
Pramod P Deore
Ranch Hand
Posts: 633
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think if you stored data in application file then values will gone only after uninstalling application. If you stored some data in file then there clear option is disabled. If you stored data in sharedPreferences then clear option is enabled.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think if you stored data in application file then values will gone only after uninstalling application.
 
Muhammad Imad Qureshi
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Weig and Pramod. I really appreciate your reply. I also thought that the data I store in a file will not be deleted when a user clicks "Clear Data". But that's what I am seeing. I am "Google Level 8 API" for testing as licensing requires that. Here is my code where I am setting and getting date for my trial period. Please let me know if there is something wrong here.

Thanks
Imad

 
Muhammad Imad Qureshi
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just in case if fie name makes any difference, I am using following file name.

" ;

The reason for choosing this file name is a poor attempt to prevent user figuring out that this file determines the trial period of my app. As you can see I am not specifying any location. Does that makes a difference?
 
Muhammad Imad Qureshi
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys, thanks for all your help. I have resolved most of the issues. The only issue still remains is that file is deleted after user clicks "Clear Data". "Clear Data" option is not even there on older version of android that I am using on my droid phone. But it does show up in emulator where I am using "Google level 8" API. I see in eclipse in DDMS File explorer that all folders are gone except for lib folder. Is it okay to use "assets" folder for this purpose?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic