in facebook-android-wrapper/src/com/facebook/unity/FB.java [805:850]
public static void ScheduleAppToUserNotification(String params_str) {
UnityParams unityParams = UnityParams.parse(params_str);
final UnityMessage unityMessage = new UnityMessage("OnScheduleAppToUserNotificationComplete");
if (unityParams.hasString("callback_id")) {
unityMessage.put("callback_id", unityParams.getString("callback_id"));
}
String title = unityParams.getString("title");
String body = unityParams.getString("body");
Uri media = Uri.parse(unityParams.getString("media"));
// As a convenience, convert the URI to file:// if it has no Scheme.
// this is so that Unity code can pass just the path to the local
// file.
if (media.getScheme() == null) {
media = media.buildUpon().scheme("file").build();
}
int timeInterval;
try {
timeInterval = Integer.parseInt(unityParams.getString("timeInterval"));
} catch(NumberFormatException e) {
unityMessage.sendError(String.format("Invalid timeInterval: %s", e.getMessage()));
return;
}
String payload = unityParams.getString("payload");
if (payload.equals("null")) {
payload = null;
}
GraphRequest.Callback callback = new GraphRequest.Callback() {
@Override
public void onCompleted(GraphResponse response) {
if (response.getError() != null) {
unityMessage.sendError(response.getError().toString());
} else {
unityMessage.put("success", "");
unityMessage.send();
}
}
};
try {
AppToUserNotificationSender.scheduleAppToUserNotification(
title, body, media, timeInterval, payload, callback);
} catch (FileNotFoundException e) {
unityMessage.sendError(String.format(e.getMessage()));
}
}