android-notifications

how to know if the app was launched by clicking on the push notification

拜拜、爱过 提交于 2021-01-27 16:11:56
问题 I want to know if there is a flag and parameter that can tell me if the user launched the activity/app by clicking on the push notification in the notification tray. My code in C2DMReceiver.java Context context = getApplicationContext(); PackageManager manager = context.getPackageManager(); Intent notificationIntent = manager .getLaunchIntentForPackage(packageName); notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER); **notificationIntent.putExtra("fromRemote", true);** PendingIntent

how to know if the app was launched by clicking on the push notification

南楼画角 提交于 2021-01-27 16:11:44
问题 I want to know if there is a flag and parameter that can tell me if the user launched the activity/app by clicking on the push notification in the notification tray. My code in C2DMReceiver.java Context context = getApplicationContext(); PackageManager manager = context.getPackageManager(); Intent notificationIntent = manager .getLaunchIntentForPackage(packageName); notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER); **notificationIntent.putExtra("fromRemote", true);** PendingIntent

how to know if the app was launched by clicking on the push notification

﹥>﹥吖頭↗ 提交于 2021-01-27 16:07:17
问题 I want to know if there is a flag and parameter that can tell me if the user launched the activity/app by clicking on the push notification in the notification tray. My code in C2DMReceiver.java Context context = getApplicationContext(); PackageManager manager = context.getPackageManager(); Intent notificationIntent = manager .getLaunchIntentForPackage(packageName); notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER); **notificationIntent.putExtra("fromRemote", true);** PendingIntent

Stop application getting notification from fcm/gcm

北城以北 提交于 2021-01-27 12:55:55
问题 I know some android app like chat applications use FCM or GCM from google services to send new messages notification to their users. Now I want to know there is any way from android devices setting to stop getting notifications from FCM OR GCM . Thanks. 回答1: You can not stop FCM/GCM service only on your device. but you can stop overall notifications of an app from AppInfo as shown below: Go to AppInfo > App Notifications and turn off the toggle to disable the notifications. Below is

android.app.RemoteServiceException: Bad notification for startForeground

末鹿安然 提交于 2021-01-27 07:06:43
问题 I'm trying to start foreground service as follow: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { NotificationChannel chan = new NotificationChannel( getApplicationContext().getPackageName(), "My Foreground Service", NotificationManager.IMPORTANCE_LOW); chan.setLightColor(Color.BLUE); chan.setLockscreenVisibility(Notification.VISIBILITY_SECRET); NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); assert manager != null; manager

In flutter how to clear notification in bar?

流过昼夜 提交于 2021-01-05 08:46:25
问题 I am learning Google cloud messaging and firebase messaging is working fine, but when a user do not click at the notification to open the app and instead goes directly to app by manually opening it and bringing to foreground, the notification stays. I want those notification message related to my app go away when the app comes to foreground. How can I achieve this ? 回答1: It thinks there is no way to do this in documentation. But you can try this. You can just go to your MainActivity.java in

Auto Reply to WhatsApp message in background

↘锁芯ラ 提交于 2020-12-30 07:50:57
问题 I just checking out the Application, is doing auto reply to WhatsApp message in background. I also trying to doing so, but can't get success in it. I had tried : Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send."); sendIntent.setType("text/plain"); sendIntent.setPackage("com.whatsapp"); startActivity(sendIntent); But it opening the WhatsApp application :(, not sending the message. I go through with

Run Sqlite Code when received notification Xamarin Forms

不想你离开。 提交于 2020-12-14 23:32:47
问题 I am trying to run SQLite code while app received notification from firebase in Xamarin Forms App, First I Install this plugin Plugin.FirebasePushNotification and also add this permission: <uses-permission android:name="android.permission.INTERNET" /> then add this class to mu android project [Application] public class MainApplication : Application { public MainApplication(IntPtr handle, JniHandleOwnership transer) : base(handle, transer) { } public override void OnCreate() { base.OnCreate();

How do you specify a default notification channel ID in the application manifest?

烂漫一生 提交于 2020-12-12 18:01:09
问题 Android Oreo introduces notification channels, but the documentation for how to specify a default notification channel in the application manifest seems to be patchy to nonexistent. How do you specify a default notification channel ID in the application manifest? 回答1: Defining a default channel ID from the manifest cannot be done with standard notification channels, it only applies to Firebase notifications: Firebase: How to set default notification channel in Android app? 来源: https:/

How to show a notification everyday at a certain time even when the app is closed?

*爱你&永不变心* 提交于 2020-11-30 06:45:51
问题 Although this question might have been asked before on Stack Overflow, I still haven't found a clear answer. I want to show a notification everyday at 12pm for example even when the app is closed. I have referenced from those links: Notifications in specific time every day android, Android daily repeating notification at specific time of a day using AlarmManager, Android BroadcastReceiver on startup - keep running when Activity is in Background and much more... I'm confused on the difference