• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Android Studio project to set an specific expiration date of one year

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi - New to Java and I followed a tutorial to create a quiz app for android. I would like to have it have a run life of one year then the people who have it on their phone delete the old one and download the new updated version. maybe I'm asking the wrong questions but I cant seem to find any help on coding this. does anyone have suggestions?
 
Marshal
Posts: 80059
410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

I shall move you to our Android forum.
I suggest you break that task down into smaller pieces. Maybe start with finding out the age of a file and how to delete it. Look in the files part of the Java™ Tutorials.
 
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The date could be stored as a preference - then the app has always access to it.

Why delete the app? Why not just put a new app version in the Play Store that includes the new quiz as well as the old one? Or, even better, have the app download the quiz data from your own server, thus allowing you to update quizzes without having to update the app.
 
Richard Rupert
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I Took a look at those forums. could not fine what I'm looking for. will keep looking. I want the app to stop working so that there isn't many different versions of the app in the public. just one at a time. therefore while people take a course from me they can use the app for study purposes. then once they have left the course the app will stop working. I am also having issues loading my Db onto the app in Android Studio from Db browser. but one problem at a time. At least the app is running.
 
Rancher
Posts: 5076
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

have it have a run life of one year


When does the year start?  
When you are finished developing?  You can control this by having it in the code
When the user installs the app?   A user can uninstall and reinstall the app to reset the date.
 
Tim Moores
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Richard Rupert wrote:I Took a look at those forums. could not fine what I'm looking for. will keep looking. I want the app to stop working so that there isn't many different versions of the app in the public.


Did you understand what I meant by taking the approach of storing the date of the first run in a preference? So you can retrieve it during later runs and decide if the time has run out.
 
Richard Rupert
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good Morning : Tim - I understand the concept of the app knowing what date it was installed and then telling it that after this date or 365 days later it is to stop working. its just how to code that and where. I am using a "StartingScreenActivity" would that be coded in the top line of that file and if so in the java .file or .xml ---- Like is said , complete newbie at any of this - online tutoring course and a dozen websites. I'm a marine navigation Officer by trade and I'm trying to create a study quiz app for the people I'm training. I see most people are looking at their phones a lot so I may as well try to reach them that way. Norm -  I don't think I've thought that far ahead. I suppose 1 year from install but I haven't figured out how to disperse the app yet. I am thinking from a web site like WiX with a log in. but that's a whole new web tutorial. Thank you for your help and interest. I think I have a lot of studying to do still.
 
Norm Radder
Rancher
Posts: 5076
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I'm a marine navigation Officer by trade and I'm trying to create a study quiz app for the people I'm training


That caught my attention.  I did a lot of navigation while sailing.  
One of my first Android apps (circa 2013) was a quiz for USCG questions.  I just uploaded it to Github: https://github.com/NormR/
It was developed in Eclipse.  You are welcome to it.
 
Sheriff
Posts: 28344
97
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Richard Rupert wrote:I haven't figured out how to disperse the app yet. I am thinking from a web site like WiX with a log in...



If you're going to distribute an Android application then putting it in the Google Play Store is the way to do that. Other distribution methods do exist but they are untrustworthy and commonly suspected of being tools for getting malware onto people's devices. So the Play Store is the way I would recommend.

And once you've done that, your app should then behave in the standard way that Android apps behave. In particular if you want people to install a new version, you use the Play Store to get it distributed. Would it be fair for me to assume that you have an Android device yourself? If so then you have already seen how it handles app updates.

What I'm saying is, there's a standard way for Android apps to behave. Trying to make your app behave differently is not a good idea unless there's a really good reason why it has to behave differently. And so far I don't think you have a really good reason, you just have some things you want to happen. In my opinion you should start by saying "I'm going to write a standard Android app" and then go on to say "I want my app to behave in this particular way".

As for your specific question: it sounds like "Can only be used for 365 days" is the most important feature of the app. But probably there's a lot more important features, in fact I'm sure of it. I would recommend getting the app to quiz people first and worry about implementation details later.
 
Richard Rupert
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good point Paul . I think I have a limited audience for this app . the people I would instruct and the people that I work with. couple thousand maybe on a good day. I did not think google play would have been the best distro for it. I have not read the regs on the play store - do they allow limited apps and if so I guess I could then just do a user name and password style let it lapse and change the user name and log in after. I am still trying to get it up and running with a filled data base. I just have the base files in it now and it works on my phone but When I tried to open the data file in my device manager I could not replace the apps data base. - who knew coding was hard ;)
 
Richard Rupert
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Norm  - I am taking a look at what you have - am I allowed to alter the source code and questions data base ? I am downloading Eclipse to see if I can learn that - right now I have Android studio and you app did not import well.
 
Norm Radder
Rancher
Posts: 5076
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

 am I allowed to alter the source code and questions data base ?


Absolutely.  It is free for whatever you want to do with it.  It's my early attempt at an Android app so I can't vouch for its style.
 
Richard Rupert
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good evening Norm I imported your app into Eclipse and it gave me a lot of errors. I used the instructions in this forum to import existing projects into this workplace. any suggestions?
 
Norm Radder
Rancher
Posts: 5076
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you copy the text of the error messages and paste it here?
 
Richard Rupert
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Description Resource Path Location Type
AlertDialog cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 462 Java Problem
android cannot be resolved to a variable USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 139 Java Problem
ArrayAdapter cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 43 Java Problem
ArrayAdapter cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 139 Java Problem
ArrayAdapter cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 139 Java Problem
ArrayAdapter cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 140 Java Problem
AssetManager cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 192 Java Problem
AssetManager cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 481 Java Problem
AsyncTask cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 111 Java Problem
AttributeSet cannot be resolved to a type ShowDiagramView.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 25 Java Problem
Bitmap cannot be resolved to a type ShowDiagramView.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 21 Java Problem
Bitmap cannot be resolved to a type ShowDiagramView.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 32 Java Problem
Bitmap cannot be resolved to a type ShowDiagramView.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 33 Java Problem
Bitmap cannot be resolved to a type ShowDiagramView.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 54 Java Problem
Bitmap cannot be resolved to a type ShowDiagramView.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 58 Java Problem
Bitmap cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 145 Java Problem
Bitmap cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 191 Java Problem
Bitmap cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 193 Java Problem
BitmapDrawable cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 160 Java Problem
BitmapFactory cannot be resolved USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 196 Java Problem
Bundle cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 219 Java Problem
Bundle cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 259 Java Problem
Button cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 178 Java Problem
Button cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 178 Java Problem
Canvas cannot be resolved to a type ShowDiagramView.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 51 Java Problem
Context cannot be resolved to a type ShowDiagramView.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 25 Java Problem
Context cannot be resolved to a variable USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 152 Java Problem
DialogInterface cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 315 Java Problem
DialogInterface cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 335 Java Problem
DialogInterface cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 467 Java Problem
Gravity cannot be resolved to a variable USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 162 Java Problem
LayoutInflater cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 152 Java Problem
LayoutInflater cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 152 Java Problem
ListActivity cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 40 Java Problem
ListActivity cannot be resolved to a type USCG_QuestionsActivity.java /USCG APP/app/src/main/java/com/normsstuff/uscg_questions line 211 Java Problem

 
Richard Rupert
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Website wanted me to buy some pie for the full post 153 errors
 
Norm Radder
Rancher
Posts: 5076
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know what is wrong with your setup of Eclipse.  I just imported the extracted files from the downloaded zip file and was able to compile and run the app in my Android VM running on Oracle.

In Eclipse Did you run the Window/Android SDK Manager to get the android bits and pieces needed?
 
Richard Rupert
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey Norm  - I have tried to fix my copy of eclipse IDE 2018‑09 - unfortunately I'm not able to figure out why its not opening your code. and the websites are not as helpful as I thought they might be. its seems to be the latest version. I think I will continue to plod down my original path and see where it takes me. Thank you for your help
 
Norm Radder
Rancher
Posts: 5076
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

why its not opening your code


I'm not sure what that means.

Most of the error messages you posted were from missing android classes which are in jar files that need to be loaded into Eclipse.

From Eclipise Help:


Version: 1.4.1.v20120912-144938-8R7xFOXFLWUl7PpNBh_HIGkb4
Build id: M20130204-1200



The adt bundle:
D:\AndroidDevelopment\adt-bundle-windows-x86_64-20140702\eclipse
 
Norm Radder
Rancher
Posts: 5076
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Android studio and you app did not import well.


I was curious about what problems there could be (I don't normally use Android Studio) so I started Android Studio to test doing an import.  After about a half hour of loading and updating AS I was able to import the contents of the unzip of the zip file I had downloaded from Github.  Then I had to battle AS some more for it to get the tools it uses to work.  Something about gradle version incompatibility.  After almost an hour I was able to create a AVD and Run the app without making any changes to my files.
 
Richard Rupert
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Norm - I tried a few more times  - im still getting errors . don't know what im doing wrong. My app is up and running with 20 questions to start just to see if anyone wants to use it. I will keep trying .. do some reading figure stuff out. Thanks for all your help
 
Norm Radder
Rancher
Posts: 5076
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

im still getting errors  


From which IDE? AS or Eclipse.  
I don't work with AS at all because of the headaches I get trying to get past its housekeeping.  I don't currently have any android projects, so until I find something I want to have, I'll probably not be doing any development.
 
Richard Rupert
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using Android Studio 3.2.1  built Oct 2018  and I downloaded Eclipse Java 2018 09. Am I using the wrong products possibly?
 
Norm Radder
Rancher
Posts: 5076
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, I don't know about versions.  My Eclipse is several years old. It's in adt-bundle-windows-x86_64-20140702
I understand the newer versions don't support android development.
My AS is 3.2
 
Norm Radder
Rancher
Posts: 5076
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See this link for more Eclipse info:   https://stackoverflow.com/questions/27449206/what-is-the-final-version-of-the-adt-bundle
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic