ハイブリッドローカル通知を実装しました
「スタミナが満タンになりました!」とかで使うアレです。
AndroidとiPhoneともに動きました。iOSならなんと喋ります。
なんという無駄な通知w
ソースはこんな感じです
import com.juankpro.ane.localnotif.NotificationManager; import com.juankpro.ane.localnotif.Notification; const _LOCAL_NOTIFICATION_CODE_001:String = "NOTIFICATION_CODE_SORATOBU_SIMAMURA_001"; const _NOTICE_SOUND_PATH:String = "notice_vo_simamura.wav";//AIR for iOS設定で、含めるファイルに追加する setLocalNotification( "しまむらくん", "「このセーター、しまむらで買ったんだ」", 3, _LOCAL_NOTIFICATION_CODE_001, _NOTICE_SOUND_PATH ); function setLocalNotification(title:String, msg:String, sec:int, notificationCode:String, soundName:String):void{ if(NotificationManager.isSupported){ var notification:Notification = new Notification(); notification.actionLabel = notification.title = title;//"しまむらくん"; notification.body = //"このセーター、しまむらで買ったんだ"; notification.tickerText = msg;//"スタミナが全快になりました!";//上にピロっと出るメッセージ notification.fireDate = new Date(); notification.fireDate.seconds += sec; notification.numberAnnotation = 1; notification.vibrate = true; if(soundName){ notification.soundName = soundName; } var m:NotificationManager = new NotificationManager(); removeLocalNotification(notificationCode, m); m.notifyUser(notificationCode, notification); } } function removeLocalNotification(notificationCode:String, m:NotificationManager=null):void{ if(NotificationManager.isSupported){ if(!m){ m = new NotificationManager(); } m.cancel(notificationCode); } }