Calculate compass bearing / heading to location in Android

Ok I figured this out. For anyone else trying to do this you need: a) heading: your heading from the hardware compass. This is in degrees east of magnetic north b) bearing: the bearing from your location to the destination location. This is in degrees east of true north. myLocation.bearingTo(destLocation); c) declination: the difference between … Read more

Get GPS location via a service in Android

I don’t understand what exactly is the problem with implementing location listening functionality in the Service. It looks pretty similar to what you do in Activity. Just define a location listener and register for location updates. You can refer to the following code as example: Manifest file: <uses-permission android:name=”android.permission.ACCESS_FINE_LOCATION” /> <uses-permission android:name=”android.permission.ACCESS_COARSE_LOCATION” /> <application android:icon=”@drawable/ic_launcher” … Read more

Test if links are external with jQuery / javascript?

I know this post is old but it still shows at the top of results so I wanted to offer another approach. I see all the regex checks on an anchor element, but why not just use window.location.host and check against the element’s host property? function link_is_external(link_element) { return (link_element.host !== window.location.host); } With jQuery: … Read more

Indoor Positioning System based on Gyroscope and Accelerometer

Gyros and accelerometers are not enough. You get position by integrating the linear acceleration twice but the error is horrible. It is useless in practice. Here is an explanation by (Google Tech Talk) at 23:20. I highly recommend this video. As for indoor positioning, I have found these useful: RSSI-Based Indoor Localization and Tracking Using … Read more

Android Google Maps API V2 Zoom to Current Location

Try this coding: LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); Location location = locationManager.getLastKnownLocation(locationManager.getBestProvider(criteria, false)); if (location != null) { map.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location.getLatitude(), location.getLongitude()), 13)); CameraPosition cameraPosition = new CameraPosition.Builder() .target(new LatLng(location.getLatitude(), location.getLongitude())) // Sets the center of the map to location user .zoom(17) // Sets the zoom .bearing(90) // Sets the orientation … Read more

Difference between LocationRequest setInterval (long millis) and LocationRequest setFastestInterval (long millis)

Based on the relevant Android documentation: setInterval(long) means – set the interval in which you want to get locations. setFastestInterval(long) means – if a location is available sooner you can get it (i.e. another app is using the location services). For example, you start your application and register it via setInterval(60*1000), that means that you’ll … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)