Getting GPS coordinates on Windows phone 7

Here’s a simple example: GeoCoordinateWatcher watcher; watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default) { MovementThreshold = 20 }; watcher.PositionChanged += this.watcher_PositionChanged; watcher.StatusChanged += this.watcher_StatusChanged; watcher.Start(); private void watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.Disabled: // location is unsupported on this device break; case GeoPositionStatus.NoData: // data unavailable break; } } private void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> … Read more

Change Location Mode to High Accuracy Programmatically Android

It is possible to get the device’s current location mode since API level 19 (Kitkat): public int getLocationMode(Context context) { return Settings.Secure.getInt(activityUnderTest.getContentResolver(), Settings.Secure.LOCATION_MODE); } These are the possible return values (see here): 0 = LOCATION_MODE_OFF 1 = LOCATION_MODE_SENSORS_ONLY 2 = LOCATION_MODE_BATTERY_SAVING 3 = LOCATION_MODE_HIGH_ACCURACY So you want something like if(getLocationMode(context) == 3) { // do … Read more

How to get Android GPS location

Here’s your problem: int latitude = (int) (location.getLatitude()); int longitude = (int) (location.getLongitude()); Latitude and Longitude are double-values, because they represent the location in degrees. By casting them to int, you’re discarding everything behind the comma, which makes a big difference. See “Decimal Degrees – Wiki”

Adding distance to a GPS coordinate

P0(lat0,lon0) : initial position (unit : degrees) dx,dy : random offsets from your initial position in meters You can use an approximation to compute the position of the randomized position: lat = lat0 + (180/pi)*(dy/6378137) lon = lon0 + (180/pi)*(dx/6378137)/cos(lat0) This is quite precise as long as the random distance offset is below 10-100 km … Read more

Reading the GPS data from the image returned by the camera in iOS iphone

The problem is that since iOS 4 UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; strips the geolocation out. To solve this problem you have to use the original photo path to get access to the full image metadata. With something like this: – (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { NSURL *referenceURL = [info objectForKey:UIImagePickerControllerReferenceURL]; ALAssetsLibrary *library = [[ALAssetsLibrary … Read more

Rotating an ImageView like a compass (with the “north pole” set elsewhere)

Your rotateImageView function should work just fine, however there are some things that needs to be changed in your rotation calculations. //This is where we choose to point it float direction = azimuth + LocationObj.bearingTo( destinationObj ); rotateImageView( arrow, R.drawable.arrow, direction ); The problem is that bearingTo will give you a range from -180 to … Read more

Open Settings app from another app programmatically in iPhone

Good news : You can open settings apps programmatically like this (works only from iOS8 onwards). If you are using Swift 3.0: UIApplication.shared.open(URL(string: UIApplicationOpenSettingsURLString)!) If you are using Objective-C: [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; For other lower versions (less than iOS8) its not possible to programatically open the settings app.

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