Comments (18)
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.
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.
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.
I would also like to set an example for Android.
from xamarin-plugins.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
@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.
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)
- PushNotifications: Empty Body with FCM on Android HOT 1
- Help configuring custom icon and sound on notification HOT 2
- How do I get the Accelerometer and Magenetometer values simultaniously?
- got an error while registering push notifications HOT 4
- CrossPushNotificationListener Missing
- UWP notifications not firing HOT 3
- ANDROID Crash INVALID_PARAMETERS HOT 1
- MotionVector.cs ToString implementation
- Android - calling register() causes nav bar to disappear. HOT 1
- How can i convert the ((MotionVector)a.Value).Z from accelerattor to a angle? HOT 1
- Edit push notification sound
- Reconvert iOS Device Token to NsData problem
- Problem receiving push in iOS 11 HOT 3
- Tizen support
- Android 8 not getting notifications HOT 1
- Light Sensor
- Support .Net standard 2.0
- device motion, SensorValueChanged not fired
- Sample App is not working
- All plugins are deprecated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xamarin-plugins.