/// <summary> /// Callback to implement in your app to handle when a notification is opened from the Android status bar or /// a new one comes in while the app is running. /// This method is located in this activity as an example, you may have any class you wish implement NotificationOpenedHandler and define this method. /// </summary> /// <param name="message"> The message string the user seen/should see in the Android status bar. </param> /// <param name="additionalData"> The additionalData key value pair section you entered in on onesignal.com. </param> /// <param name="isActive"> Was the app in the foreground when the notification was received. </param> public override void notificationOpened(string message, JSONObject additionalData, bool isActive) { string messageTitle = "OneSignal Example", messageBody = message; try { if (additionalData != null) { if (additionalData.has("title")) { messageTitle = additionalData.getString("title"); } if (additionalData.has("actionSelected")) { messageBody += "\nPressed ButtonID: " + additionalData.getString("actionSelected"); } messageBody = message + "\n\nFull additionalData:\n" + additionalData.ToString(); } } catch (JSONException) { } (new AlertDialog.Builder(MainActivity.currentActivity)).setTitle(messageTitle).setMessage(messageBody).setCancelable(true).setPositiveButton("OK", null).create().show(); }
/// <summary> Returns the value mapped with the specified key.</summary> /// <returns> the value mapped with the specified key /// </returns> /// <throws> JSONException </throws> public virtual System.String getValue(System.String key) { return(json.getString(key)); }