0

I am beginner in android programming and I am developing an app in android where I want to save time and date when an app start. Are there any libraries , which will help me implement my idea?

Pol
  • 27
  • 7

1 Answers1

1

you can get time by using below code

Calendar c = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("dd:MMMM:yyyy HH:mm:ss a");
String strDate = sdf.format(c.getTime());

what you can do is when your app is installed then run that code and save that strDate in database or in sharedprefs and later on you can get that.

above is when you want to save time when you install your own application, and if you want to know that whenever an app is installed and you want to save the start time of that app then have a look at below link that might help you.

How to detect new apps in an Android device

Community
  • 1
  • 1
Moubeen Farooq Khan
  • 2,875
  • 1
  • 11
  • 26
  • Thx for the reply but with this code will i be able to record the start of any app or only my own? – Pol Aug 10 '15 at 07:33
  • @Pol check the link that i have provided you by using that code you can save the time of other app in your apps too. By using above code you can only save time of your own app. but the link that i have provided in that you can detect the installation of an app and then you can save its time buy using above code. – Moubeen Farooq Khan Aug 10 '15 at 07:38
  • @MoubeenFarooqKhan I think he wants to save time of app start not app install – Emil Aug 10 '15 at 07:39