Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7405645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:26:05+00:00 2026-05-29T05:26:05+00:00

I have an application which should work only for 30 days or few days.

  • 0

I have an application which should work only for 30 days or few days.

It’s just a simple application which has some audio files playing to corresponding to images displayed with some text displayed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:26:06+00:00Added an answer on May 29, 2026 at 5:26 am

    There is only one way to truly achieve this:

    You will have to set up a
    server, and then whenever your application is started your app sends
    the phones unique identifier to the server. If the server does not
    have an entry for that phone id then it makes a new one and notes the
    time. If the server does have an entry for the phone id then it does a
    simple check to see if the trial period has expired. It then
    communicates the results of the trial expiration check back to your
    application. This approach should not be circumventable, but does
    require setting up a webserver and such.

    There are other ways(such as storing installation date somewhere) but then if user uninstalls your app, that info will be gone and when he reinstalls there is no way to know if he installed before.

    EDIT:
    Ok, since you want to go with SharedPreferences way, here is an example:

    private final SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
    private final long ONE_DAY = 24 * 60 * 60 * 1000;
    
    @Override
    protected void onCreate(Bundle state){
        SharedPreferences preferences = getPreferences(MODE_PRIVATE);
        String installDate = preferences.getString("InstallDate", null);
        if(installDate == null) {
            // First run, so save the current date
            SharedPreferences.Editor editor = preferences.edit();
            Date now = new Date();
            String dateString = formatter.format(now);
            editor.putString("InstallDate", dateString);
            // Commit the edits!
            editor.commit();
        }
        else {
            // This is not the 1st run, check install date
            Date before = (Date)formatter.parse(installDate);
            Date now = new Date();
            long diff = now.getTimeInMillis() - before.getTimeInMillis();
            long days = diff / ONE_DAY;
            if(days > 30) { // More than 30 days?
                 // Expired !!!
            }
        }
    
        ...
    }
    

    I haven’t compiled this but should give you an idea.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application which really should be installed, but does work fine when
I have a WPF application which so far has been client only, but now
I have made a small function which should print some InfoPath files. It is
I have an assembly which should not be used by any application other than
I have an application which has to live as a service, I create an
We have a desktop application which needs to expose API. Some people say: API
I want to have RSS feeds in my Django application, which should be viewable
Abstract I am writing an application which has a few object caches. The way
I want to put some sort of hook into windows (only has to work
I have an application with just a visible WebView component to it which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.