Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Trusted Contributor
amrinder_singh
Posts: 158
Registered: ‎03-09-2010
My Device: 8900
My Carrier: developer

auto expires in 3 days

Greetings

 

 

I had made an application which i  want to sale ,

 

After 3 days ,the application will ask the user for the key for fully acces of the application.

 

for  three days ,  i want that user will use it for three days for trail version .

 

Sir ,how it would happened .

 

please sugest  for this .

 

 

Regards

Amrinder singh

Please use plain text.
Developer
Ted_Hopp
Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

Re: auto expires in 3 days

The first time the application runs, compute the trial expiration time (by adding the correct number of milliseconds to the current system time) and store this in a PersistentStore or RecordStore. Then, each time the application runs, compare the stored time to the current time to decide whether the trial version has expired. (The application can detect that it is running for the first time by the absence of the stored data.)

 

This is not foolproof. With a RecordStore, the user can simply delete the application (which will delete the RecordStore) and re-install it to get another trial period. If you use PersistentStore, the data will persist even if the application is deleted, provided you use a built-in data structure. However, it won't survive the device being wiped. In theory, a user could wipe the device, re-install the software, and get another trial period. Unless your trial version is really high-value, though, nobody would put themselves through such pain.

 

An elaboration on this is to connect to a server and send the device ID to both register an installation and obtain a trial expiration time. Wiping the device will not change the device ID and if the application is re-installed, it will receive the same trial expiration time. This has the obvious drawback that the application cannot start (at least the first time) without making a connection to a server. The scheme also has problems dealing correctly with the application running on simulators.




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.
Please use plain text.
Developer
QuiteSimple
Posts: 1,452
Registered: ‎11-06-2009
My Device: Torch 9810
My Carrier: WiFi

Re: auto expires in 3 days

 


Ted_Hopp wrote:

The first time the application runs, compute the trial expiration time (by adding the correct number of milliseconds to the current system time) and store this in a PersistentStore or RecordStore. Then, each time the application runs, compare the stored time to the current time to decide whether the trial version has expired. (The application can detect that it is running for the first time by the absence of the stored data.)

 


Actually a common install hack (which you can find on some popular sites providing cracked apps) is to set the device time an year later, then install the app, restart device and restore the correct time. This will grant you one year trial :smileyhappy: So if you want to have really robust solution, you need to implement a few more checks to protect the app against such hacks :smileyhappy:

 



"When you become a level 3 developer, you learn to communicate over the ether. I'm told that level 5 developers are ascend into a higher level of existence beyond the physical realm." gord888 @ crackberry
Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1154, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: auto expires in 3 days

There was some talks about that in a different post. The solutions were the server idea or to do both a persistence store and a file. The file has the start time and end time. Unless the user goes looking for the file to delete it then uninstalling and reinstalling the app or changing the time won't do anything.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
Developer
Ted_Hopp
Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

Re: auto expires in 3 days

Another approach is to program a limit on the number of times an app can be started. This can be instead of or in combination with a time limit.

 

@rcmaniac - I don't see how your approach defends against a user mucking with the date/time on the device. Couldn't the user set the device time to, say, one day after first installation?

 

If providing server-side support is not feasible, one defense to the install hack that QuiteSimple described is to grab the time from an NTP/SNTP server such as time.nist.gov instead of from the device. (This still has the downside of requiring Internet connectivity just to run the app. It also requires that firewalls be configured to allow UDP traffic on port 123.)




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.
Please use plain text.
Developer
Developer
CMY
Posts: 1,123
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: auto expires in 3 days

With the method that rcmaniac25 suggested, which i think he got from my post, I recreated the file each time so the timestamp would change. Then you could just check to see if the timestamp occurs after the current device time and disable the app. The user could just set the clock back at 11:59 PM each night, but if they want to o through that hassle, let them.

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1154, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: auto expires in 3 days

@Ted: I believe I did get it from CMY's post when someone had a similar question.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
Developer
Aviator168
Posts: 709
Registered: ‎09-10-2009
My Device: 8520, 8900, 9000, 9300, 9650, 9700, 9780, 9800, 9810, 9900, 9930
My Carrier: Verizon

Re: auto expires in 3 days

I just did something simular. I require the app to be activated with my server and the server generates a set of  hashes(keys) for the next few days on which users are allowed to use the app. When they pay through my server, the users have to activate it again to get a set of different keys and they serve as licenses.

Please use plain text.