Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Display custom page upon clicking a notification from onesignal server

$
0
0

Hey...First of all just implemented one signal in my xamarin forms project and loved it..its really awsome....but i was having some issues displaying a page other then the main page upon clicking a notification...it should display a page of my choice whether the app is in background,foregound or killed..how would i do that....
PS ...I have disabled the default behaviour in android..
any kind of help would be appreciated..Thanks

this is my android manifest file:

<?xml version="1.0" encoding="utf-8"?>







<application android:label="StartUpXamarin.Droid">

<!--<meta-data android:name="com.onesignal.NotificationOpened.DEFAULT" android:value="DISABLE" />-->

<receiver android:name="com.onesignal.GcmBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND" >
  <intent-filter>
    <action android:name="com.google.android.c2dm.intent.RECEIVE" />
    <category android:name="com.startupxamarin" />
  </intent-filter>
</receiver>


This is the code in my App class that is derived from Application class in my xamarin forms project:

OneSignal.Current.StartInit("onesignal app id").Settings(new Dictionary<string, bool>() {
{ IOSSettings.kOSSettingsKeyAutoPrompt, false },
{ IOSSettings.kOSSettingsKeyInAppLaunchURL, true } })
.InFocusDisplaying(OSInFocusDisplayOption.Notification)
.HandleNotificationOpened((result) =>
{
result.action = new OSNotificationAction();
//Current.MainPage.Navigation.PushModalAsync(new ShowMeTheMessagexaml(result.notification.payload.title, result.notification.payload.body));
Debug.WriteLine("HandleNotificationOpened: {0}", result.notification.payload.body);
})
.HandleNotificationReceived((notification) =>
{

           Debug.WriteLine("HandleNotificationReceived: {0}", notification.payload.body);

       })
      .EndInit();

Viewing all articles
Browse latest Browse all 77050

Trending Articles



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