标签: pushwoosh

使用PHP和Pushwoosh开发的推送通知服务功能的适当系统流程应该是什么?

我是专业的PHP开发人员.所以,我对移动应用程序,iOS,Android等知识不太了解.所以,请尝试了解我.

我是一个由相应的开发团队使用iOS开发的应用程序.现在,我必须使用Pushwoosh为此应用程序提供推送通知.

我已经理解推送通知和Pushwoosh的用法是什么意思.此外,我可以使用从Pushwoosh控制面板获得的app_id和auth_key发送示例推送通知.当我从服务器运行相应的PHP文件时,我收到了正确的状态代码的"成功消息".

我的查询实际上是关于如何从服务器端角度将此推送通知服务实现到应用程序中?

现在,让我们考虑更有活力和实用的东西.

实际上MySQL数据库中有一个表包含通知.只要任何新条目插入该表,我就要检查它(通知)是否是登录用户.如果存在为登录用户生成的任何新通知,我将通过"Pushwoosh"将推送通知发送给相关用户到他/她的相应设备.

现在我的问题是,应该从应用程序端调用包含用于检查新通知并将其作为推送通知发送的代码的PHP文件,还是有其他方法?

换句话说,我的疑问是,应该仅在来自应用程序的请求时才检查新通知吗?

我与移动应用程序开发团队讨论了同样的问题,他们告诉我,我们不会向您发送任何类型的请求,您只需向我们发送推送通知.他们告诉我,推送通知的含义与app永远不会向服务器发送任何请求的含义相同,服务器本身应该在可用时将通知发送给应用程序.

那么在这种情况下,如果没有收到请求,那么包含代码的PHP文件应该如何执行呢?

这里的另一个问题是,如果应用程序不会向PHP文件发送任何请求,那么我应该如何知道哪个用户已登录并请求为他/她生成的新通知(如果有)?

假设,如果PHP文件的请求已经到来,那么我是否需要在PHP代码中为该特定用户进行基于令牌的身份验证,或者它将在应用程序端完成,并且只有在成功验证用户后才会将请求发送到PHP文件?

此外,每两分钟间隔(轮询)应检查新通知.应该从哪里进行检查?我的意思是PHP文件每隔两分钟从应用程序接收请求还是什么?

请帮我解决这些繁琐的问题.

谢谢.

以下是我的示例代码(为了安全起见,已更改了Auth Token和App ID):

<?php
  define('PW_AUTH', 'XXXXXXXXXXX');
  define('PW_APPLICATION', 'XXXXXXXXXXX');
  define('PW_DEBUG', true);

  function pwCall($method, $data) {
    $url = 'https://cp.pushwoosh.com/json/1.3/' . $method;
    $request = json_encode(['request' => $data]);

    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
    curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
    curl_setopt($ch, CURLOPT_HEADER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $request);

    $response = curl_exec($ch);
    $info = curl_getinfo($ch);
    curl_close($ch); …
Run Code Online (Sandbox Code Playgroud)

php token push-notification apple-push-notifications pushwoosh

8
推荐指数
1
解决办法
342
查看次数

Phonegap pushwoosh插件registerDevice App崩溃

我有这个问题,因为有些日子我已经尝试了很多.我找到了很多解决方案,但没有一个有效.

我还尝试重新安装Android Studio和SDK.我也更新了SDK.

还是一样的错误.这是App Crash时出现的错误.

ATAL EXCEPTION: IntentService[GCMRegistrationService]
 Process: sample.tinfo.main, PID: 14194
 java.lang.NoSuchMethodError: No virtual method getNoBackupFilesDir(Landroid/content/Context;)Ljava/io/File; in class Landroid/support/v4/content/ContextCompat; or its super classes (declaration of 'android.support.v4.content.ContextCompat' appears in /data/app/sample.tinfo.main-1/base.apk)
     at com.google.android.gms.iid.zzd.zzeb(Unknown Source)
     at com.google.android.gms.iid.zzd.<init>(Unknown Source)
     at com.google.android.gms.iid.zzd.<init>(Unknown Source)
     at com.google.android.gms.iid.InstanceID.zza(Unknown Source)
     at com.google.android.gms.iid.InstanceID.getInstance(Unknown Source)
     at com.pushwoosh.GCMRegistrationService.register(Unknown Source)
     at com.pushwoosh.GCMRegistrationService.onHandleIntent(Unknown Source)
     at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
     at android.os.Handler.dispatchMessage(Handler.java:102)
     at android.os.Looper.loop(Looper.java:145)
     at android.os.HandlerThread.run(HandlerThread.java:61)
Run Code Online (Sandbox Code Playgroud)

我正在使用Mac OS和最新的Android studio 1.5.0.

以下是My Gradle File的一些截图.

在此输入图像描述

以下是My project.properties的一些截图

在此输入图像描述

以下是My SDK的一些截图

在此输入图像描述 在此输入图像描述

请帮我.提前致谢.

phonegap-plugins cordova pushwoosh cordova-plugins

7
推荐指数
1
解决办法
500
查看次数

Pushwoosh漏掉了我的活动

我在我的应用程序中使用Pushwoosh来接收推送通知.我正在使用最新版本的Pushwoosh库3.1.14.

我有这样的屏幕结构.

Login Activity -> Main Activity with multiple tabs.
Run Code Online (Sandbox Code Playgroud)

所以我在MainActivity中实现了与pushwoosh相关的逻辑.我想从注销Logout取消注册,然后返回Login Activity.

我的代码如下.我已经过滤掉了与Pushwoosh无关的所有其他部分.坦率地说,这个代码是完全同样Pushwoosh文档中的代码在这里.唯一的区别在于onLogout()方法,我尝试从pushwoosh取消注册并返回LoginActivity.

TabbarActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);

   //Pushwoosh Registration
   registerReceivers();
   PushManager pushManager = PushManager.getInstance(this);
   pushManager.setNotificationFactory(new PushNotificationFactory());
   try {
       pushManager.onStartup(this);
   } catch(Exception e) {}

   //Register for push!
   pushManager.registerForPushNotifications();
   checkMessage(getIntent());
} 


@Override 
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);    
    setIntent(intent);    
    checkMessage(intent);
}

@Override
protected void onResume() {    
    super.onResume();    
    registerReceivers();
}

@Override
protected void onPause() {    
    super.onPause();    
    unregisterReceivers();
}

BroadcastReceiver mBroadcastReceiver = new BaseRegistrationReceiver() {    
   @Override    
   public void …
Run Code Online (Sandbox Code Playgroud)

android memory-leaks memory-management android-activity pushwoosh

6
推荐指数
1
解决办法
386
查看次数

phonegap pushwoosh插件registerDevice回调函数永远不会在android上激活

我正在尝试使用Pushwoosh推送通知phonegap构建插件,但registerDevice回调永远不会在我的Android设备上触发,但initPushwoosh功能会触发,因为我在下面的代码中看到来自警报("initPushwoosh")的警报

下面是我的config.xml

<?xml version="1.0" encoding="UTF-8"?>

<!-- config.xml reference: https://build.phonegap.com/docs/config-xml -->
<widget xmlns     = "http://www.w3.org/ns/widgets"
        xmlns:gap = "http://phonegap.com/ns/1.0"
        id        = "com.phonegap.hello-world"
        version   = "1.0.0">

    <name>Push notification</name>

    <description>
        Camera example app.
    </description>

    <author href="http://phonegap.com" email="support@phonegap.com">
        PhoneGap Team
    </author>

    <preference name="phonegap-version" value="3.3.0" /> 

    <gap:plugin name="org.apache.cordova.core.camera" />

     <plugin name="PushNotification"
        value="com.pushwoosh.plugin.pushnotifications.PushNotifications" onload="true"/>

     <access origin="*.pushwoosh.com" />
</widget>
Run Code Online (Sandbox Code Playgroud)

这是我的index.js,我只是将项目ID和appid更改为XXXX,这样我就不会错误地透露太多.

var app = {
    // Application Constructor
    initialize: function() {
        this.bindEvents();
    },
    // Bind Event Listeners
    //
    // Bind any events that are required on startup. Common events …
Run Code Online (Sandbox Code Playgroud)

push-notification phonegap-build pushwoosh

5
推荐指数
1
解决办法
1810
查看次数

在 chrome 中获取并显示来自 serviceworker 的推送数据

我使用 pushwoosh 在我的网络应用程序中接收推送通知。一切正常,并在 serviceworker 侦听器中收到推送消息,但我想从 serviceworker 提供推送消息数据并在另一个 js 类中处理它

main.js 像这样:

if ('serviceWorker' in navigator) {
  console.log('Service Worker is supported');
  navigator.serviceWorker.register('sw.js').then(function() {
    return navigator.serviceWorker.ready;
  }).then(function(reg) {
    console.log('Service Worker is ready :^)', reg);
      // TODO
  }).catch(function(error) {
    console.log('Service Worker error :^(', error);
  });
}

// get push message data in main.js and process it
Run Code Online (Sandbox Code Playgroud)

像这样的服务人员:

self.addEventListener('push', function(event) {
  console.log('Push message', event);

  var title = 'Push message';

  event.waitUntil(
    self.registration.showNotification(title, {
      'body': 'The Message',
      'icon': 'images/icon.png'
    }));
});
Run Code Online (Sandbox Code Playgroud)

javascript pushwoosh service-worker

5
推荐指数
1
解决办法
2776
查看次数

如何使用C#中的Pushwoosh Web API将推送通知发送给某些特定用户?

我想使用Pushwoosh Web API向一些订阅者广播推送通知.

我一直在使用在他们的网站上给出的代码在这里

但它正在向所有注册用户发送.如何仅将通知发送给某些特定用户?

这是JSON制作代码:

string pwAuth = "YOUR_AUTH_TOKEN";
       string pwApplication = "PW_APPLICATION_CODE";
       JObject json = new JObject(
           new JProperty("application", pwApplication),
           new JProperty("auth", pwAuth),
           new JProperty("notifications",
               new JArray(
                   new JObject(
                       new JProperty("send_date", "now"),
                       new JProperty("content", "test"),
                       new JProperty("wp_type", "Toast"),
                       new JProperty("wp_count", 3),
                       new JProperty("data",
                           new JObject(
                               new JProperty("custom", "json data"))),
                       new JProperty("link", "http://pushwoosh.com/"),
                       new JProperty("conditions",
                           new JArray(
                               (object)new JArray("Color", "EQ", "black")))))));
       PWCall("createMessage", json);
Run Code Online (Sandbox Code Playgroud)

谢谢

c# pushwoosh

4
推荐指数
1
解决办法
2759
查看次数

是否需要包含来自gomoob的任何文件:php-pushwooshto来运行PHP程序以向iPhone发送推送通知?

我想通过为它编写PHP代码来向iPhone设备发送推送通知.

gomoob:php-pushwoosh是一个可以轻松使用pushwoosh REST Web服务的PHP库.

这是gomoob:php-pushwoosh的URL

根据说明,我在我的本地机器上使用Composer在位置'/ var/www/gomoob-php-pushwoosh'上安装了gomoob:php-pushwoosh

我在一个名为"/var/www/gomoob-php-pushwoosh/sample_1.php"sample_1.php位置的文件中写了以下代码

<?php

ini_set('display_startup_errors',1);
ini_set('display_errors',1);
error_reporting(-1);

require __DIR__.'/vendor/autoload.php';


// Create a Pushwoosh client
$pushwoosh = Pushwoosh::create()
    ->setApplication('XXXX-XXX')
    ->setAuth('xxxxxxxx');

// Create a request for the '/createMessage' Web Service
$request = CreateMessageRequest::create()
    ->addNotification(Notification::create()->setContent('Hello Jean !'));

// Call the REST Web Service
$response = $pushwoosh->createMessage($request);

// Check if its ok
if($response->isOk()) {
    print 'Great, my message has been sent !';
} else {
    print 'Oups, the sent failed …
Run Code Online (Sandbox Code Playgroud)

php require push-notification php-include pushwoosh

2
推荐指数
1
解决办法
347
查看次数

Pushwoosh集成构建错误

我不明白为什么我遇到这个问题.希望有人可以帮助我解决这个问题.我正在尝试导入pushwoosh框架,并在构建项目时遇到这个奇怪的错误.我所做的只是将框架从该文件夹SDK拖放到我的Frameworks文件夹并构建项目.对我来说很奇怪的是,我找不到其他人遇到这个问题.我正在使用最新的pushwoosh SDK,并针对类似的问题尝试了多种解决方案,并没有解决它.

Undefined symbols for architecture arm64:
  "_deflate", referenced from:
      pushwoosh::zipWriteInFileInZip(void*, void const*, unsigned int) in Pushwoosh(zip.o)
      pushwoosh::zipCloseFileInZipRaw(void*, unsigned long, unsigned long) in Pushwoosh(zip.o)
  "_inflate", referenced from:
      pushwoosh::unzReadCurrentFile(void*, void*, unsigned int) in Pushwoosh(unzip.o)
  "_deflateInit2_", referenced from:
      pushwoosh::zipOpenNewFileInZip3(void*, char const*, pushwoosh::zip_fileinfo const*, void const*, unsigned int, void const*, unsigned int, char const*, int, int, int, int, int, int, char const*, unsigned long) in Pushwoosh(zip.o)
  "_deflateEnd", referenced from:
      pushwoosh::zipCloseFileInZipRaw(void*, unsigned long, unsigned long) in Pushwoosh(zip.o)
  "_inflateInit2_", referenced from:
      pushwoosh::unzOpenCurrentFile3(void*, int*, …
Run Code Online (Sandbox Code Playgroud)

ios pushwoosh

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

无法连接到推送扩展服务

我将推送扩展服务(目标)添加到我的项目 iOS 10 Rich Notifications Integration

它无法连接到进程(并且它不起作用 - 无法更改有效负载)。Xcode 仅通过“调试 - 通过 PID 或名称附加到进程”连接到进程一次。现在,它等待“等待附加”状态。

Xcode 9.4.1 运行设备 iPhone 7 Plus 11.4

iphone xcode apple-push-notifications ios pushwoosh

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

Pushwhoosh远程通知

我们使用Pushwhoosh进行远程通知.它的工作正常,但Icon徽章计数没有增加.

这是代码:

- (void) onPushReceived:(PushNotificationManager *)pushManager withNotification:(NSDictionary *)pushNotification onStart:(BOOL)onStart
{
    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:1];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:  (UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge)];

     PushNotificationManager * pushManager = [PushNotificationManager pushManager];
    pushManager.delegate = self;

    if ([launchOptions objectForKey:UIApplicationLaunchOptionsLocationKey]) {
        PushNotificationManager * pushManager = [PushNotificationManager pushManager];
        [pushManager startLocationTracking];
    }

    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:1];
    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
}
Run Code Online (Sandbox Code Playgroud)

推送时如何增加应用程序图标徽章计数?

iphone objective-c ios pushwoosh

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