notification

Is it possible to check if a notification is visible or canceled?

匿名 (未验证) 提交于 2019-12-03 00:59:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I would like to update notification data, but the only way I found is to launch a new one with the same Id. The problem is that I don't want to raise a new one if the original has beed canceled. Is there a way to tell if a notification is visible or canceled? Or a way to update a notification only if it exists? 回答1: This is how I solved it: private boolean isNotificationVisible() { Intent notificationIntent = new Intent(context, MainActivity.class); PendingIntent test = PendingIntent.getActivity(context, MY_ID, notificationIntent,

notification when program is in background iOS 4

匿名 (未验证) 提交于 2019-12-03 00:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: We are looking for a way to timeout an iPhone application, and have tried several methods: NSTimer that resets after an action LocalNotification that resets after an action Both are close, but suffer from unique issues: NSTimer: When the phone sleeps, the timer will not fire LocalNotification: When the app is in the background, the notification is displayed, we don't have a way to have the application have to receive the notification. Asking the group if this sounds correct, or if there is maybe some point above that I am missing that would

Custom click on Ionic notification using Firebase

匿名 (未验证) 提交于 2019-12-03 00:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have been using ionic and FCM (Firebase Cloud Messaging) for notification. I get the notification on my app and now I have 2 issues. First, if its a normal notification like not with advanced options in Firebase Console > Notification , then it doesn't play any sound, but when it's data Notification, then it does play a sound. Second, I want to open a particular page of my app on notification click. So how do I do that? Note : I am using ionic not an ionic2. 回答1: First issue: We have sound in both situations. Have you tried to send an

Custom click on Ionic notification using Firebase

匿名 (未验证) 提交于 2019-12-03 00:56:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have been using ionic and FCM (Firebase Cloud Messaging) for notification. I get the notification on my app and now I have 2 issues. First, if its a normal notification like not with advanced options in Firebase Console > Notification , then it doesn't play any sound, but when it's data Notification, then it does play a sound. Second, I want to open a particular page of my app on notification click. So how do I do that? Note : I am using ionic not an ionic2. 回答1: First issue: We have sound in both situations. Have you tried to send an

Repeating local notification is triggered immediately ― how to defer?

匿名 (未验证) 提交于 2019-12-03 00:56:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: My goal is to set a notification that will occur N seconds in the future for the first time, and then repeat every N seconds. However, creating a repeating notification seems to trigger the UNUserNotificationCenterDelegate immediately. App delegate: func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { let center = UNUserNotificationCenter.current() center.delegate = self return true } func startRequest() { let content = UNMutableNotificationContent()

OneSignal Not calling didReceiveRemoteNotification

匿名 (未验证) 提交于 2019-12-03 00:56:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: We migrated from UA to One Signal. We are sending push from cloud code like var pushInfo = { "app_id" : "xxxxxx", "data": { "objectId": objectId, "placeId": placeId, }, "included_segments": ["All Users"], "contents": {"en": message} }; var headers = { "Content-Type": "application/json; charset=utf-8", "Authorization": "Basic XXXXX" }; var options = { host: "onesignal.com", port: 443, path: "/api/v1/notifications", method: "POST", headers: headers, }; var https = require('https'); var req = https.request(options, function(res) { res.on('data'

Android---消息通知Notifycation

匿名 (未验证) 提交于 2019-12-03 00:36:02
代码: public class MainActivity extends AppCompatActivity { private final int NOTIFY_ID = 0x123 ; //通知的ID @Override protected void onCreate(Bundle savedInstanceState) { super .onCreate(savedInstanceState); setContentView(R.layout. activity_main ); //获取通知管理器,用于发送通知 NotificationManager notificationManager = (NotificationManager) getSystemService( NOTIFICATION_SERVICE ); NotificationCompat.Builder notification = new NotificationCompat.Builder(MainActivity. this ); // 创建一个Notification对象 // 设置打开该通知,该通知自动消失 notification.setAutoCancel( true ); // 设置显示在状态栏的通知提示信息 notification.setTicker( "subtitle" ); //

Notification与前台service

匿名 (未验证) 提交于 2019-12-03 00:22:01
private void showNotification() { Intent intent = new Intent( this , MainActivity. class ); NotificationCompat.Builder mBuilder= new NotificationCompat.Builder( this ); mBuilder.setSmallIcon(R.drawable. air ) .setContentTitle( "content title" ) .setContentText( "content text" ) .setContentInfo( "content info" ) .setContentIntent(PendingIntent. getActivity ( this , 0 ,intent,PendingIntent. FLAG_UPDATE_CURRENT )); mBuilder.setDefaults(Notification. DEFAULT_ALL ); // Notification notification = mBuilder.build(); //4.1 .build(); notification. flags |= Notification. FLAG_AUTO_CANCEL ; // cancel

实现基于React的全局提示组件Toast

匿名 (未验证) 提交于 2019-12-03 00:11:01
ǰϷ API 风格参考 Ant Design 的 Message 全局提示 正文 需求分析 Toast 不需要同页面一起被渲染,而是根据需要被随时调用。 Toast 是一个轻量级的提示组件,它的提示不会打断用户操作,并且会在提示的一段时间后自动关闭。 Toast 需要提供几种不同的消息类型以适应不同的使用场景。 Toast 的方法必须足够简洁,以避免不必要的代码冗余。 最终效果: 点此预览 调用示例 Toast.info( '普通提示' ) Toast.success( '成功提示' , 3000 ) Toast.warning( '警告提示' , 1000 ) Toast.error( '错误提示' , 2000 , () => { Toast.info( '哈哈' ) }) const hideLoading = Toast.loading( '加载中...' , 0 , () => { Toast.success( '加载完成' ) }) setTimeout(hideLoading, 2000 ) 组件实现 Toast 组件可以被分为三个部分,分别为: notice.js:Notice。无状态组件,只负责根据父组件传递的参数渲染为对应提示信息的组件,也就是用户最终看到的提示框。 notification.js:Notification。Notice 组件的容器

MYSQL 中 LEFT JOIN ON 后的AND 和WHERE

匿名 (未验证) 提交于 2019-12-02 22:06:11
表1 app_notification_user,里面有两条数据: 表2 app_notification, 里面有一条数据 语句1: 左表有的数据全都有 语句2: LEFT JOIN ON 后面加AND,和LEFT JOIN ON WHERE对比 SELECT anu.id,anu.app_notification_id,anu.`status`,an.* FROM app_notification_user anu LEFT JOIN app_notification an ON anu.app_notification_id=an.id AND anu.status=1 VS SELECT anu.id,anu.app_notification_id,anu.`status`,an.* FROM app_notification_user anu LEFT JOIN app_notification an ON anu.app_notification_id=an.id WHERE anu.status=1 放在WHERE里,直接将符合条件的筛选出来,不符合条件的不查询,left join里加的and,左表的数据一直会在,on里,不符合条件的部分会直接为null。 具体筛选条件放在哪里,应该根据实际业务需求来写。 总的来说: LEFT JOIN 里的