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);
查看全文
相关阅读:
java循环结构
java 修饰符
java变量类型
java对象和类
java 环境配置及开发工具
easy_install 和 pip
比利牛斯獒犬 flask web
vim 命令
vim vi Ubuntu 设置
Python interview_python
原文地址:https://www.cnblogs.com/yangmx/p/3725096.html
最新文章
ACPI in Linux
LINUXFOUNDATION EVENTS
Plug and Play
Linux free显示讲解
Linux下如何创建新用户
Something about cache
struct platform_device中的id成员
mysql每次update数据,自动更新对应表中时间字段
【转】git2.9.2使用总结
配置node低版本支持ES7
热门文章
webstorm2017中添加git
JavaScript中的Truthy和Falsy
requirejs r.js 打包报错paths fallback not supported in optimizer please provide a build config path override for jquery
【转】eclipse中复制导入的项目并且修改了项目名字,项目后面的括号显示原来项目的名字
vue报错:Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.
vue中添加less配置,用于计算div高度
Java 条件语句 if else
java 基本语法
java tomcat服务器
java tomcate 启动后cmd 出现乱码
Copyright © 2011-2022 走看看