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);
查看全文
相关阅读:
模板驱动表单中的自定义表单验证
kartikgridGridView导出excel变科学计数
linux下安装vue-element-admin报错
yii2运行流程
nginx报错502 Bad Gateway
linux下安装npm
登录验证记录
vue的store、vuex状态管理
vue-cli3使用路由和循环引入路由
vue使用问题汇总记录
原文地址:https://www.cnblogs.com/yangmx/p/3725096.html
最新文章
决策树以及拓展
codeforces 628D Magic Numbers (数位dp)
SPOJ BALNUM Balanced Numbers (数位dp)
codeforces 55D Beautiful numbers(数位dp)
HOJ 13101 The Triangle Division of the Convex Polygon(数论求卡特兰数(模不为素数))
HOJ 13102 Super Shuttle (圆的反演变换)
ural 2029 Towers of Hanoi Strike Back (数学找规律)
ural 2032 Conspiracy Theory and Rebranding (数学水题)
csu1377Putter && HOJ12816
win7,Ubuntu 12.04 双系统修改启动项顺序三方法
热门文章
2014北京邀请赛反思
Gojs学习-形状
Gojs学习-文本块(TextBlocks)
gojs学习-数据绑定
Gojs-选中项移动
GoJS学习-模型与模板
angular7 路由跳转传参
angular7 动态表单与验证
angular 表单重置状态
liunx 抓包
Copyright © 2011-2022 走看看