this is the code to invite friends on the facebook to use my app.Thanx in advance.Please help me. I configure developer console also but dont know where Im stuck. notification only show in computer browser.
private void showDialogWithoutNotificationBar(String action, Bundle params) {
// Create the dialog
dialog = new WebDialog.Builder(getActivity(),
Session.getActiveSession(), action, params)
.setOnCompleteListener(new WebDialog.OnCompleteListener() {
@Override
public void onComplete(Bundle values,
FacebookException error) {
if (error != null) {
if (error instanceof FacebookOperationCanceledException) {
Toast.makeText(
getActivity().getApplicationContext(),
error.getMessage(), Toast.LENGTH_SHORT)
.show();
} else {
Toast.makeText(
getActivity().getApplicationContext(),
error.getMessage(), Toast.LENGTH_SHORT)
.show();
}
} else {
String requestId = values.getString("request");
// DatabaseActivity.insert(requestId);
if (requestId != null) {
Toast.makeText(
getActivity().getApplicationContext(),
"Request Send", Toast.LENGTH_SHORT)
.show();
} else {
Toast.makeText(
getActivity().getApplicationContext(),
"Request cancelled", Toast.LENGTH_SHORT)
.show();
}
dialog = null;
dialogAction = null;
dialogParams = null;
}
}
}).build();
// Hide the notification bar and resize to full screen
Window dialog_window = dialog.getWindow();
dialog_window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
// Store the dialog information in attributes
dialogAction = action;
dialogParams = params;
// Show the dialog
dialog.show();
}
private void sendDirectedInvite() {
Bundle params = new Bundle();
params.putString("message", "Come join me in the friend smash times!");
showDialogWithoutNotificationBar("apprequests", params);
}
0 comments:
Post a Comment