Tag: 通知

如何在网站上播放通知声音?

当某个事件发生时,我希望我的网站向用户播放短暂的通知声音。 当网站打开时,声音不应该自动启动(即时)。 相反,它应该通过JavaScript(当发生某些事件时)按需播放。 重要的是,这也适用于旧的浏览器(IE6等)。 所以,基本上有两个问题: 我应该使用什么编解码器? embeddedaudio文件的最佳做法是什么? ( <embed> vs <object> vs. Flash vs. <audio> )

为本地通知select自定义声音

你如何改变播放本地通知的声音? 我使用下面的代码来播放默认声音: notif.soundName = UILocalNotificationDefaultSoundName; 所以,我在下面尝试了这个,但是没有成功。 我该怎么办? 谢谢你的帮助! notif.soundName = @"sound.caf";

如何解决“在Xcode 4.3中找不到有效的”aps-environment“授权string?

我一直在努力创build一个简单的iOS应用程序,可以接收推送通知。 我这样做的唯一理由是为其他一些团队成员build立一个程序,并且无法在networking上的其他地方find最新的工作版本。 我们的商店对于iOS开发来说相当新颖,我个人对iOS开发和Xcode完全没有经验。 我偶然发现了苹果和其他地方的数十篇教程,文章和麻烦post,我觉得我可能已经快到了那里了。 这里是我必须要注意的地方(注意我使用的是Xcode 4.3,并且最初尝试部署到iOS 5.1,而且我收集到一些事情可能已经在最近版本的Xcode上发生了变化,但是我又是新手了这 – 发现它完全混乱和复杂): 1)我的iPhone上有一个configuration文件,启用了Push 2)在我的testingXcode项目中,我已经select了供应configuration文件作为签名身份(在“生成设置”>“代码签名”中) 3)我有我的捆绑标识符摘要和信息>自定义iOS目标属性设置正确*(我认为??) 4)我有我的委托didFinishLaunchingWithOptions被调用registerForRemoteNotificationTypes 5)我已经在我的委托中设置了logging设备令牌或错误的didRegisterForRemoteNotificationsWithDeviceToken和didFailToRegisterForRemoteNotificationsWithError 6)我在“摘要”下选中了“启用权利”。 7)右边下面select的权利文件是Tinker6(我的testing项目的名称),这是我自动生成时,我检查启用权利 8)在Tinker6.entitlements文件中,我收到了以下内容(我收集的内容是基于Web上的几个不同的post,但是我无法从Apple本身find任何明确的信息): 更新 9)此外,我已经尝试了没有权利文件的整个事情,并获得基本相同的结果。 10)我的mobileprovision文件的内容包括正确的权利(我炒编号和域,但结构相同): <key>application-identifier</key> <string>12355456A7.com.whatever.tinker</string> <key>aps-environment</key> <string>development</string> <key>get-task-allow</key> <true/> <key>keychain-access-groups</key> <array> <string>12355456A7.*</string> </array> /结束更新 当我尝试在我的设备上运行此操作时,Xcode输出中出现以下错误: 2012-06-11 12:45:23.762 Tinker6[13332:707] Failed to get token, error: Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x24a3b0 {NSLocalizedDescription=no valid 'aps-environment' […]

处理android通知中的button

我在通知中添加了一个button 但是我不知道如何在被点击的时候调用一个函数。 我尝试了一种像https://code.google.com/p/languagepickerwidget/source/browse/trunk/trunk/src/org/gnvo/langpicker/LangPicker.java这样的方法,因为它也使用了RemoteViews对象,但是当我点击button。 这是我现在有: private void createNotification(){ String ns = Context.NOTIFICATION_SERVICE; NotificationManager notificationManager = (NotificationManager) getSystemService(ns); Notification notification = new Notification(R.drawable.ic_launcher, null, System.currentTimeMillis()); RemoteViews notificationView = new RemoteViews(getPackageName(), R.layout.notification_switch); //the intent that is started when the notification is clicked (works) Intent notificationIntent = new Intent(this, SettingsActivity.class); PendingIntent pendingNotificationIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); notification.contentView = […]

android等待意图通知问题

我在我的应用程序中发生了一个警报事件,它会启动一个通知,然后按下时启动一个活动。 问题是,当我创build多个警报时,从通知中启动的活动获得与第一个相同的额外资源。 我认为这个问题或者是出于意图,或者是等待意图本身。 我想我可能需要在其中的一个标志,但我不知道哪一个。 Intent showIntent =new Intent(context, notificationreceiver.class); showIntent.putExtra("details", alarmname); PendingIntent contentIntent = PendingIntent.getActivity(context, 0, showIntent, 0); notification.setLatestEventInfo(context, "The event is imminent", alarmname, contentIntent); 和通知的接收者 Bundle b = getIntent().getExtras(); String eventname = b.getString("details"); details.setText(eventname); 下一次发生通知而不是具有不同的值时,“细节”额外的相同。 在我设定意图之前,我确信正确的价值是“细节”,所以每次我按任何通知时,都会得到第一个意图的问题。 我怎样才能使其发起正确的意图? 希望我尽可能清楚,谢谢!

图标不显示在通知中:白色方块显示

我的应用程序生成通知,但是我为该通知设置的图标未显示。 相反,我得到一个白色的广场。 我已经尝试调整图标的PNG(尺寸720×720,66×66,44×44,22×22)。 奇怪的是,当使用更小的尺寸时,白色方块更小。 我已经GOOGLE了这个问题,以及正确的方式来生成通知,并从我读了我的代码应该是正确的。 可悲的是,事情并不像他们应该做的那样。 我的手机是Android 5.1.1的Nexus 5。 问题也出现在模拟器,Android 5.0.1的三星Galaxy S4和Android 5.0.1的摩托罗拉Moto G(这两个我借了,现在没有) 通知代码如下,两个截图。 如果您需要更多信息,请随时索取。 谢谢你们。 @SuppressLint("NewApi") private void sendNotification(String msg, String title, String link, Bundle bundle) { NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); Intent resultIntent = new Intent(getApplicationContext(), MainActivity.class); resultIntent.putExtras(bundle); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, resultIntent, Intent.FLAG_ACTIVITY_NEW_TASK); Notification notification; Uri sound = Uri.parse("android.resource://" + […]

应用程序closures时推送通知

你知道是否有可能从应用程序完全closures时收到来自谷歌云消息的通知? 我知道,如果它是开放的或在后台是的,但它可以编程任何方式来接收它们? 编辑: 应用程序closures时,我会继续收到通知。 我附上的代码,以防万一我有一个错误,我不看它。 performance <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.frab" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <uses-permission android:name="com.frab.permission.C2D_MESSAGE" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.VIBRATE" /> <permission android:name="com.frab.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <meta-data android:name="com.google.android.gms.version" […]

通知或检测截图正在?

是否有通知或其他机制被告知用户正在使用家庭/电源button进行屏幕截图? 我已经看到想要禁用屏幕截图的线程,但这不是我想要做的。 我有一位摄影师客户,他担心他的作品会被截图用户复制,而我认为如果在截图之前有机会在图像上添加水印,这将减轻他的恐惧。

注意:试图获取非对象错误的属性

我正在尝试从以下位置获取数据: http://api.convoytrucking.net/api.php?api_key=public&show=player&player_name=Mick_Gibson 但如果我想获得这个代码的player_namevariables: <? $js = file_get_contents('http://api.convoytrucking.net/api.php?api_key=public&show=player&player_name=Mick_Gibson'); $pjs = json_decode($js); var_dump($pjs->{'player_name'}); ?> 我得到错误: 注意:尝试在第9行的** \ htdocs \ index.php中获取非对象的属性+ var_dump()返回:NULL var_dump($pjs)返回: array(1) { [0]=> object(stdClass)#52 (15) { ["player_name"]=> string(11) "Mick_Gibson" ["player_id"]=> int(88) ["rank"]=> string(12) "FIRE TURTLEE" ["lastseen"]=> int(1393797692) ["registration_date"]=> string(19) "2012-08-10 17:01:34" ["last_mission_date"]=> string(19) "2014-03-02 21:41:50" ["time_offset"]=> int(1) ["house_id"]=> int(611) ["fines"]=> int(0) ["wanted"]=> int(0) ["police_badge"]=> bool(true) […]

如何使通知意图恢复,而不是作出新的意图?

我在这里是一个简单的webview活动,加载时它会自动显示正在进行的通知。 这个想法是,人们可以离开这个活动,并通过拉下下拉菜单并select它,从任何他们想要的屏幕快速访问它。 然后,当他们想要的时候,他们可以通过点击菜单buttonclosures通知并点击退出,然后清除通知。 这一切工作正常。 但是,当通知被按下时,它启动一个新的活动实例。 我需要改变什么才能看到活动是否已经被销毁,我可以调用这个实例(恢复它),因此不需要再次加载它,也不需要添加另一个活动到我的堆栈。 有任何想法吗? 任何帮助将不胜感激。 package com.my.app; import com.flurry.android.FlurryAgent; import android.app.Activity; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.webkit.CookieSyncManager; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Toast; public class Chat extends Activity { private ProgressDialog progressBar; […]