Introducing the Xamarin Mobile API Preview

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Introducing the Xamarin Mobile API Preview

Eric Maupin

With MonoTouch and Mono for Android, you can already share a huge portion of your code across iOS, Android and Windows Phone. There is, however, this middle ground of APIs that are present in all three platforms, but you can't share your code that utilizes them. You currently have to write separate sets of code to use geolocation, the accelerometer, contacts, etc on these various platforms and we want to fix that. The Xamarin Mobile API Preview contains a new set of APIs designed and implemented to support these features evenly across iOS, Android and Windows Phone.

We want your feedback to help guide us in this endeavor, so today we're releasing a preview. The preview contains a unified geolocation API with implementations on iOS and Android. We'll be releasing a Windows Phone implementation at some point in the future. Try it out and give us your feedback, we want to know what you think! Let us know of any pain points in the API, if something doesn't work, etc. We also want to know what other areas you care most about us unifying next, whether it be contacts, notifications, etc.

As this is a preview, please keep in mind that APIs may change, things may be broken and not all of the docs are filled out. For Android, currently a minimum API level of 7 is required. Additionally on Android, heading is disabled and Geolocator's constructor takes an argument of Context.

You can download the preview here: http://xamarin.com/xamarinmobileapipreview.zip
Let us know what you think here: https://docs.google.com/a/xamarin.com/spreadsheet/viewform?formkey=dFBlbEtBZmZaT3pIYnBTRHZOQWV4cFE6MQ
File any bugs you find here: http://bugzilla.xamarin.com/enter_bug.cgi?product=Xamarin%20Mobile%20API%20Preview


_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Introducing the Xamarin Mobile API Preview

devbuzz
A quick question about the geolocation API - I couldn't find any docs :)

I'm grabbing GPS positions in a service using this code:

  geolocator = new Geolocator (this) { DesiredAccuracy = 50 };

  if (!geolocator.IsGeolocationEnabled)
    return;

  geolocator.PositionChanged += gps_LocationChanged;

  if (!geolocator.IsListening)
  {
    geolocator.StartListening(minTime: GPSTimerInterval_ms, minDistance: 0);
  }

The problem is that gps_LocationChanged never runs?

Am I correct in assuming that if StartListening has been run  then as soon as geolocator gets a fix gps_LocationChanged will run?

Just want to make sure I'm using it correctly - in the sample I see a call to GetPositionAsync - but that looks like it's for an immediate check?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Introducing the Xamarin Mobile API Preview

Eric Maupin
Hi Derek,

Be sure that you also listen for Geolocator.PositionError, add a handler for that and make sure you're not getting any errors.
You're correct that GetPositionAsync is for one-off requests.

API Docs are available at http://betaapi.xamarin.com

On Wed, Jan 4, 2012 at 11:22 AM, devbuzz <[hidden email]> wrote:
A quick question about the geolocation API - I couldn't find any docs :)

I'm grabbing GPS positions in a service using this code:

 geolocator = new Geolocator (this) { DesiredAccuracy = 50 };

 if (!geolocator.IsGeolocationEnabled)
   return;

 geolocator.PositionChanged += gps_LocationChanged;

 if (!geolocator.IsListening)
 {
   geolocator.StartListening(minTime: GPSTimerInterval_ms, minDistance: 0);
 }

The problem is that gps_LocationChanged never runs?

Am I correct in assuming that if StartListening has been run  then as soon
as geolocator gets a fix gps_LocationChanged will run?

Just want to make sure I'm using it correctly - in the sample I see a call
to GetPositionAsync - but that looks like it's for an immediate check?

--
View this message in context: http://mono-for-android.1047100.n5.nabble.com/Introducing-the-Xamarin-Mobile-API-Preview-tp5015136p5120073.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Introducing the Xamarin Mobile API Preview

devbuzz
Thanks for the fast response Eric :)

Is there anyway to tell when the GPS has lost reception after a successful fix?

This is what I'm experiencing:

1) The GPS icon stops flashing indicating a fix.

2) PositionChanged fires as I would expect and all the values from PositionEventArgs.Position look good.

3) When the GPS icon starts to flash indicating a loss in reception; the PositionChanged fires but the PositionEventArgs.Position.Accuracy continues to report a value?

How can I tell in PositionChanged whether there is a valid fix?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Introducing the Xamarin Mobile API Preview

Eric Maupin
No as not all of the platforms allow you to make a distinction between the WiFi locations and the GPS, so on platforms that do (like Android) we're hiding the details from you.

The numbers you are seeing after it has lost its signal are most likely from the wifi location system, you can filter out positions that are too inaccurate for your use based on Position.Accuracy.

On Wed, Jan 4, 2012 at 6:28 PM, devbuzz <[hidden email]> wrote:
Thanks for the fast response Eric :)

Is there anyway to tell when the GPS has lost reception after a successful
fix?

This is what I'm experiencing:

1) The GPS icon stops flashing indicating a fix.

2) PositionChanged fires as I would expect and all the values from
PositionEventArgs.Position look good.

3) When the GPS icon starts to flash indicating a loss in reception; the
PositionChanged fires but the PositionEventArgs.Position.Accuracy continues
to report a value?

How can I tell in PositionChanged whether there is a valid fix?

--
View this message in context: http://mono-for-android.1047100.n5.nabble.com/Introducing-the-Xamarin-Mobile-API-Preview-tp5015136p5121249.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Introducing the Xamarin Mobile API Preview

heemanshubhalla
This post has NOT been accepted by the mailing list yet.
In reply to this post by Eric Maupin
Download preview gives 404 error
Loading...