简体   繁体   English

用户未在我的Android应用中收到通知

[英]User do not receive notification in my android app

I developed an app, and Need to invite your friends in the game. 我开发了一个应用,并且需要邀请您的朋友参加游戏。 I send the request through the app-to-user's way But confusing. 我通过应用程序到用户的方式发送请求,但令人困惑。 users who is not using the app can not receive the notifications. 未使用该应用程序的用户无法接收通知。 Users who has used the app can receive the notifications. 使用该应用程序的用户可以接收通知。 My purpose is to send a notifications with a URL to the user who is not using the app, let him download my app. 我的目的是向不使用该应用程序的用户发送带有URL的通知,让他下载我的应用程序。

I read some posts and know that this may be due to the canvas URL caused. 我阅读了一些帖子,并且知道这可能是由于画布URL引起的。

Here is my code 这是我的代码

private void sendRequestDialog(Bundle params2) {
    Bundle params = new Bundle();
    params.putString("to", params2.getString("to"));
    params.putString("message", params2.getString("message"));

    WebDialog requestsDialog = (new WebDialog.RequestsDialogBuilder(main,
            Session.getActiveSession(), params)).setOnCompleteListener(
            new OnCompleteListener() {

                @Override
                public void onComplete(Bundle values,
                        FacebookException error) {
                    if (error != null) {
                        if (error instanceof FacebookOperationCanceledException) {
                            Toast.makeText(main.getApplicationContext(),
                                    "Request cancelled", Toast.LENGTH_SHORT)
                                    .show();
                        } else {
                            Toast.makeText(main.getApplicationContext(),
                                    "Network Error", Toast.LENGTH_SHORT)
                                    .show();
                        }
                    } else {
                        final String requestId = values
                                .getString("request");
                        if (requestId != null) {
                            Toast.makeText(main.getApplicationContext(),
                                    "Request sent", Toast.LENGTH_SHORT)
                                    .show();
                        } else {
                            Toast.makeText(main.getApplicationContext(),
                                    "Request cancelled", Toast.LENGTH_SHORT)
                                    .show();
                        }
                    }
                }
            }).build();
    requestsDialog.show();
}

My answer here may help : How to share a message to facebook -- android 我在这里的答案可能会有所帮助: 如何将消息共享给Facebook-Android

Find the link to the facebook documentation in the comments. 在评论中找到指向Facebook文档的链接。 Then simply make sure you are following the steps during app creation and specifying a Canvas URL. 然后,只需确保您在创建应用程序过程中遵循了步骤并指定了Canvas URL。 There are examples at the bottom of the page to assist you. 页面底部有一些示例可为您提供帮助。 Your code doesn't seem to be the problem, it just needs a suitable link for your application to be able to provide invitations. 您的代码似乎不是问题,它只需要一个适合您的应用程序的链接就可以提供邀请。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android 应用程序未通过 Firebase FCM 接收推送通知 - Android App do not receive push notification trough Firebase FCM Android用户点击我的通知并返回我的应用 - Android User Taps My Notification and Return to my app Windows Azure通知中心,我的应用程序未收到通知 - Windows Azure notification hub, my app doesn't receive notifications 尝试通过 Firebase 接收推送通知时,Android 应用程序崩溃 - Android App crash when is trying to receive a push notification trough firebase 使用 FCM 杀死应用程序时,Android 无法接收通知 - Android unable to receive notification when app is killed using FCM 推送示例android gcm,已注册设备,但未收到推送通知 - Push example android gcm, registered device but do not receive push notification 用户为 android 应用程序设置首选通知音 - User setting preferred notification tone for the android app 如果Android杀了我的应用程序并且我从设置中执行强制关闭,我会收到GCM消息吗? - Will I receive GCM messages if Android kill my app and if I do a Force Close from the settings? 在我的Android应用中以编程方式打开通知 - Turn On Notification Programatically in My Android app 检查数据库并接收android通知 - Check database and receive android notification
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM