Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Need help adding Intent and BroadcastReceiver statements to a class for Push notifications

$
0
0

This guide details how to set up push notifications using GCM https://docs.microsoft.com/en-us/azure/notification-hubs/xamarin-notification-hubs-push-notifications-android-gcm

However, I'm using Baidu Push notifications. I've already created the binding library from the .jar files, and have created the class that will handle notifications (which inherits from Baidu's PushMessageReceiver class). But I'm not sure how to deal with these types of statements (taken from the Xamarin.Android GCM guide):

[assembly: Permission(Name = "@PACKAGE_NAME@.permission.C2D_MESSAGE")]
 [assembly: UsesPermission(Name = "@PACKAGE_NAME@.permission.C2D_MESSAGE")]
 [assembly: UsesPermission(Name = "com.google.android.c2dm.permission.RECEIVE")]

 //GET_ACCOUNTS is needed only for Android versions 4.0.3 and below
 [assembly: UsesPermission(Name = "android.permission.GET_ACCOUNTS")]
 [assembly: UsesPermission(Name = "android.permission.INTERNET")]
 [assembly: UsesPermission(Name = "android.permission.WAKE_LOCK")]

and

[BroadcastReceiver(Permission=Gcm.Client.Constants.PERMISSION_GCM_INTENTS)]
 [IntentFilter(new string[] { Gcm.Client.Constants.INTENT_FROM_GCM_MESSAGE },
     Categories = new string[] { "@PACKAGE_NAME@" })]
 [IntentFilter(new string[] { Gcm.Client.Constants.INTENT_FROM_GCM_REGISTRATION_CALLBACK },
     Categories = new string[] { "@PACKAGE_NAME@" })]
 [IntentFilter(new string[] { Gcm.Client.Constants.INTENT_FROM_GCM_LIBRARY_RETRY },
     Categories = new string[] { "@PACKAGE_NAME@" })]

as well as using the [Service] statement, I'm just not too familiar with this.

Obviously the names are different, as I'm using Baidu and not GCM. But I'm still not sure exactly what I need to put here. The API for using Baidu with a normal Android app in Java is here: http://push.baidu.com/doc/android/api . Based on looking at the Android Manifest example in that page, what do I need to do to get it working in c#?

Any help will be appreciated so much, I've been stuck at this point for such a long time...


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>