使用离子框架从设备检索设备令牌 [英] retrieve the device token from device using ionic framework

查看:93
本文介绍了使用离子框架从设备检索设备令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 ionic 开发应用程序,我需要获取设备令牌的推送通知,但我不能得到它,请帮助我得到解决方案。

I am using ionic to develop application and I need to get the device token for push notifications but I am not able to get it, please help me to get the solution.

我没有任何通知,只是我需要发送设备令牌,当用户登录到应用程序sit.i需要获取设备令牌与任何通知
我也使用cordova推送通知插件。

i don't have any notification yet just i need to send device token when user login into the application that sit.i need to get device token with out any notification I used cordova push notification plugin also.

提前感谢。

推荐答案

您好,我终于找到解决方案获取推送通知。我使用下面的链接从设备获取设备令牌。

Hi i finally found solution for getting push notification.I used below link to get device token from the device.

    https://devdactic.com/ionic-push-notifications-guide/

请使用以下代码。

.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
    var push = new Ionic.Push({
        "debug": true
    });
    push.register(function(token) {
        console.log("My Device token:", token.token);
        push.saveToken(token); // persist the token in the Ionic Platform
    });
});

})
在控制台中,您可以看到设备的设备令牌。
如果你想实现完整的推送通知,你可以使用上面的链接。

}) In your console you can see the device token of your device. If you want to implement complete push notification you can use above link.

这篇关于使用离子框架从设备检索设备令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆