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.
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
Life is easy because we write the source code.....
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.
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.
Life is easy because we write the source code.....
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.
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?
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.