zoukankan
html css js c++ java
IOS 新消息通知提示-声音、震动
一、APNS
1.注册
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert];
复制代码
2.
服务器
推送(
JAVA
)
PushNotificationPayload payLoad = PushNotificationPayload.fromJSON(message);
payLoad.addAlert("iphone推送测试 www.baidu.com"); // 消息内容
payLoad.addBadge(count); // iphone应用图标上小红圈上的数值
payLoad.addSound("default"); // 铃音 默认
复制代码
二、
程序
内
1.震动
添加系统框架:
#import <AudioToolbox/AudioToolbox.h>
复制代码
调用震动代码:
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
复制代码
2.消息声音
2.1 系统声音
AudioServicesPlaySystemSound(1007);
复制代码
其中1007是系统声音的编号,其他的可用编号:
附含丰富
iphone系统声效
(点击即可)
2.2
用户
音效
//音效文件路径
NSString *path = [[NSBundle mainBundle] pathForResource:@"message" ofType:@"wav"];
//组装并播放音效
SystemSoundID soundID;
NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)filePath, &soundID);
AudioServicesPlaySystemSound(soundID);
//声音停止
AudioServicesDisposeSystemSoundID(soundID);
查看全文
相关阅读:
spring boot RESTfuldemo测试类
再谈Redirect(客户端重定向)和Dispatch(服务器端重定向)
HTTP协议解析
HTTP协议详解(真的很经典)
JMeter进行简单的数据库(mysql)压力测试
LoadRunner利用ODBC编写MySql脚本
性能瓶颈的分析
bug的处理流程
Loadrunner11 录制手机App脚本多种方法介绍
利用fiddler录制脚本
原文地址:https://www.cnblogs.com/yangmx/p/3725096.html
最新文章
Linux下mplayer源代码安装方法
ARM指令集相关知识
为何要有内部接口
消息循环相关
Android里的多线程知识点
TagHighlight
YCM安装与配置
option配置
jumplist和changlist
command-t插件使用说明
热门文章
Drawit插件
虚拟机GC的定义
区分电脑的显卡性能
mybatis使用<choose> <when> 和 <if></if>
map排序返回字符串
读文件到网页上
配置2个redis 分别用户缓存和队列
SpringBoot基于注解@Async使用线程的异步调用
js调用微信的扫二维码接口
表单提交
Copyright © 2011-2022 走看看