标签: push-notification

Windows通知服务:401尝试在PHP中创建Toast通知时无效令牌

我一直在尝试向模拟器发送Toast通知.我创建了Windows Phone 8.1应用程序,并将其与商店中的应用程序相关联.之后我设法获得了我必须用来调用通道URI的访问令牌.

当我尝试使用通道URI和访问令牌发送Toast通知时,我收到此错误.

Bearer error="invalid_request",error_description="Invalid token"
Run Code Online (Sandbox Code Playgroud)

这是我创建的php测试代码.

<?php

    //GET ACCESS TOKEN
    $tokenRequest = curl_init();
    curl_setopt($tokenRequest, CURLOPT_URL, 'https://login.live.com/accesstoken.srf');

    curl_setopt($tokenRequest, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/x-www-form-urlencoded'
    ));

    //FIELDS
    $fields = array(
        'grant_type' => 'client_credentials',
        'client_id' => '0',
        'client_secret' => 'Q',
        'scope' => 'notify.windows.com'
    );

    $fields_string = "";
    foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
    rtrim($fields_string, '&');

    curl_setopt($tokenRequest, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($tokenRequest,CURLOPT_POST, count($fields));
    curl_setopt($tokenRequest,CURLOPT_POSTFIELDS, $fields_string);

    $output = json_decode(curl_exec($tokenRequest));
    curl_close($tokenRequest);
    echo "<br>";
    var_dump($output);
    echo "<br>";
    $accessToken = $output->{'access_token'};


    //SEND PUSH
    $sendPush = curl_init();
    curl_setopt($sendPush, CURLOPT_URL, …
Run Code Online (Sandbox Code Playgroud)

php c# push-notification windows-phone-8

0
推荐指数
1
解决办法
853
查看次数

如何在Pusher中指定邮件的收件人?

我有一个应用程序Laravel,Pusher用于实时通知.我的问题是,我想过滤邮件的收件人.我只希望登录的管理员接收或查看Pusher发送的通知.非管理员的其他用户不得接收通知.我怎么能在Pusher做到这一点?

access-levels push-notification websocket laravel pusher

0
推荐指数
1
解决办法
334
查看次数

服务器端使用PHP的浏览器通知

我可以使用PHP从服务器向订阅用户发送浏览器通知吗?我今天看到了这个教程,但这只能从客户端开始.我知道有像pushcrew这样的服务,但我想用PHP和JavaScript开发自己的服务.

我的实际要求是要求用户确认是否可以使用此代码向他们发送通知,

if (Notification.permission !== "granted")
{
   Notification.requestPermission();
}
Run Code Online (Sandbox Code Playgroud)

然后在我的网站上发布新文章时显示通知.

注意:浏览器支持无关紧要.

javascript php push-notification

0
推荐指数
1
解决办法
7428
查看次数

使用Firebase,Node.js和Google Cloud Messaging for iOS应用推送通知

我正在尝试使用Firebase,Node.js和Google Cloud Messaging来发送iOS应用的推送通知.下面是Node.js代码

var Firebase = require('firebase'),
    gcm = require('node-gcm')
    ;
var pushRef = new Firebase("https://<myapp>.firebaseio.com/ios/queue/tasks");

pushRef.on("child_added", function(snapshot) {

    console.log("child added event registers");

    var notificationData = snapshot.val();
    sendNotification(notificationData);
    snapshot.ref().remove();

});

function sendNotification(notificationData) {

    var message = new gcm.Message({
      notification: {
        title: "Title",
        body: notificationData.message
      }
    });

    var sender = new gcm.Sender(<my Google Server Key>);
    var registrationTokens = [notificationData.recipientId];

    console.log("about to send message");
    console.log("this is the registration token: " + registrationTokens);

    sender.send(message, { registrationTokens: registrationTokens }, 10, function (err, response) { …
Run Code Online (Sandbox Code Playgroud)

push-notification node.js firebase google-cloud-messaging

0
推荐指数
1
解决办法
5945
查看次数

使用离子推送的多次推送通知

发送两个通知时,第二个通知将覆盖通知中心中的第一个通知.根据文档,这应该只在使用标签时发生:

"tag":指示每条通知消息是否在通知中心上生成新条目.如果未设置,则每个请求都会创建一个新通知.如果已设置,并且已显示具有相同标记的通知,则新通知将替换现有通知.

然而,无论我是否为标签设置了值,这种情况一直发生在我身上.

我甚至尝试设置一个随机标签&collapse_key(据我所知,在这种情况下我不应该相关,但我试了一下).仍然没有帮助.这是我发送的通知对象的示例:

{  
   "tokens":[  
      "my-device-token"
   ],
   "profile":"my-profile-tag",
   "notification":{  
      "message":"message",
      "android":{  
         "payload":{  
            "collapse_key":9918519,
            "tag":2825928
         }
      }
   }
}
Run Code Online (Sandbox Code Playgroud)

android push-notification google-cloud-messaging ionic-framework firebase-cloud-messaging

0
推荐指数
1
解决办法
968
查看次数

将在eclipse中支持通过GCM推送通知

我正在使用eclipse IDE进行开发.我在我的项目中遵循了很多教程并实现了推送通知,但我没有得到GCM注册ID,所以我的问题是:eclipse是否会支持推送通知?

以下是代码段; 如果您需要更清晰,请在下面评论.

        registerReceiver(mHandleMessageReceiver, new IntentFilter(DISPLAY_MESSAGE_ACTION));

    Log.v("testing", "testing");
    // Get GCM registration id
    final String regId = GCMRegistrar.getRegistrationId(this);

    Log.v("regId", regId);
    // Check if regid already presents
    if (regId.equals("")) {
        // Registration is not present, register now with GCM
        Log.v("registerd","am here");

        GCMRegistrar.register(this, SENDER_ID);

    } else {
        // Device is already registered on GCM
        if (GCMRegistrar.isRegisteredOnServer(this)) {
            // Skips registration.              
            Toast.makeText(getApplicationContext(), "Already registered with GCM", Toast.LENGTH_LONG).show();
        } else {
            // Try to register again, but not in the UI …
Run Code Online (Sandbox Code Playgroud)

eclipse android push-notification google-cloud-messaging

0
推荐指数
1
解决办法
825
查看次数

没有发送有关应用更新的Google Play推送通知。我想念什么吗?

我已经在Google Play上发布了一个应用。据我说,我每次上载新的APK时,都需要更改gradle文件中的版本代码,然后从那里开始,Google Play会通知用户有关可用更新的信息。我与许多现实世界的用户保持联系,他们说尽管我已经发布了对原始应用程序的一些更新,但他们从未收到有关应用程序更新的通知。我知道有些设备级别的播放存储设置,例如“仅在wi-fi上更新应用程序”等,并且我已经验证了场景的所有此类组合。我仍然相信不会通知所有用户可用的新版本。所以我的问题是

1)我一开始就缺少什么吗?

2)我有什么选择来确保通知用户有关可用更新的信息?

android push-notification google-play build.gradle android-update-app

0
推荐指数
1
解决办法
583
查看次数

不调用NotificationService Extension(ios)

我试图在我的应用程序上创建一个新的NotificationService扩展,因此我直接在Project Navigator中删除了现有的Notification Service Extension,包括NotificationService.swift及其文件夹,并尝试创建NotificationService Extension的新目标.

创建新的扩展后,新的NotificationSerivce.swift中的方法"didreceive"从未被调用过.

我怎么能让他们工作?

push-notification apple-push-notifications ios swift

0
推荐指数
1
解决办法
2603
查看次数

当app在前台时,横幅iO推送通知

当应用程序在前台运行时,是否可以触发横幅推送通知的显示,就像它在后台一样?

我正在使用React-Native版本41.2和react-native-push-notification 2.2.1

我在搜索中注意到,通过在AppDelegate中添加以下内容,iOs 10应该是可能的:

- (void)userNotificationCenter:(UNUserNotificationCenter *)center
       willPresentNotification:(UNNotification *)notification
         withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler{
  completionHandler(UNNotificationPresentationOptionAlert);
}
Run Code Online (Sandbox Code Playgroud)

但是,这似乎没有被击中,而是正在点击didReceiveLocalNotification方法,如下所示:

// Required for the localNotification event.
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
[RCTPushNotificationManager didReceiveLocalNotification:notification];
}
Run Code Online (Sandbox Code Playgroud)

React-Native是否可以访问userNotificationCenter?或者是否可以使用其他方法获得类似的结果?

谢谢.

objective-c push-notification react-native

0
推荐指数
1
解决办法
1620
查看次数

在iOS应用中显示通知当应用程序在前景/活动在swift 3

我正在尝试在应用处于活动状态时显示横幅通知.我使用了给定的方法但没有结果,横幅通知仅在应用关闭时出现:

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {
    print("Push notification received: \(userInfo)")

    if application.applicationState == .active {
       print("active")
       let localNotification = UILocalNotification()
       localNotification.userInfo = userInfo
       localNotification.alertAction = "Test"
       localNotification.soundName = UILocalNotificationDefaultSoundName
       localNotification.alertBody = "Notification test!!"
       localNotification.fireDate = Date()
       UIApplication.shared.scheduleLocalNotification(localNotification)
     }
}
Run Code Online (Sandbox Code Playgroud)

它打印"活动"但通知未显示.我错过了任何一步吗?

谢谢.

push-notification apple-push-notifications ios swift

0
推荐指数
1
解决办法
6257
查看次数