rdelrosario / xamarin-plugins

Cross platform Xamarin & Windows plugins for PCLs
MIT License
178 stars 161 forks source link

Problema in Xamarin.Forms project for Android #9

Closed homerokzam closed 8 years ago

homerokzam commented 9 years ago

I'm having the following problem in an XForms project for Android: Push notification error - CrossPushNotification - Register - Java.IO.IOException: Exception of type 'Java.IO.IOException' was thrown.

In this project that is working for iOS I use PushSharp on my server.

rdelrosario commented 9 years ago

Seems to be a networking issue. Where are you calling the register method?

homerokzam commented 9 years ago

I call the method in the class:

public partial class App: Application { ...      protected override void OnStart ()      {        // Handle When your app starts        CrossPushNotification.Current.Register ();      } ... }

But then event CrossPushNotificationListener. OnRegistered (IPushNotificationListener) does not fire.

rdelrosario commented 9 years ago

Have you initialized the plugin?

homerokzam commented 9 years ago

Yes. I do the method CrossPushNotification.Initialize("") in MainActivity.cs of the Android project. And I do the method CrossPushNotification.Current.Register() in OnStart event of the PCL project (App.cs).

rdelrosario commented 9 years ago

Did you get working?

homerokzam commented 9 years ago

No, I didn't. Works with iOS, but with Android not.

homerokzam commented 9 years ago

rdelrosario, I discovered the error. The problem is that in the Android application, OnRegistered event triggers only on the first application running on the device. After the first run the event does not fire. Not that it's a problem, but I did not foresee this.

Thank you.

rdrokkralabs commented 9 years ago

Yes it prevents multiple time registration. Why you will like to register it if it's already registered?

homerokzam commented 8 years ago

I think this may be a mistake. IOS project this event is triggered every time the application starts. The Token value on evento OnRegistered for Android seems to me what's wrong. Do you have an example using the plugin for Android?

rdelrosario commented 8 years ago

I will fix this for iOS, so it triggers just one time because shouldn't be registering each time.

shanthuk commented 8 years ago

I am using visual studio 2015 and XF 2.0. After adding these packages related to notification plugin to my solution, android application fails to deploy onto device (iOS is working properly). Any idea what might be causing this?

rdelrosario commented 8 years ago

What error are you getting?

shanthuk commented 8 years ago

Strangely there are no errors. In the output window I see the following message check to make sure that in your build configuration build and deploy both are checked (not exactly the same text, but semantically that is what it says). Hope this helps. I though I had enable some of the device permissions (such as INTERNET etc.). I tried to enable quite a few options. Still it was failing to deploy.

I wanted to be sure. As soon as I removed these nuget packages, I was able to deploy my application to device again.

I really liked the idea of abstracting all the notification stuff in a PCL. Let me know if I can be of any help. If needed, I can setup a remote goto meeting for you to look at.

rdelrosario commented 8 years ago

Ok here is my skype: rendyleonel