How to get Internet Speed? [closed] - android

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
Currently, I am struggling to show the internet speed consistently in the status bar. What I am able to do is, finding the internet speed by the old approach(Upload & download some file from/to server and using TrafficStats API). I tried some of the play store apps, they all displaying the internet speed when the user opens up any app which uses the internet. I want to implement the same feature. I believe they either use a broadcast receiver or service. How can I implement the same?
Or is there any library which does the same or any other better approach?

The problem with displaying an internet speed is that it is always going to be 'historical' or an estimate - i.e. even if you were able to achieve 300Mbps 1 second ago it does not mean you will be able to achieve it now.
Bearing this in mind, the approach you already outlined is as reliable as any - i.e. measure the round trip time for a known size of data. If accuracy is important to you, this is probably the most accurate provided you are confident of the turnaround time on the server side.
You can listen to Android Network events which will tell you when the type of network connections has changed etc - the recommended approach has changed over API levels but this is a good starting point: https://developer.android.com/training/monitoring-device-state/connectivity-monitoring
For your example it sounds like you want to get as recent as possible Network Stats rather than connectivity changes - for that the 'NetworkStatsManager' is probably the best match.
Provides access to network usage history and statistics. Usage data is collected in discrete bins of time called 'Buckets'.
https://developer.android.com/reference/android/app/usage/NetworkStatsManager

Related

Detecting other devices location relative to your own via Wifi Direct [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am working on a personal project where by I would like to create something like a radar displaying the devices around me that are wifi direct enabled. The devices detected should be displayed on the radar view relative to my devices position (which would act as the center of the view).
I cannot find anything in the API's that allows me to do this and could use an example, failing that at least a push in the right direction to get started.
I think you could do it using the technique outline here in the Android docs. (I'm now experimenting with it, but for different purposes). Basically, this lets devices broadcast and discover DNS-SD TXT records. As you'll see in the Android docs, you can load a Map object into one of these records and the receiving device can read it. It doesn't support a lot of bytes (I was trying to jam in an image converted to Base64 strings and that was way too much data), but it would support strings for latitude and longitude. Users would need to install your app on both sides for it to work, of course. Interactions can be passive until such time as you need to trade larger amounts of data, at which time a socket needs to be setup, etc., which requires the user to click to accept via a popup dialog.
If you copy/paste their sample code, it will pretty much get you going with something you can build on.

How to game calculate the time for completion of work? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
i be wondering How to game calculate the time for completion of work?
e.x:clash of clans find something update are done.
i believe someone want say get the time by server.but even i be offline can receive notification which say done.even i do change clock of phone nothing change in game if i change time of phone.
The time that is used to determine the yield from objects existing in clash of clans is maintained from a centralized server.
If you wanted to build an app that would calculate the times required to do things in game I think the rout to go would be to
A) ask the developers for the code (unlikely to be fruitful)
B) reverse compile the code. (potentially illegal)
C) Hand document the times required for in game events to happen (game w/notes)
D) Do a literature review to find data on the game
From this Data you may be able to craft a sort of clash of clans advisory app, but I doubt it will be easy to dupe such a consistently maintained app with hacks as simple as changing you're clock.

how to get location at regular intervals using android api? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How do I set Android app to retrieve location of a device once a minute?
Do I need to use MongoDB and Node.JS stack instead of MySQL due to high load nature of a service? I.e. there will be high amount of simultaneous location requests from clients to a single server.
MongoDB (NoSQL) is not a panacea for scaling. Your description of a problem looks like it could use the advantages of structured storage, thus SQL might be a good choice afterall.
And I must use Node.js and socket.io with android
Up to you, but there is no must in using this technology stack.
// Set the update interval to 1 minute
mLocationRequest.setInterval(60000);
See the documentation here.
Use the LocationRequest.setInterval to receive an location update each minute.
Update interval
Set by LocationRequest.setInterval(). This method sets the rate in milliseconds at which your app prefers to receive location updates. If no other apps are receiving updates from Location Services, your app will receive updates at this rate.
You can find a downloadable example at http://developer.android.com/training/location/receive-location-updates.html

Detecting that a user has entered a physical location with her Android / iOS device [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
If a user has a particular app installed on her phone but the app is not running in the foreground, what is the best way to detect that she has entered a physical location with the Android / iOS device? Assume that the app has all the required permissions and in the case of Android, there is a background service running every minute.
I can think of polling the GPS but the drawback is that the user might have switched off her GPS.
The same would happen with a possible bluetooth wake-up if bluetooth is off. Ditto for WiFi.
Could something like supersonic sound emitted from a hardware placed at the entrance of the location work? (Something like Tagtile perhaps?)
Which of these 4 would you most rely on? for Android? for iOS? Or would you rather use some other method?
It is possible to track a users whereabouts. While I will not go on to explain how the entire process is done (as it would be the equivalent of writing my own tutorial on the subject), it is gone over in detail in the Apple Docs, covered here(I believe what you are looking for is the CLLocation).
This can even run in the background, as also covered in the Apple Docs in many place, one of them being here.
For an iOS app, that is what I would recommend.
If the user turns off Location Tracking and/or their GPS, I believe you are going to have to deal with it. Tracking a person, when they have not given permission or explicitly denied the permission to do so, is illegal in many countries.
EDIT
Escaping my mind for a moment was the Google Location API. Probably one of the most known and used Location services will get you your tracking for Android.
EDIT 2
If a person has turned off their GPS or Wifi, there would not be a way to tell their physical location. If you were able to track a person when their Wifi or GPS was turned off would classify your app as spyware, and would not be a good idea.

Whats the best approach for my project? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Am developing a tracking app for android where user will be tracked for 8hrs minimum a day.
data will be retrieved from GPS and once data retrieved it will be sent to server.
What I have done till now is
data will be retrieved every 30 seconds if he is on bike (speed >= 13mph) if less than that then every 1sec.
created a activity and using requestlocationupdates() retrieving data and sending to server using asynchronous tasks.
I saw many ppl recommending service for long run tasks and alarm manager instead of using minTime and minMeters of requestlocationupdates().
So am confused.
What would be best approach for this? am mainly developing it for low end devices so battery is my main constraint.
And tracking should not get stopped.
If battery is your concern, you don't want to use GPS. GPS kills the battery. You want to use network location instead. Its less accurate, but much nicer on the battery.
I did something similar for driving, I used a service and an alarm rather than the minimum time and distance, just because using fixed time intervals made my math easier.
If using Google Play Services is an option, APIs like the DetectedActivity might be useful for you. From what I've read, they spent some time working on making the API smart about things like battery life and location services.

Categories

Resources