Giter VIP home page Giter VIP logo

Comments (18)

rdelrosario avatar rdelrosario commented on August 12, 2024

Hi

There is instructions and step by step here:

http://lemoncode.net/2015/04/17/adding-push-notifications-to-your-xamarin-forms-application-part-1/

Let me know if helps.

from xamarin-plugins.

pjdupreez avatar pjdupreez commented on August 12, 2024

Hi there,

The link is broken. Cannot get to the instructions.

I did manage to get it working with the code on the main page, but how do I handle opening the notification? Notifications are received by my app and tapping the notification open my app, but on the first page. How can I tell it to open a specific page (I am using it for both iOS and Android in a Xamarin forms project)?

from xamarin-plugins.

codebase2015 avatar codebase2015 commented on August 12, 2024

Hi Rendy,

First of all I am really thankful that you have developed the plugin for Xamarin and AWS and helping developers across the globe.

I am new to mobile development and trying to develop a mobile app for andriod platform using xamrin. I do have requirement of sending notfications to indivisual devices through Amazon SNS services.
I need your help on getting the tutorial link for Xamarin Push Notification with Amazon SNS.
http://lemoncode.net/2015/04/17/adding-push-notifications-to-your-xamarin-forms-application-part-1/ (this is broken link)
Could you please provide me the full example or link which I can follow.
It would be a great help.
Thank you
Ashish

from xamarin-plugins.

homerokzam avatar homerokzam commented on August 12, 2024

I would also like to set an example for Android.

from xamarin-plugins.

rdelrosario avatar rdelrosario commented on August 12, 2024

Try the link of Step by step instructions on the README documentation just
updated the readme. Shouldn't be broken know let me know if works.
On Jul 23, 2015 10:41 AM, "homerokzam" [email protected] wrote:

I would also like to set an example for Android.

β€”
Reply to this email directly or view it on GitHub
#7 (comment)
.

from xamarin-plugins.

espilacopa avatar espilacopa commented on August 12, 2024

My bad the link in the readme work just fine !! you're a boss !

thanks again !!

Hello, thanks for all your work but the link is still broken !
if you can do something !

from xamarin-plugins.

jwood803 avatar jwood803 commented on August 12, 2024

I think this is the updated link from above.

Though, I'm still confused on how to implement in Android to receive the device token and when a message is received. Looking at part two from the link, it still doesn't seem to show that.

from xamarin-plugins.

Aybukes avatar Aybukes commented on August 12, 2024

This is the example link
https://lemoncoders.wordpress.com/2015/04/17/adding-push-notifications-to-your-xamarin-forms-application-part-1/

from xamarin-plugins.

nmdias avatar nmdias commented on August 12, 2024

Does anyone have a working example? I'm not succeeding in implementing this.
None of the above links are working.

Thank you.

from xamarin-plugins.

CR4567 avatar CR4567 commented on August 12, 2024

If you could be more specific we could help you.
In the readme you can find the normal way to get it working, except you have special requirements.

from xamarin-plugins.

nmdias avatar nmdias commented on August 12, 2024

No special requirements, but I have to be missing something.

I have implemented the IPushNotificationListener, in my CrossPushNotificationListener class. As suggested in the README file.

public class CrossPushNotificationListener : IPushNotificationListener
{
    void IPushNotificationListener.OnError(string message, DeviceType deviceType)
    {
        Application.Current.MainPage.DisplayAlert("error", message, "ok");
    }

    void IPushNotificationListener.OnMessage(JObject values, DeviceType deviceType)
    {
        Application.Current.MainPage.DisplayAlert("message", values.ToString(), "ok");
    }

    void IPushNotificationListener.OnRegistered(string token, DeviceType deviceType)
    {
        Application.Current.MainPage.DisplayAlert("token", token, "ok");
    }

    void IPushNotificationListener.OnUnregistered(DeviceType deviceType)
    {
        Application.Current.MainPage.DisplayAlert("unregistered", "", "ok");
    }

    bool IPushNotificationListener.ShouldShowNotification()
    {
        Application.Current.MainPage.DisplayAlert("should show notification", "", "ok");
        return true;
    }
}

In iOS’s AppDelegate, I then initialize the CrossPushNotification plugin.

public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
    global::Xamarin.Forms.Forms.Init ();

    CrossPushNotification.Initialize<CrossPushNotificationListener>();

    LoadApplication(new Origination.App ());
    return base.FinishedLaunching(app, options);
}

I have also extended the AppDelegate with the appropriate overrides as shown in the PushNotificationApplicationDelegate.txt.pp file:

public override void FailedToRegisterForRemoteNotifications(UIApplication application, NSError error)
{
    if (CrossPushNotification.Current is IPushNotificationHandler)
    {
        ((IPushNotificationHandler)CrossPushNotification.Current).OnErrorReceived(error);
    }
}

public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
{
    if (CrossPushNotification.Current is IPushNotificationHandler)
    {
        ((IPushNotificationHandler)CrossPushNotification.Current).OnRegisteredSuccess(deviceToken);
    }
}


public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action<UIBackgroundFetchResult> completionHandler)
{
    if (CrossPushNotification.Current is IPushNotificationHandler)
    {
        ((IPushNotificationHandler)CrossPushNotification.Current).OnMessageReceived(userInfo);
    }
}


public override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo)
{
    if (CrossPushNotification.Current is IPushNotificationHandler)
    {
        ((IPushNotificationHandler)CrossPushNotification.Current).OnMessageReceived(userInfo);
    }
}

Afterwards, in my shared code, after the user registered/logged in the App and enter it's home screen, I call:

CrossPushNotification.Current.Register();

I know this method is being executed, as I get an alert requesting permissions. But none of the methods from the IPushNotificationListener interface implemented in the CrossPushNotificationListener are called.

There must be something I'm not seeing here..

from xamarin-plugins.

CR4567 avatar CR4567 commented on August 12, 2024

Did you install it on your real device or simulator?
Are you sure that a push notification is sent to your device?
Are using Azure or a different Push Server?

from xamarin-plugins.

nmdias avatar nmdias commented on August 12, 2024

I'm testing this on a real device.

My issue is that, the CrossPushNotification.Current.Register() method, while it's triggering an alert to request permissions for push notifications (as expected), the implementation of the IPushNotificationListener interface is never called. So I never get the device's token.

In fact, none of the method's from the AppDelegate are called (that's weird, considering the permissions alert).

from xamarin-plugins.

CR4567 avatar CR4567 commented on August 12, 2024

Ok, I see. You're right, at least the Register callbacks of AppDelegate should be triggered.
But what I've seen looks good to me...
Could you give us access to your code? Or maybe someone else has an idea

from xamarin-plugins.

gtmorais avatar gtmorais commented on August 12, 2024

Same problem as nmdias, it does request permission for push notifications and calls DidRegisterUserNotificationSettings but never calls RegisteredForRemoteNotifications in order to get the device's token. For Android I've updated the payload fields that comes from Firebase on the plugin's source and now it shows the notification body on Android. But not for IOS. My CrossPushNotificationListener is on the PCL, only working for Android so far.

from xamarin-plugins.

gtmorais avatar gtmorais commented on August 12, 2024

Now it calls RegisteredForRemoteNotifications but when sending push it says the token is invalid using Pusher. So the token is invalid for now. It may be IOS 10 issue with this plugin.

from xamarin-plugins.

nmdias avatar nmdias commented on August 12, 2024

@gtmorais can you try adding a group to your app's entitlements? Give that a go.

I honestly don't remember if that was it, as I ended up with a custom dependency service.

Here's what I did, based on the plugin's source code:

http://stackoverflow.com/a/42422790/1544047

from xamarin-plugins.

pjavax avatar pjavax commented on August 12, 2024

My project do not work when i register CrossPushNotification in the OnStart method. I no have a error message, but don't run. When i debug it, then get in the Service to consume, don't work. Any help is welcome.

from xamarin-plugins.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.