-
Jun 22nd, 2018, 06:31 PM
#1
Thread Starter
Lively Member
Count People that they currently use my application ?
Hello everyone well i was really interested in this question long time ago but didn't want to bother anyone with it but now i feel it's the correct time to ask.
Anyways as title says i want to count how many people are currently using my application and also how many people have it ( first opened ) ( something like total downloads but only when they open it ) and total opens.
So i was wondering how this could even happen ? I'm not sure ...
-
Jun 23rd, 2018, 12:11 AM
#2
Re: Count People that they currently use my application ?
You would need your application to contact a server when it starts up and when it exits. Exactly how you do that is up to you. A web service seems the most likely option.
Assuming a Windows Forms app, here's the sort of thing I would do in that case:
vb.net Code:
Imports Microsoft.VisualBasic.ApplicationServices
Namespace My
' The following events are available for MyApplication:
' Startup: Raised when the application starts, before the startup form is created.
' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.
' UnhandledException: Raised if the application encounters an unhandled exception.
' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
Partial Friend Class MyApplication
Private Sub MyApplication_Startup(sender As Object, e As StartupEventArgs) Handles Me.Startup
'Contact server to add new session here.
If My.Settings.IsFirstRun Then
'Contact server to add new download here.
My.Settings.IsFirstRun = False
End If
End Sub
Private Sub MyApplication_Shutdown(sender As Object, e As EventArgs) Handles Me.Shutdown
'Contact server to remove ended session here.
End Sub
End Class
End Namespace
-
Jun 23rd, 2018, 12:21 AM
#3
Re: Count People that they currently use my application ?
@jmcilhinney
How can My.Settings.IsFirstRun be anything other than indeterminate on first run of the application? You can't distribute an application with intact My.Settimgs values
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jun 23rd, 2018, 12:35 AM
#4
Re: Count People that they currently use my application ?
Originally Posted by .paul.
You can't distribute an application with intact My.Settimgs values
Of course you can. They are stored in the config file. Application-scoped settings are stored solely in the main config file and are read-only while User-scoped settings have their default value stored in the main config file and their current value stored in the user config file. Whatever value you set for IsFirstRun on the Settings page of the project properties is the value that will be stored in the main config file.
-
Jun 23rd, 2018, 12:48 AM
#5
Re: Count People that they currently use my application ?
Originally Posted by jmcilhinney
Of course you can. They are stored in the config file. Application-scoped settings are stored solely in the main config file and are read-only while User-scoped settings have their default value stored in the main config file and their current value stored in the user config file. Whatever value you set for IsFirstRun on the Settings page of the project properties is the value that will be stored in the main config file.
That requires distributing the config file with the executable. I don't think you should've omitted that information...
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jun 23rd, 2018, 02:08 AM
#6
Re: Count People that they currently use my application ?
Originally Posted by .paul.
I don't think you should've omitted that information...
I don't think I should have to explain the basics of programming every time I post. Deploying an executable's dependencies with that executable is not something I feel the need to explain every time I post something about application settings.
-
Jun 23rd, 2018, 09:08 AM
#7
Re: Count People that they currently use my application ?
I'd use a php script to record activity information, then to run your online php script...
Code:
Dim request As HttpWebRequest = DirectCast(HttpWebRequest.Create(New Uri("http://www.yoursite.com/records.php?app=yourAppName")), HttpWebRequest)
request.Method = WebRequestMethods.Http.Get
Dim response As HttpWebResponse = DirectCast(request.GetResponse(), HttpWebResponse)
' process response here
response.Close()
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jun 23rd, 2018, 03:04 PM
#8
Re: Count People that they currently use my application ?
Writing the new user on app start is certainly necessary, but writing the user exit when the app shuts down is probably not good enough. If your app terminates abnormally (from the task manager for example), you would never write the user exit.
To be thorough, you would need to run a script on the server from cron for linux server or the Microsoft equivalent (task scheduler?). The script would run on a timer and it would check to see if users are to old, and if so, then they would be deleted. Your app would then constantly be trying to add the user to the data table using INSERT IGNORE for a MySQL server or INSERT INTO...WHERE NOT EXISTS for SQL. You would also want the app to post at a rate much faster the the cron job runs for it to be effective.
Last edited by kebo; Jun 24th, 2018 at 07:59 AM.
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
-
Jun 24th, 2018, 04:14 AM
#9
Lively Member
Re: Count People that they currently use my application ?
I'm not sure if I've picked this up correctly but you could could just store values in a database.
as jmcilhinney said, check to see if application is FirstRun, if it is, then get "Downloads" value from DB and +1 to it, while the application is running add a +1 to the value of "RunningApp" in the DB and on close -1 from the value. that should give you numbers of running apps and downloaded apps
I'm not entirely sure if this would be the most efficient but it should work, please correct me if i am incorrect.
Luke
-
Jun 24th, 2018, 06:54 AM
#10
Re: Count People that they currently use my application ?
Originally Posted by Weeluke
I'm not sure if I've picked this up correctly but you could could just store values in a database.
as jmcilhinney said, check to see if application is FirstRun, if it is, then get "Downloads" value from DB and +1 to it, while the application is running add a +1 to the value of "RunningApp" in the DB and on close -1 from the value. that should give you numbers of running apps and downloaded apps
I'm not entirely sure if this would be the most efficient but it should work, please correct me if i am incorrect.
Luke
That's certainly what you would do but the thing is that you need a central database to store that information, so how does the client connect. The answers provided so far have really been about what happens at the client end, rather than at the server.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|