Search Results

Search found 271 results on 11 pages for 'mapview'.

Page 10/11 | < Previous Page | 6 7 8 9 10 11  | Next Page >

  • Platform game collisions with Block

    - by Sri Harsha Chilakapati
    I am trying to create a platform game and doing wrong collision detection with the blocks. Here's my code // Variables GTimer jump = new GTimer(1000); boolean onground = true; // The update method public void update(long elapsedTime){ MapView.follow(this); // Add the gravity if (!onground && !jump.active){ setVelocityY(4); } // Jumping if (isPressed(VK_SPACE) && onground){ jump.start(); setVelocityY(-4); onground = false; } if (jump.action(elapsedTime)){ // jump expired jump.stop(); } // Horizontal movement setVelocityX(0); if (isPressed(VK_LEFT)){ setVelocityX(-4); } if (isPressed(VK_RIGHT)){ setVelocityX(4); } } // The collision method public void collision(GObject other){ if (other instanceof Block){ // Determine the horizontal distance between centers float h_dist = Math.abs((other.getX() + other.getWidth()/2) - (getX() + getWidth()/2)); // Now the vertical distance float v_dist = Math.abs((other.getY() + other.getHeight()/2) - (getY() + getHeight()/2)); // If h_dist > v_dist horizontal collision else vertical collision if (h_dist > v_dist){ // Are we moving right? if (getX()<other.getX()){ setX(other.getX()-getWidth()); } // Are we moving left? else if (getX()>other.getX()){ setX(other.getX()+other.getWidth()); } } else { // Are we moving up? if (jump.active){ jump.stop(); } // We are moving down else { setY(other.getY()-getHeight()); setVelocityY(0); onground = true; } } } } The problem is that the object jumps well but does not fall when moved out of platform. Here's an image describing the problem. I know I'm not checking underneath the object but I don't know how. The map is a list of objects and should I have to iterate over all the objects??? Thanks

    Read the article

  • How do I zoom an MKMapView to the users current location without CLLocationManager?

    - by Danny Tuppeny
    With the MKMapView there's an option called "Show users current location" which will automatically show a users location on the map. I'd like to zoom into this location without adding a CLLocationManager (this seems silly if the map is already taking care of this). The problem is, I can't find a nice event that fires when the map has figured out the users location, so I don't know where to put the code that will zoom/scroll. I tried using the viewForAnnotation method like this: - (MKAnnotationView *) mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation { if ([annotation class] == [MKUserLocation class] ) { NSLog(@"UserLocation annotation"); return [map viewForAnnotation:annotation]; } return nil; } However it doesn't fire if the users location is off the screen. Is there a way to be notified when an MKMapView has got the user location so I can zoom in to it, or do I just have to add a CLLocationManager for this?

    Read the article

  • UIPopOver from MKAnnotation callout

    - by Nithin
    Hi all, i'm developing an application for iPad. I have a mapview with several annotations. I need to show a pop-over when the accessory callout method is called, so that the arrow of the popover will point towards the annotation. I am trying to use 'initWithRect' method of the popover, but i'm not getting the co-ordinates(the CGRect in view) of the annotation correctly. How can i get the co-ordinates of an annotation? I need to find out the location of that annotation in the view.

    Read the article

  • iPhone Development: CoreLocation and MapKit

    - by Mustafa
    How bad is it to use Location Manager to retrieve the location information when MapView.showUserLocation is also TRUE? I have a situation where i want to show the blue dot to indicate the user's current location, and i want to record the user's current location after some time interval. Having said that, there may be situations where the user's current location is now being shown, but i still want to get the user's current location. I think i'll have to use the Location Manager in my controller class, but setting showUserLocation = YES would mean that i'll be draining more battery since two Location Managers are working at the same time? Is this assumption correct?

    Read the article

  • iPhone Mapkit Blue Dot / User Location Region Zoom Question

    - by user290031
    Hey All, Is is possible to set a region based on a current location in a mapview only one time. I want my iphone app to get the current location, zoom into that current location, and then allow the user to scroll around. However, because my setRegion code is in my didUpdateToLocation function, every time the current location is updated, so is the region, and I can't scroll around on the map. I tried putting this setRegion code in the viewDidLoad function, but the user's current location isn't initialized at this point, so it doesn't work right. Any ideas?

    Read the article

  • Saving Multiple Annotations -NSUserDefaults

    - by casillas
    I came cross this code as shown below.In the following code, I could able to save only one single annotation, however I have an array of annotations, I could not able to save them with single NSUserDefaults To save: NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; [ud setDouble:location.latitude forKey:@"savedCoordinate-latitude"]; [ud setDouble:location.longitude forKey:@"savedCoordinate-longitude"]; [ud setBool:YES forKey:@"savedCoordinate-exists"]; [ud synchronize]; Edited: -(void)viewDidLoad NSUserDefaults *ud=[NSUserDefaults standardUserDefaults]; if([ud boolForKey:@"save-exist"]) { NSMutableArray *udAnnotations=[[NSMutableArray alloc]initWithArray: [ud objectForKey:@"annotationsArray"]]; NSLog(@"%d",[udAnnotations count]); } else{ [self addAnno]; } -(void)addAnno { [mapView addAnnotations:annotationArray]; NSUserDefaults *ud=[NSUserDefaults standardUserDefaults]; [ud setObject:annotationArray forKey:@"annotationsArray"]; [ud setBool:YES forKey:@"save-exist"]; [ud synchronize]; }

    Read the article

  • RegexKitLite Runtime Crash

    - by Hasan Can Saral
    I'm overlaying the mapview and using RegexKitLite. I couldn't make it work. I've downloaded .m and .h files and added to the project. Also I tried, adding libicucore.dylib or libicucore.A.dlib or adding -licucore to other compiler flags field. Still getting the error: 2012-04-01 19:38:04.633 sennerdeysen[907:15803] -[__NSCFString stringByMatching:capture:]: unrecognized selector sent to instance 0x88b6a00 2012-04-01 19:38:04.634 sennerdeysen[907:15803] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString stringByMatching:capture:]: unrecognized selector sent to instance 0x88b6a00' Any idea? Latest Xcode but the sdk is 4.3 Without ARC or anything else that iOS 5.0 SDK provides.

    Read the article

  • MKMapView not centered on pin

    - by Val Smith
    Hi all, I have an mkmapview that i'm currently adding pins to, but for some reason when I call [mapView setRegion:[detailItem coordinateRegion] animated:YES]; the pin is off-centered (toward the right side of the screen) on the map. Here is the code for [deailItem coordinateRegion]: - (MKCoordinateRegion)coordinateRegion { MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } }; region.center = self.coordinate; region.span.longitudeDelta = 0.0075f; region.span.latitudeDelta = 0.0075f; return (region); } I'm setting the coordinateRegion's center to the object's x,y coordinate, so why is it off-center on the map? I feel like there's something I'm missing here... ::Val::

    Read the article

  • Continual crashing in MKMapView annotationContainer:viewForAnnotation

    - by Oscar Goldman
    I've looked at other reports on this, and none seems to apply. Our app is being crippled by frequent (but not reliably reproducible) crashes like this: Reports of this turn up a lot on the Web, but many seem to go unsolved. I'm not doing anything crazy, just showing the user position and one marker on the map. I followed the examples I could find, and I've looked at the code for goofs but can't find any. Here's how my MapView delegate handles viewForAnnotation: The crash appears to be associated with a change in the user's location, but once the user-location marker is added, I don't mess with it. When I need to refresh the one other map marker, I skip the user marker when removing the other one: The delegate is the controller for the whole screen, so it's not being deallocated; the crash occurs while the screen is up. Not that it matters, but the map display looks like this: Any guesses or insight would be much appreciated! This is on iOS 5.0.1.

    Read the article

  • Adding an overlay to Google maps with path taken

    - by user341652
    Hi, I am trying to write a class to track a person's location(s), and to draw the path they've taken on a MapView. This feature of the program is for the user to track their speed, distance, path, etc. while running/cycling (or whatever else) using their Android phone. This is my first Android application, and I am not sure how to do the Overlay object for the MapView. I also wanted to see if anyone had opinions on the GPS-Tracking part I have written (if it would work, if there is a better way of doing it, code examples would be helpful). I currently have this for my GPSTrackerService: package org.drexel.itrain.logic; import java.util.Vector; import org.drexel.itrain.Constants; import android.app.Notification; import android.app.NotificationManager; import android.app.Service; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.location.GpsSatellite; import android.location.GpsStatus; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.location.GpsStatus.Listener; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; import android.preference.PreferenceManager; public class GPSTrackingService extends Service { private static final int MAX_REASONABLE_SPEED = 60; private static final String TAG = "OGT.TrackingService"; private Context mContext; private LocationManager mLocationManager; private NotificationManager mNotificationManager; private Notification mNotification; private int mSatellites = 0; private int mTrackingState = Constants.GPS_TRACKING_UNKNOWN; private float mCurrentSpeed = 0; private float mTotalDistance = 0; private Location mPreviousLocation; private Vector<Location> mTrackedLocations; private LocationListener mLocationListener = null; private Listener mStatusListener = null; private IBinder binder = null; @Override public void onCreate() { super.onCreate(); this.mContext = getApplicationContext(); this.mLocationManager = (LocationManager) this.mContext.getSystemService( Context.LOCATION_SERVICE ); this.mNotificationManager = (NotificationManager) this.mContext.getSystemService( Context.NOTIFICATION_SERVICE ); this.mTrackedLocations = new Vector<Location>(); this.binder = new Binder(); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this.mContext); binder = new Binder(); if(mTrackingState != Constants.GPS_TRACKING_UNKNOWN) { createListeners(); } } @Override public void onDestroy() { destroyListeneres(); } @Override public IBinder onBind(Intent intent) { return binder; } @Override public boolean onUnbind(Intent intent) { return true; } public boolean acceptLocation(Location proposedLocation) { if(!(proposedLocation.hasSpeed() || proposedLocation.hasAccuracy())) { return false; } else if(proposedLocation.getSpeed() >= MAX_REASONABLE_SPEED) { return false; } return true; } public void updateNotification() { //TODO Alert that no GPS sattelites are available (or are available) } public void startTracking() { this.mTrackingState = Constants.GPS_TRACKING_STARTED; this.mTotalDistance = 0; this.mCurrentSpeed = 0; this.mTrackedLocations = new Vector<Location>(); this.mPreviousLocation = null; createListeners(); } public void pauseTracking() { this.mTrackingState = Constants.GPS_TRACKING_PAUSED; this.mPreviousLocation = null; this.mCurrentSpeed = 0; } public void resumeTracking() { if(this.mTrackingState == Constants.GPS_TRACKING_STOPPED){ this.startTracking(); } this.mTrackingState = Constants.GPS_TRACKING_STARTED; } public void stopTracking() { this.mTrackingState = Constants.GPS_TRACKING_STOPPED; destroyListeneres(); } private void createListeners() { /** * LocationListener receives locations from */ this.mLocationListener = new LocationListener() { @Override public void onStatusChanged(String provider, int status, Bundle extras) { // TODO Auto-generated method stub } @Override public void onProviderEnabled(String provider) { // TODO Auto-generated method stub } @Override public void onProviderDisabled(String provider) { // TODO Auto-generated method stub } @Override public void onLocationChanged(Location location) { if(mTrackingState == Constants.GPS_TRACKING_STARTED && acceptLocation(location)) { if(mPreviousLocation != null) { //Add the distance between the new location and the previous location mTotalDistance += mPreviousLocation.distanceTo(location); } if(location.hasSpeed()) { mCurrentSpeed = location.getSpeed(); } else { mCurrentSpeed = -1; //-1 means speed N/A } mPreviousLocation = location; mTrackedLocations.add(location); } } }; /** * Receives updates reguarding the GPS Status */ this.mStatusListener = new GpsStatus.Listener() { @Override public synchronized void onGpsStatusChanged(int event) { switch( event ) { case GpsStatus.GPS_EVENT_SATELLITE_STATUS: { GpsStatus status = mLocationManager.getGpsStatus( null ); mSatellites = 0; Iterable<GpsSatellite> list = status.getSatellites(); for( GpsSatellite satellite : list ) { if( satellite.usedInFix() ) { mSatellites++; } } updateNotification(); break; } default: break; } } }; } /** * Destroys the LocationListenere and the GPSStatusListener */ private void destroyListeneres() { this.mLocationListener = null; this.mStatusListener = null; } /** * Gets the total distance traveled by the * * @return the total distance traveled (in meters) */ public float getDistance() { return mTotalDistance; } /** * Gets the current speed of the last good location * * @return the current speed (in meters/second) */ public float getSpeed() { return mCurrentSpeed; } } Any assistance would be much appreciated. This is my group's first Android app, and we are a little pressed for time at the moment. The project is for a class, and is available from SourceForge (currently called iTrain, soon to be renamed). Thanks in Advance, Steve

    Read the article

  • Using Navteq maps in Android

    - by Samuh
    1.Is it possible to NOT use Google Maps in Android? 2. Can we use Navteq maps? 3. What will it take to write such an application? 4. Do we have to come up with our own version of MapView? Pointers and links that can answer these questions and help me get started on 4. are welcome. Thanks.

    Read the article

  • Put an object in Handler message

    - by Tsimmi
    Hi! I need to download an image from the internet, in a different thread, and then send that image object in the handler message, to the UI thread. I already have this: ... Message msg = Message.obtain(); Bundle b = new Bundle(); b.putParcelable("MyObject", (Parcelable) object); msg.setData(b); handler.sendMessage(msg); And when I receive this message, I want to extract the object: ... public void handleMessage(Message msg) { super.handleMessage(msg); MyObject objectRcvd = (MyObject) msg.getData().getParcelable("IpTile"); addToCache(ipTile); mapView.invalidate(); } But this is giving me: ...java.lang.ClassCastException... Can anyone help? And by the way, is this the most efficient way to pass an object to the UI Thread? Thank you all!

    Read the article

  • How to get coordinates when iPhone is locked/sleeping?

    - by lionfly
    For normal situations, the didUpdateToLocation (of CLLocationManager) does not work any more when the lock/sleep button is pushed, and your app cannot get further newLocation coordinates during the locked period. However, some apps CAN track during the locked period, and they will show the correct route when you unlocked and see the Mapview. Obviously there are ways to get the coordinates during the locked period. How to get the coordinates when the iPhone is locked/sleeping? Who has hints and further info, please post. Thanks.

    Read the article

  • Changing Pushpin Text Color

    - by Yawus
    I'm attempting to display data through the text of a Pushpin object. However, the text color defaults to white which is nigh-invisible when the backdrop is a road-style MapView. Looking through the API, paying especially close attention to PushpinOptions, I couldn't find anything that manipulated text color. Considering that this seems to a fairly basic feature, I'm a little confused as to why it doesn't exist or at least is really hard to find. Am I missing something or does Bing Maps for Android really not let you change the default text color for a Pushpin object?

    Read the article

  • How do you create a Google Maps-esque drop down dialog?

    - by Daniel Lew
    In the Google Maps application, when you open the menu and click on "Directions", it pops up a dialog that is unique to Google Maps. It keeps the MapView in the background, but displays the search dialog from the top (or bottom, if you're on an old version of Android). I was curious if anyone knew how they achieved this effect. I'm willing to create a custom Dialog, but it seems that Dialogs are designed to pop into the middle of the screen (any other types of dialogs are denied permission as system dialogs). What trick is Google Maps using?

    Read the article

  • Limit to 10 number of annotations in mapkit!

    - by teddafan
    Hi, I have all my annotations(as nsdictionnaries) in an array , and the users add them one by one by tapping on an icon. I want to make it impossible after adding 10 annotations (there is 110). Is it here i have to make something?: -(IBAction) plusButtonTapped: (id) sender { NSDictionary *poiDict = [poiArray objectAtIndex:nextPoiIndex++]; CLLocationCoordinate2D poiCoordinate; poiCoordinate.latitude = [[poiDict valueForKey:@"workingCoordinate.latitude"] doubleValue]; poiCoordinate.longitude = [[poiDict valueForKey:@"workingCoordinate.longitude"] doubleValue]; MyMapAnnotation *poiAnnotation = [[MyMapAnnotation alloc] initWithCoordinate:poiCoordinate title:[poiDict valueForKey:@"Subtitle"] color:MKPinAnnotationColorRed ]; [mapView addAnnotation:poiAnnotation]; [self adjustMapZoom]; } Thank you for your help in advance, teddafan

    Read the article

  • Issue with webview with emulator and some devices Android

    - by Yasir Khan
    I am developing an application that is focuses on on WebView i am loading map from a webpage and calling subsequent java script request on it but i do not know what is happening with Galaxy Tab 7' and my emulator too after running well first time if i visit the application again its just showing blank page. Code: mMapView = (WebView) findViewById(R.id.mapview); mMapView.clearCache(true); mMapView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); mMapView.getSettings().setJavaScriptEnabled(true); mMapView.loadUrl(mapurl); mMapView.setWebViewClient(new WebViewClient() { public void onPageFinished(WebView view, String url) { Log.e("Page loading","Url is :"+url); } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { // TODO Auto-generated method stub view.loadUrl(url); return true; } }); initially i thought its a cache problem and i added clearcache() without any help. :-(

    Read the article

  • start function from another tab in UIWebView

    - by Marjan
    Hello, I have app which have two views implemented in Tabbar, one of them is UIWebView which shows some random html and second is mapView (route-me map), I have function in MapViewController.m which do sth stuff when is clicked on marker label - (void) tapOnLabelForMarker: (RMMarker*) marker onMap: (RMMapView*) map { NSLog(@"taponlabelformarker clicked"); self.tabBarController.selectedIndex=0; WebViewController *web = [[WebViewController alloc] init]; [web dajdasepije]; } and that function should call function which show html in uiwebview tab -(void)dajdasepije { NSLog(@" pokreni me njezno"); [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]]; } Problem is that UIWebView never show google page that I asked for it, NSLog prints out at terminal messages that function was called but nothing else happens. Please help, Thanks in advance. Marjan

    Read the article

  • Display selectedAnnotation info

    - by elife_iPhone
    When I use this: - (void)mapView:(MKMapView *)myMapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control { NSLog(@"SelectedAnnotations is %@", myMapView.selectedAnnotations); } It Displays this in the log. "<Annotation: 0x586cdb0>" Now this is a weird question, but how do I get the info from this Annotation? I have lost my mind. This is what is in the annotation. myAnnotation = [[Annotation alloc] init]; myAnnotation.dealName=[NSString stringWithFormat:@"%@",[tempValue objectForKey:@"name"]]; myAnnotation.subName=[NSString stringWithFormat:@"Price: $%@",[tempValue objectForKey:@"price"]]; myAnnotation.latitude = [NSNumber numberWithDouble:[[tempValue objectForKey:@"dealLatitude"] doubleValue]]; myAnnotation.longitude = [NSNumber numberWithDouble:[[tempValue objectForKey:@"dealLongitude"] doubleValue]]; myAnnotation.dealId = [NSNumber numberWithInt:[ [tempValue objectForKey:@"dId"] intValue ]]; Thanks for your help.

    Read the article

  • Missing styles. Is the correct theme chosen for this layout?

    - by user1820007
    Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layout to choose a different layout, or fix the theme style references. Failed to find style 'mapViewStyle' in current theme. I tried every solutions available to solve this problem. But nothing seems to work. I have included library in the manifest file. I even created style is styles.xml. I have chosen Google Apis build target as well. Can somebody please give me a solution. Thank you in advance for your valuable time... here is my xml file: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" style="@style/AppTheme" android:layout_width="fill_parent" android:layout_height="fill_parent" > <com.google.android.maps.MapView android:id="@+id/themap" style="@style/mapViewStyle" android:layout_width="fill_parent" android:layout_height="fill_parent" android:apiKey="here i have my key" android:clickable="true" android:enabled="true" /> </RelativeLayout> ` Here is my manifest snippet: <uses-library android:name="com.google.android.maps" /> <activity android:name=".MainActivity" android:label="@string/title_activity_main" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".Second" /> <acttiviy android:name=".Third" android:theme="@android:style/Theme.Black" /> </application> here is my style.xml file <style name="mapViewStyle" parent="@android:style/Theme.Black"> </style> </resources>

    Read the article

  • iphone xcode annotation pin drop with slider value change also remove

    - by chirag
    i have to add annotation pin on location with UIslider Value change .... this is code where i add annotation (MKAnnotationView *) mapView:(MKMapView *)mapView1 viewForAnnotation:(id ) annotation{ MKAnnotationView* annotationView = nil; NSString* identifier = @"Pin"; MyAnnotationView* annView = (MyAnnotationView*)[mapView1 dequeueReusableAnnotationViewWithIdentifier:identifier]; // annotationView.leftCalloutAccessoryView = myImage; //myImage = [UIButton buttonWithType:UIButtonTypeCustom]; // [myImage setImage:[UIImage imageNamed:@"mark.png"]forState:UIControlStateNormal]; //Property_Photo UIButton *mybtn = [UIButton buttonWithType:UIButtonTypeCustom]; if([annotation isKindOfClass:[AddressAnnotation class]]){ AddressAnnotation x=(AddressAnnotation)annotation; mybtn.frame = CGRectMake(0, 0, 35, 35); mybtn.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; mybtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter; [mybtn setImage:[UIImage imageNamed:@"btn.png"] forState:UIControlStateNormal]; [mybtn setTitle:[NSString stringWithFormat:@"%@",[x getID]] forState:UIControlStateDisabled]; [mybtn addTarget:self action:@selector(btnShowProperty:) forControlEvents:UIControlEventTouchUpInside]; ((IMOVEISAppDelegate*)[[UIApplication sharedApplication]delegate]).strPropertyPrice = [[myTblArray objectAtIndex:imgIndex]valueForKey:@"Property_Price"]; NSLog(@"property price: %@",((IMOVEISAppDelegate*)[[UIApplication sharedApplication]delegate]).strPropertyPrice); if(nil == annView) { ///if(annView!=nil && [annView retainCount]>0){ [annView release]; annView=nil; } annView = [[[MyAnnotationView alloc] initWithAnnotation:x reuseIdentifier:identifier] autorelease]; if(Objslider.value==10){ [myMapView removeAnnotations:myMapView.annotations]; } } NSURL *imgURL = [NSURL URLWithString:[[myTblArray objectAtIndex:imgIndex]valueForKey:@"Property_Photo"]]; UIImage *imgPhoto = [UIImage imageWithData:[NSData dataWithContentsOfURL:imgURL]]; UIImageView *pinImgView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0,35, 35)]; imgIndex++; [pinImgView setImage:imgPhoto]; annView.rightCalloutAccessoryView = mybtn; annView.leftCalloutAccessoryView = pinImgView; [annView setBackgroundColor:[UIColor clearColor]]; } [annView setEnabled:YES]; annView.canShowCallout = YES; annView.calloutOffset = CGPointMake(-5, 5); annotationView = annView; return annotationView; }

    Read the article

  • MapKit internal calls causing crash

    - by Ronnie Liew
    I have a MKMapView in the view of a UIViewController. The app will crash randomly when the I pop the UIViewController off from the UINavigationController. In the dealloc method of the UIViewController, I have already assigned the MKMapView delegate to nil as below: - (void)dealloc { mapView.delegate = nil; [_mapView release]; _mapView = nil; [super dealloc]; } The crash log are also attached as follows: Crash log #1: Thread 0 Crashed: 0 libobjc.A.dylib 0x000026f6 objc_msgSend + 18 1 MapKit 0x0005676c -[MKUserLocationPositionAnimation animationDidStop:finished:] + 64 2 QuartzCore 0x00015a26 run_animation_callbacks(double, void*) + 282 3 QuartzCore 0x000158dc CA::timer_callback(__CFRunLoopTimer*, void*) + 100 4 CoreFoundation 0x00056bac CFRunLoopRunSpecific + 2112 5 CoreFoundation 0x00056356 CFRunLoopRunInMode + 42 6 GraphicsServices 0x00003b2c GSEventRunModal + 108 7 GraphicsServices 0x00003bd8 GSEventRun + 56 8 UIKit 0x00002768 -[UIApplication _run] + 384 9 UIKit 0x0000146c UIApplicationMain + 688 10 Refill 0x00002aea main (main.m:14) 11 Refill 0x00002a60 start + 44 Crash log#2 Thread 0 Crashed: 0 libobjc.A.dylib 0x000026f4 objc_msgSend + 16 1 MapKit 0x0005a20e -[MKUserLocationViewInternal userLocationViewAccuracyDidUpdate] + 42 2 MapKit 0x0005676c -[MKUserLocationPositionAnimation animationDidStop:finished:] + 64 3 QuartzCore 0x00015a26 run_animation_callbacks(double, void*) + 282 4 QuartzCore 0x000158dc CA::timer_callback(__CFRunLoopTimer*, void*) + 100 5 CoreFoundation 0x00056bac CFRunLoopRunSpecific + 2112 6 CoreFoundation 0x00056356 CFRunLoopRunInMode + 42 7 GraphicsServices 0x00003b2c GSEventRunModal + 108 8 GraphicsServices 0x00003bd8 GSEventRun + 56 9 UIKit 0x00002768 -[UIApplication _run] + 384 10 UIKit 0x0000146c UIApplicationMain + 688 11 Refill 0x00002aea main (main.m:14) 12 Refill 0x00002a60 start + 44 Seems like the MapKit is trying to update the MKMapView on the user location but the delegate has already been deallocated. What else I am missing here?

    Read the article

  • Overlay only draws line between first 2 GPS points in Android

    - by LordSnoutimus
    Hi, I am experiencing an unusual error using ItemizedOverlay in Android. I am creating a GPS tracking device that plots a route between waypoints stored in a database. When I provide the first two sets of longitude and latitude points through the emulator in Eclipse, it draws a red line just how I want it, but if I send another GPS point, it animates to the point, but does not draw a line from the last point. public class MyOverlay extends ItemizedOverlay { // private Projection projection; private Paint linePaint; private Vector points; public MyOverlay(Drawable defaultMarker) { super(defaultMarker); points = new Vector<GeoPoint>(); //set colour, stroke width etc. linePaint = new Paint(); linePaint.setARGB(255, 255, 0, 0); linePaint.setStrokeWidth(3); linePaint.setDither(true); linePaint.setStyle(Style.FILL); linePaint.setAntiAlias(true); linePaint.setStrokeJoin(Paint.Join.ROUND); linePaint.setStrokeCap(Paint.Cap.ROUND); } public void addPoint(GeoPoint point) { points.addElement(point); } public void draw(Canvas canvas, MapView view, boolean shadow) { int size = points.size(); Point lastPoint = new Point(); if(size == 0) return; view.getProjection().toPixels(points.get(0), lastPoint); Point point = new Point(); for(int i = 1; i<size; i++){ view.getProjection().toPixels(points.get(i), point); canvas.drawLine(lastPoint.x, lastPoint.y, point.x, point.y, linePaint); lastPoint = point; } } @Override protected OverlayItem createItem(int arg0) { // TODO Auto-generated method stub return null; } @Override public int size() { // TODO Auto-generated method stub return 0; } }

    Read the article

  • Process: Unable to start service com.google.android.gms.checkin.CheckinService with Intent

    - by AndyRoid
    I'm trying to build a Google map application but keep receiving this in my LogCat. I have all the permissions and meta-data set in my manifest, but am still dumbfounded by this error. Have looked everywhere on SO for this specific error but found nothing relating to com.google.android.gms.checkin A little bit about my structural hierarchy. MainActivity extends ActionBarActivity with three tabs underneath actionbar. Each tab has it's own fragment. On the gMapFragment I create a GPSTrack object from my GPSTrack class which extends Service and implements LocationListener. The problem is that when I start the application I get this message: I have all my libraries imported properly and I even added the google-play-services.jar into my libs folder. I also installed Google Play Services APKs through CMD onto my emulator. Furthermore the LocationManager lm = = (LocationManager) mContext.getSystemService(LOCATION_SERVICE); in my GPSTrack class always returns null. Why is this and how can I fix these issues? Would appreciate an explanation along with solution too, I want to understand what's going on here. ============== Code: gMapFragment.java public class gMapFragment extends SupportMapFragment { private final String TAG = "gMapFragment"; private GoogleMap mMap; protected SupportMapFragment mapFrag; private Context mContext = getActivity(); private static View view; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (view != null) { ViewGroup parent = (ViewGroup) view.getParent(); if (parent != null) { parent.removeView(view); } } try { super.onCreateView(inflater, container, savedInstanceState); view = inflater.inflate(R.layout.fragment_map, container, false); setupGoogleMap(); } catch (Exception e) { /* * Map already there , just return as view */ } return view; } private void setupGoogleMap() { mapFrag = (SupportMapFragment) getFragmentManager().findFragmentById( R.id.mapView); if (mapFrag == null) { FragmentManager fragManager = getFragmentManager(); FragmentTransaction fragTransaction = fragManager .beginTransaction(); mapFrag = SupportMapFragment.newInstance(); fragTransaction.replace(R.id.mapView, mapFrag).commit(); } if (mapFrag != null) { mMap = mapFrag.getMap(); if (mMap != null) { setupMap(); mMap.setOnMapClickListener(new OnMapClickListener() { @Override public void onMapClick(LatLng point) { // TODO your click stuff on map } }); } } } @Override public void onAttach(Activity activity) { super.onAttach(activity); Log.d("Attach", "on attach"); } @Override public void onDetach() { super.onDetach(); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public void onResume() { super.onResume(); } @Override public void onPause() { super.onPause(); } @Override public void onDestroy() { super.onDestroy(); } private void setupMap() { GPSTrack gps = new GPSTrack(mContext); // Enable MyLocation layer of google map mMap.setMyLocationEnabled(true); Log.d(TAG, "MyLocation enabled"); // Set Map type mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); // Grab current location **ERROR HERE/Returns Null** Location location = gps.getLocation(); Log.d(TAG, "Grabbing location..."); if (location != null) { Log.d(TAG, "location != null"); // Grab Latitude and Longitude double latitude = location.getLatitude(); double longitude = location.getLongitude(); Log.d(TAG, "Getting lat, long.."); // Initialize LatLng object LatLng latLng = new LatLng(latitude, longitude); Log.d(TAG, "LatLng initialized"); // Show current location on google map mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng)); // Zoom in on google map mMap.animateCamera(CameraUpdateFactory.zoomTo(20)); mMap.addMarker(new MarkerOptions().position( new LatLng(latitude, longitude)).title("You are here.")); } else { gps.showSettingsAlert(); } } } GPSTrack.java public class GPSTrack extends Service implements LocationListener{ private final Context mContext; private boolean isGPSEnabled = false; //See if network is connected to internet private boolean isNetworkEnabled = false; //See if you can grab the location private boolean canGetLocation = false; protected Location location = null; protected double latitude; protected double longitude; private static final long MINIMUM_DISTANCE_CHANGE_FOR_UPDATES = 10; //10 Meters private static final long MINIMUM_TIME_CHANGE_FOR_UPDATES = 1000 * 60 * 1; //1 minute protected LocationManager locationManager; public GPSTrack(Context context) { this.mContext = context; getLocation(); } public Location getLocation() { try { //Setup locationManager for controlling location services **ERROR HERE/Return Null** locationManager = (LocationManager) mContext.getSystemService(LOCATION_SERVICE); //See if GPS is enabled isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); //See if Network is connected to the internet or carrier service isNetworkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); if (!isGPSEnabled && !isNetworkEnabled) { Toast.makeText(getApplicationContext(), "No Network Provider Available", Toast.LENGTH_SHORT).show(); } else { this.canGetLocation = true; if (isNetworkEnabled) { locationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, MINIMUM_TIME_CHANGE_FOR_UPDATES, MINIMUM_DISTANCE_CHANGE_FOR_UPDATES, this); Log.d("GPS", "GPS Enabled"); if (locationManager != null) { location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (location != null) { latitude = location.getLatitude(); longitude = location.getLongitude(); } } } } } catch (Exception e) { e.printStackTrace(); } return location; } public void stopUsingGPS() { if (locationManager != null) { locationManager.removeUpdates(GPSTrack.this); } } public double getLatitude() { if (location != null) { latitude = location.getLatitude(); } return latitude; } public double getLongitude() { if (location != null) { longitude = location.getLongitude(); } return longitude; } public boolean canGetLocation() { return this.canGetLocation; } public void showSettingsAlert() { AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext); //AlertDialog title alertDialog.setTitle("GPS Settings"); //AlertDialog message alertDialog.setMessage("GPS is not enabled. Do you want to go to Settings?"); alertDialog.setPositiveButton("Settings", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub Intent i = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); mContext.startActivity(i); } }); alertDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub dialog.cancel(); } }); alertDialog.show(); } @Override public void onLocationChanged(Location location) { // TODO Auto-generated method stub } @Override public void onStatusChanged(String provider, int status, Bundle extras) { // TODO Auto-generated method stub } @Override public void onProviderEnabled(String provider) { // TODO Auto-generated method stub } @Override public void onProviderDisabled(String provider) { // TODO Auto-generated method stub } @Override public IBinder onBind(Intent intent) { // TODO Auto-generated method stub return null; } } logcat 06-08 22:35:03.441: E/AndroidRuntime(1370): FATAL EXCEPTION: main 06-08 22:35:03.441: E/AndroidRuntime(1370): Process: com.google.android.gms, PID: 1370 06-08 22:35:03.441: E/AndroidRuntime(1370): java.lang.RuntimeException: Unable to start service com.google.android.gms.checkin.CheckinService@b1094e48 with Intent { cmp=com.google.android.gms/.checkin.CheckinService }: java.lang.SecurityException: attempting to read gservices without permission: Neither user 10053 nor current process has com.google.android.providers.gsf.permission.READ_GSERVICES. 06-08 22:35:03.441: E/AndroidRuntime(1370): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2719) 06-08 22:35:03.441: E/AndroidRuntime(1370): at android.app.ActivityThread.access$2100(ActivityThread.java:135) 06-08 22:35:03.441: E/AndroidRuntime(1370): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293) 06-08 22:35:03.441: E/AndroidRuntime(1370): at android.os.Handler.dispatchMessage(Handler.java:102) 06-08 22:35:03.441: E/AndroidRuntime(1370): at android.os.Looper.loop(Looper.java:136) 06-08 22:35:03.441: E/AndroidRuntime(1370): at android.app.ActivityThread.main(ActivityThread.java:5017) 06-08 22:35:03.441: E/AndroidRuntime(1370): at java.lang.reflect.Method.invokeNative(Native Method) 06-08 22:35:03.441: E/AndroidRuntime(1370): at java.lang.reflect.Method.invoke(Method.java:515) 06-08 22:35:03.441: E/AndroidRuntime(1370): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 06-08 22:35:03.441: E/AndroidRuntime(1370): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 06-08 22:35:03.441: E/AndroidRuntime(1370): at dalvik.system.NativeStart.main(Native Method) 06-08 22:35:03.441: E/AndroidRuntime(1370): Caused by: java.lang.SecurityException: attempting to read gservices without permission: Neither user 10053 nor current process has com.google.android.providers.gsf.permission.READ_GSERVICES. 06-08 22:35:03.441: E/AndroidRuntime(1370): at android.app.ContextImpl.enforce(ContextImpl.java:1685) 06-08 22:35:03.441: E/AndroidRuntime(1370): at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1714) 06-08 22:35:03.441: E/AndroidRuntime(1370): at android.content.ContextWrapper.enforceCallingOrSelfPermission(ContextWrapper.java:572) 06-08 22:35:03.441: E/AndroidRuntime(1370): at imq.c(SourceFile:107) 06-08 22:35:03.441: E/AndroidRuntime(1370): at imq.a(SourceFile:121) 06-08 22:35:03.441: E/AndroidRuntime(1370): at imq.a(SourceFile:227) 06-08 22:35:03.441: E/AndroidRuntime(1370): at bwq.c(SourceFile:166) 06-08 22:35:03.441: E/AndroidRuntime(1370): at com.google.android.gms.checkin.CheckinService.a(SourceFile:237) 06-08 22:35:03.441: E/AndroidRuntime(1370): at com.google.android.gms.checkin.CheckinService.onStartCommand(SourceFile:211) 06-08 22:35:03.441: E/AndroidRuntime(1370): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2702) AndroidManifest <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.app" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" /> <uses-permission android:name="com.curio.permission.MAPS_RECEIVE" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /> <uses-feature android:name="android.hardware.camera" android:required="true" /> <uses-feature android:glEsVersion="0x00020000" android:required="true" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="com.app.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AI........................" /> </application>

    Read the article

  • Get Eclipse to recognize the maps api

    - by NickTFried
    Hi I'm developing an Android app and trying to incorporate maps into one of my sub-activities. Having followed all of the instructions from Android, my java file will not recognize the "MapActivity" or the import statements to include the needed api. Here is my XML manifest and my class file. <?xml version="1.0" encoding="utf-8"?> <uses-permission android:name="android.permissions.INTERNET"/> <uses-permission android:name="android.permissions.ACCESS_FINE_LOCATION"/> <application android:icon="@drawable/icon" android:label="@string/app_name"> <uses-library android:name="com.google.android.maps" /> <activity android:name=".CadetCommand" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="RedLight"></activity> <activity android:name="PTCalculator"></activity> </application> <uses-sdk android:minSdkVersion="7"/> here is my java file: package edu.elon.cs.mobile; import com.google.android.maps.MapActivity; import com.google.android.maps.MapView; import android.os.Bundle; public class LandNav extends MapActivity{ } Any suggestion would help.

    Read the article

< Previous Page | 6 7 8 9 10 11  | Next Page >