Hello
I have an interface called iService which has the method StartService() and I want to call a method from the MainActivity in Android:
class Service_Android : Java.Lang.Object, IService
{
Intent SyncIntent;
User anUser;
public void StartService()
{
//ScheduleSyncService();
MainActivity test = new MainActivity();
test.ScheduleSyncService();
}
...
In my method I am having problems with my Context, it throws an exception when I get to this point, I think is because my MainActivity inherets from Android activity and my interface delivered class is inherited Java.Lang.object.
return PendingIntent.GetBroadcast(this, 0, SyncIntent, PendingIntentFlags.NoCreate) != null;
I have tried different things like:
return PendingIntent.GetBroadcast(Forms.Context.ApplicationContext, 0, SyncIntent, PendingIntentFlags.NoCreate) != null;
or
Forms.Context
But I am still getting an exception.