Jon,

I had come to the conclusion about inheriting from Java.Lang.Object as well, 
and that got the service working.  I'm one of those "likes to understand the 
internals" personalities, so I'm still interested in what the IJavaObject 
interface requirements are - but only if you have the time and some pointers on 
resources.  I don't want it to suck up a load of your time.

I'll take a look at the Application.Context property too.  I thought I'd looked 
for it and not found it, but it could easily be I missed it by looking in the 
wrong namespace.

Thanks for the response and help.

-Chris


> -----Original Message-----
> From: monodroid-boun...@lists.ximian.com [mailto:monodroid-
> boun...@lists.ximian.com] On Behalf Of Jonathan Pryor
> Sent: Friday, March 30, 2012 9:58 AM
> To: Discussions related to Mono for Android
> Subject: Re: [mono-android] Services, Activities, Contexts and
> separation of concerns
> 
> On Mar 29, 2012, at 10:57 AM, Chris Tacke wrote:
> > Then I said, "hey, I'd like to get location change notifications", so
> I implemented ILocationListener in my Presenter.  Bear in mind it
> derives from no other classes.  First, it made me implement a Handle
> property.  That can't be good
> 
> It's not good. Never ever never ever never ever ... implement
> IJavaObject yourself. Just don't.
> 
> Inherit from Java.Lang.Object to implement IJavaObject:
> 
>       http://androidapi.xamarin.com/?link=T:Android.Runtime.IJavaObject
>       http://docs.xamarin.com/android/advanced_topics/architecture/andr
> oid_callable_wrappers#Implementing_Interfaces
> 
> As for the "everything needs a Context" problem, there _may_ be a
> solution: the Android.App.Application.Context property:
> 
>       http://androidapi.xamarin.com/?link=P%3aAndroid.App.Application.C
> ontext
> 
> The Application.Context property is a static property which returns the
> Application context (i.e. Context.ApplicationContext). This isn't
> appropriate for everything (e.g. many things require an Activity
> context), but for things like system services it should work. You might
> try using it.
> 
>  - Jon
> 
> _______________________________________________
> Monodroid mailing list
> Monodroid@lists.ximian.com
> 
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

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

Reply via email to