android 解析仪表板中的“推送发送 0”

     2023-02-24     207

关键词:

【中文标题】android 解析仪表板中的“推送发送 0”【英文标题】:"Pushes sent 0" in parse dashboard for android 【发布时间】:2015-07-15 14:08:36 【问题描述】:

我正在尝试将推送通知从解析发送到 android。从浏览器发送它时,设备的计算正在正确显示。但是浏览器中显示的是“Pushes sent 0”。

我在应用程序类中注册通知

ParsePush.subscribeInBackground("", new SaveCallback() 
    @Override
    public void done(ParseException e) 
        if (e == null) 
            Log.d("com.parse.push", "successfully subscribed to the broadcast channel.");
         else 
            Log.e("com.parse.push", "failed to subscribe for push", e);
        
    
);
ParseInstallation.getCurrentInstallation().saveInBackground();

我还在我的 android 项目中创建了Receiver

public class PushMessageBroadcast extends ParsePushBroadcastReceiver 

    @Override
    public void onPushOpen(Context context, Intent intent) 
        Log.d("The push","open");
    

    @Override
    protected Notification getNotification(Context context, Intent intent) 
        // TODO Auto-generated method stub
        return super.getNotification(context, intent);
    

    @Override
    protected void onPushDismiss(Context context, Intent intent) 
        // TODO Auto-generated method stub
        super.onPushDismiss(context, intent);
    

    @Override
    protected void onPushReceive(Context context, Intent intent) 
        //here You can handle push before appearing into status e.g if you want to stop it.
        super.onPushReceive(context, intent);
    

我也做了manifest的改动:

<receiver
    android:name=".receivers.PushMessageBroadcast "
    android:exported="false">
    <intent-filter>
        <action android:name="com.parse.push.intent.RECEIVE" />
        <action android:name="com.parse.push.intent.DELETE" />
        <action android:name="com.parse.push.intent.OPEN" />
    </intent-filter>
</receiver>

我需要更改解析中的任何设置吗?提前致谢。

【问题讨论】:

尝试将通知发送到所有设备而不是特定频道,看看是否有效 它将始终显示为 0 几分钟。如果在发送推送通知后等待一段时间然后刷新,它应该会更新到正确的设备数量。 【参考方案1】:

修改后的答案

在@lochana-tejas 发表评论后,我意识到我的答案不正确,因为我在 Google 开发者控制台“Android 的云消息传递”中再次禁用,并且我的设备仍然收到了通知。

因此,您需要控制的第一件事是,在 Parse Dashboard 中,您拥有 Installation 类,并且该类注册了一个或多个设备。如果您没有此类或为空“推送已发送”将为 0。

我把我的代码复制在这里,你可以比较

  public static void registerParse(Context context) 
        Parse.setLogLevel(Parse.LOG_LEVEL_VERBOSE);

        Parse.initialize(context, PARSE_APPLICATION_ID, PARSE_CLIENT_KEY);
        ParseInstallation.getCurrentInstallation().saveInBackground();

        ParsePush.subscribeInBackground(PARSE_CHANNEL, new SaveCallback() 
            @Override
            public void done(ParseException e) 
                if (e == null) 
                    Log.d("com.parse.push", "Successfully subscribed to Parse!");
                 else 
                    Log.e("com.parse.push", "failed to subscribe for push", e);
                
            
        );
    

    //This is the user that will be inserted in "Installation class"
    public static void subscribeWithUser(String user) 
        ParseInstallation installation = ParseInstallation.getCurrentInstallation();

        installation.put("user", user);

        installation.saveInBackground(new SaveCallback() 
            @Override
            public void done(ParseException e) 
                if (e == null) 
                    Log.e("subscribeWithUser", "User subscribed successfully!!", e);
                 else 
                    e.printStackTrace();
                    Log.e("subscribeWithUser", "Error to save user", e);
                
            
        );


    

我的清单是这样的

        <!-- Added for Parse push notifications -->

        <service android:name="com.parse.PushService" />
        <receiver
            android:name=".receiver.CustomPushReceiver"
            android:exported="false">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.USER_PRESENT" />
                <action android:name="com.parse.push.intent.RECEIVE" />
                <action android:name="com.parse.push.intent.DELETE" />
                <action android:name="com.parse.push.intent.OPEN" />
            </intent-filter>
        </receiver>
        <receiver
            android:name="com.parse.GcmBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                <category android:name="com.parse.starter" />
            </intent-filter>
        </receiver>
        <receiver android:name="com.parse.ParseBroadcastReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.USER_PRESENT" />
            </intent-filter>
        </receiver>   

【讨论】:

你的意思是我们不想添加gcm注册编码但需要在google控制台中创建项目? @LochanaTejas 你是对的。没有必要在 Google Developer 控制台中启用 API,所以我更改了所有答案 是的,现在编辑的答案是正确的。无需在控制台中启用 GCM,也无需在我们的 Android 中添加 GCM 代码。但是我仍然创建了这个项目,并随身携带了我的 senderID,但什么也没做。只需要在清单中进行更改,并将推送注册到用于在收到通知后处理通知的活动 我接受这个答案也包括我上面的评论

如何在自托管解析服务器设置中的仪表板上设置生产模式

】如何在自托管解析服务器设置中的仪表板上设置生产模式【英文标题】:Howtosetproductionmodeonthedashboardinaselfhostedparse-serversetup【发布时间】:2017-03-2806:38:45【问题描述】:我尝试在js配置中设置NODE_ENV=production或production:true。但是... 查看详情

将解析列中的值抓取到标签中

...册视图控制器,注册后我有一个usersVC视图控制器。在Parse仪表板中,我添加了一个名为profileName的列,我希望在注册后将该列中的值抓取到某个标签。这里解析仪表板:enterimagedescriptio 查看详情

AWS Bitnami Parse Server - 添加 HTTP 身份验证使我在解析仪表板中的应用程序“未经授权”

】AWSBitnamiParseServer-添加HTTP身份验证使我在解析仪表板中的应用程序“未经授权”【英文标题】:AWSBitnamiParseServer-AddingHTTPauthenticationmakesmyappsinparsedashboard\'unauthorized\'【发布时间】:2017-02-1022:49:21【问题描述】:我最近设置了一... 查看详情

解析 Android 推送通知

...back4app.com/docs/android/push-notification/send-push-dashboard/我从Parse仪表板推送通 查看详情

解析服务器中的推送通知

...】:我正在通过ParseServer实现Firebase推送通知。当我通过仪表板发送通知时,过去推送它显示为已发送。我无法接收/未接收推送通知AndroidManifeast.xml<receiverandroid:name="com.parse.ParsePushBroadc 查看详情

我想通过使用解析从 android 设备单击按钮向某些 android 设备发送通知

...:,我编写了这段代码sn-p,但是当我单击按钮时,推送仪表板显示失败消息,如图所示截图:ParseQuer 查看详情

解析仪表板为空白

】解析仪表板为空白【英文标题】:ParseDashboardisblank【发布时间】:2017-04-2919:00:02【问题描述】:我已经在亚马逊EC2的同一实例上使用mongodb设置了Parse-Server。我无法访问parse-dashboard,因为我没有安装SSL证书,所以我使用了nginx+Le... 查看详情

解析仪表板设置

】解析仪表板设置【英文标题】:ParseDashboardSettings【发布时间】:2016-06-2419:05:28【问题描述】:我将Heroku上的ParseServerDashboard与我的iOS应用程序一起使用,并且我想配置推送通知。我知道我可以在应用程序设置中进行配置,但在... 查看详情

解析服务器仪表板不工作窗口

】解析服务器仪表板不工作窗口【英文标题】:Parseserverdashboardnotworkingwindows【发布时间】:2016-11-2713:11:58【问题描述】:我在Windows上使用https://github.com/ParsePlatform/parse-dashboard的解析仪表板,cmd提示说“仪表板现在在http://0.0.0.0:4... 查看详情

从解析仪表板上传时如何减小图像大小

】从解析仪表板上传时如何减小图像大小【英文标题】:Howtoreduceimagesizewhenuploadingfromparsedashboard【发布时间】:2017-02-1107:14:27【问题描述】:我正在使用heroku托管的解析服务器和解析仪表板。使用mongoDb作为后端。使用AWSS3适配器... 查看详情

解析服务器仪表板登录

】解析服务器仪表板登录【英文标题】:Parseserverdashboardlogin【发布时间】:2017-04-0815:58:48【问题描述】:所以,我是AndroidStudio的新手。我正在逐步学习在线课程。我在AWS上使用ParseServer。我已经设法获得了我的appId等,并且可以... 查看详情

在 AWS 上解析仪表板并添加云代码

】在AWS上解析仪表板并添加云代码【英文标题】:ParseDashboardonAWSandaddingcloudcode【发布时间】:2016-07-3010:14:08【问题描述】:我使用thisguid在我的AWS弹性beanstalk上配置了一个解析服务器,我已经对其进行了测试,一切正常现在我找... 查看详情

Heroku 上的解析仪表板:无法查看分析和应用程序设置

】Heroku上的解析仪表板:无法查看分析和应用程序设置【英文标题】:ParseDashboardonHeroku:UnabletoseeAnalyticsandAppSettings【发布时间】:2016-11-0619:42:27【问题描述】:我在Heroku上部署了一个解析应用程序。我还部署了ParseDashboard(来自t... 查看详情

计划解析来自 ios 的推送通知未在仪表板上更新

】计划解析来自ios的推送通知未在仪表板上更新【英文标题】:scheduleparsepushnotificationfromiosnotupdatingondashboard【发布时间】:2014-06-0505:20:11【问题描述】:我正在为我的ios应用程序使用解析推送通知服务。当我通过restapi请求调度... 查看详情

在本地解析服务器上运行的解析仪表板错误出现:加载资源失败:服务器响应状态为 404(未找到)

】在本地解析服务器上运行的解析仪表板错误出现:加载资源失败:服务器响应状态为404(未找到)【英文标题】:parse-dashboardrunningonlocalparse-servererrorsoutinwith:Failedtoloadresource:theserverrespondedwithastatusof404(NotFound)【发布时间】:2021... 查看详情

无法在 AWS(亚马逊网络服务)上登录解析仪表板

】无法在AWS(亚马逊网络服务)上登录解析仪表板【英文标题】:Can\'tloginparsedashboardonAWS(amazonwebservice)【发布时间】:2017-07-2200:08:16【问题描述】:在AWS上创建解析服务器实例后,可以看到配置了。varapi=newParseServer(databaseURI:"mong... 查看详情

解析服务器仪表板列验证,如用户类用户名

】解析服务器仪表板列验证,如用户类用户名【英文标题】:ParseServerDashboardColumnvalidationlikeUserclassusername【发布时间】:2017-02-0920:09:49【问题描述】:我只是想知道在从ParseDashboard强制创建时,是否有办法使类的列。就像_User类... 查看详情

Android Studio 中的图表/图形

...布时间】:2021-09-0823:37:03【问题描述】:我正在开发一个仪表板应用程序,我需要几个不同的图表/图形。有没有什么方法可以在没有任何库的情况下创建它们?如果是这样,你能教我怎么做吗?提前致谢!【问题讨论】:有manye... 查看详情