-通过WordPress中的Plugins菜单激活WP的推送通知。当您激活插件时,该插件将在您的wordpress数据库中添加2个新表,例如'all_pushnotification_logs','all_pushnotification_token'。Please make sure that those tables are exist in your current activated Database.
请确保这些表存在于当前激活的数据库中。
- Set the settings as per your requirement through wp-admin part of plugin.
-通过插件的wp-admin部分根据您的要求设置设置。
- please add FCM/GCM key if you want to pushnotification for android and Please upload the .pem certificate if you want pushnotifcaiton for ios.plese refer http://stackoverflow.com/questions/21250510/generate-pem-file-used-
-如果要为Android进行pushnotification,请添加FCM / GCM密钥;如果要为iOS进行pushnotifcaiton,请上载.pem证书。请参考http://stackoverflow.com/questions/21250510/generate-pem-file-used-
to-setup-apple-push-notification for .pem file.
.pem文件的to-setup-apple-push-notification。
Now ,
现在,
- There are two main aspects first - wordpress website which run on desktop / laptop which have a wp-admin.
-首先有两个主要方面-可以在具有wp-admin的台式机/笔记本电脑上运行的wordpress网站。
Second - the application which you created for mobile devices with ios/android.
其次-您使用ios / android为移动设备创建的应用程序。
- To send a push notification to a device, we must need to know its token (or Device ID) which has to be provided by the app through this API.
-要向设备发送推送通知,我们必须知道其令牌(或设备ID),该令牌必须由应用通过此API提供。
And the type of operating sytem which mobile is useing .
以及手机使用的操作系统的类型。
- For Registering a device you need to follow steps.
-要注册设备,您需要执行以下步骤。
- First of all you have to insert the mobile device type and mobile device token of each devices in this table.
-首先,您必须在此表中插入每个设备的移动设备类型和移动设备令牌。
For that you need to pass the device type and devices token in parameters from your application services like login , register service to the URL " http://yourwordpresssite/apnwpegister " .
为此,您需要在应用程序服务(例如,登录名)中的参数中传递设备类型和设备令牌,将服务注册到URL“ http:// yourwordpresssite / apnwp / register”。
It means whenever user register or login from your application you need to pass that particular mobile's token and mobile operation system type android / ios.
这意味着每当用户从您的应用程序注册或登录时,您都需要传递该特定移动设备的令牌,并且移动操作系统类型为android / ios。
- 'wp-json' or 'WordPress REST API' that shipped as part of WordPress core from version 4.4 Later.
-'wp-json'或'WordPress REST API',它是4.4版以后的WordPress核心的一部分。
URL structure:
网址结构:
http://yourwordpresssite/wp-json/apnwpegister
http:// yourwordpresssite / wp-json / apnwp / register
Method: GET
方法:GET
Parameters:
参数:
device_token (string): token given by APNs or FCM identifying the device, often called device ID.
device_token(字符串):由APN或FCM给出的用于标识设备的令牌,通常称为设备ID。
os_type (string): operating system.
os_type(字符串):操作系统。
It must be ios or android (case sensitive).
它必须是ios或android(区分大小写)。
user_email_id (string, optional): the user email address which is login from your mobile app.
user_email_id(字符串,可选):从移动应用程序登录的用户电子邮件地址。
Examples:
例子:
http://yourwordpresssite/wp-json/apnwpegister?os_type=android&user_email_id=androidmobile@40test.com&device_token=1234567890
http:// yourwordpresssite / wp-json / apnwp / register?os_type=android&user_email_id=androidmobile@40test.com&device_token=1234567890
Refere Document:
参考文件:
- more details how to pass the parameters in Android - https://www.codementor.io/flame3/tutorials/send-push-notifications-to-android-with-firebase-du10860kb
-更多详细信息如何在Android中传递参数-https://www.codementor.io/flame3/tutorials/send-push-notifications-to-android-with-firebase-du10860kb
- more details how to pass the parameters in ios - https://www.raywenderlich.com/123862/push-notifications-tutorial
-更多详细信息如何在ios中传递参数-https://www.raywenderlich.com/123862/push-notifications-tutorial
- After passing the parameters when user successfully register or login please check the database table `all_pushnotification_token` and check the token and OS type is inserted successfully or not.
Translations
-在用户成功注册或登录后传递参数后,请检查数据库表“ all_pushnotification_token”,并检查令牌和OS类型是否成功插入。
翻译 h3>