简体   繁体   English

设备锁定时,在推送通知上设置不同的文本

[英]Set different text on Push notification when device is locked

Hope you all will be fine. 希望你们一切顺利。

I am facing a small problem related to how to set different text on push notification when device is locked. 我正面临一个小问题,涉及如何在设备锁定时在推送通知上设置不同的文本。 I am attaching image to illustrate. 我附上图片来说明。 在此输入图像描述

Here in the pic you can see that text written below the alert of push notification is slide to answer . 在图片中,您可以看到在推送通知警报下面写的文字是幻灯片来回答 While when I sent push notification to another they get slide to view 当我向其他人发送推送通知时,他们可以滑动查看

So my question is how can we change it because the device is locked and we don't have any access to push notification. 所以我的问题是我们如何更改它,因为设备已锁定,我们无权访问推送通知。 Only web server and OS have access to that push. 只有Web服务器和操作系统才能访问该推送。

Do you people have any suggestion how to do this? 你有没有人建议如何做到这一点?

Thanks- 谢谢-

For a push notification you can specify the action by using a dictionary rather than a string as the alert payload. 对于推送通知,您可以使用字典而不是字符串作为警报有效负载来指定操作。 The action-loc-key specifies the "action" text to use instead of "view" action-loc-key指定要使用的“action”文本而不是“view”

For a local notification you can set the alertAction property of a UILocalNotification to change the text. 对于本地通知您可以设置alertAction一个财产UILocalNotification更改文本。

So if you set the action-loc-key (APNS) or alertAction property ( UILocalNotification ) to "answer" you will get "slide to answer". 因此,如果将action-loc-key (APNS)或alertAction属性( UILocalNotification )设置为“answer”,您将获得“slide to answer”。

Another approach, rather than using push notification, is to use the VoIP facilities in iOS. 另一种方法是使用iOS中的VoIP设备 ,而不是使用推送通知。 By setting your sockets into "VoIP mode", iOS will notify your app when a call is received, and you can then push the local notification to the screen if necessary. 通过将套接字设置为“VoIP模式”,iOS将在收到呼叫时通知您的应用,然后您可以在必要时将本地通知推送到屏幕。

Create/Edit this text file: 创建/编辑此文本文件:

/YOURTHEME/Bundles/com.apple.springboard/en.lproj/SpringBoard.strings /YOURTHEME/Bundles/com.apple.springboard/en.lproj/SpringBoard.strings

And add this text: 并添加此文字:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN""http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AWAY_LOCK_LABEL</key>
<string>slide to unlock</string>
<key>POWER_DOWN_LOCK_LABEL</key>
<string>slide to shut down</string>
<key>SLIDE_TO_ANSWER</key>
<string>slide to answer</string>
</dict>
</plist>

Hope that helps 希望有所帮助

Taken from here.. http://modmyi.com/forums/winterboard/436941-slide-unlock-text-change.html#post2858481 从这里拍摄.. http://modmyi.com/forums/winterboard/436941-slide-unlock-text-change.html#post2858481

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM