android-notifications

Intent with old extra in onCreate() for singleTask Activity

无人久伴 提交于 2019-12-19 17:37:59
问题 For example I created project with 2 activities: FirstActivity with android:launchMode="singleTask" flag and SecondActivity. At first user starts FirstActivity and after this SecondActivity will start on button click. From SecondActivity we create status bar notification. Intent intent = new Intent(SecondActivity.this, FirstActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra(FirstActivity.ARG, true); NotificationCompat.Builder builder = new NotificationCompat

Android notification app not working properly

醉酒当歌 提交于 2019-12-19 11:52:10
问题 I'm developing an android app, and part of it involves a notification that reminds the user to do something. This notification at a specified time and repeats every 12 hours. I'm using AlarmManager to schedule the alarm and I've also included the code to start my Alarm Service when the device boots. Here are my java classes: MainActivity.java public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super

Android background notifications with Firebase Cloud Messaging not received

隐身守侯 提交于 2019-12-19 10:31:13
问题 I've searched a lot about notifications when the app is in the background or closed. I'm using Firebase Cloud Messaging by the way. It won't work for me. I've used the Android setup and when the app is in the foreground or the phone is not locked the notification is received. When installed the token is printed correctly and subscribed to the topic. When I send a notification when the app is active in the foreground (so screen is unlocked and app is shown) I receive the notification and title

Notification with sound although phone is muted

老子叫甜甜 提交于 2019-12-19 09:18:36
问题 I am creating a notification with Android's NotificationManager. Is it possible to 'override' the phone's volume (mute) settings in such a way, that the notification's sound is ALWAYS played? The reason I need this is the following: The notification is so important, that vibration alone may not be enough. The user MUST be alerted. So a sound shall be played, even if the phone is muted or the volume is very low. 回答1: yes it is possible, MediaPlayer mMediaPlayer; Uri notification = null;

NotificationCompat.Builder(getApplicationContext(), CHANNEL_ID) not working on Oreo Firebase notification

痴心易碎 提交于 2019-12-19 07:25:08
问题 I am trying to show notification using Firebase in Oreo version so it's not showing when I get Solution NotificationCompat.Builder(this, CHANNEL_ID) but it's showing me like this and my build.gradle file is apply plugin: 'com.android.application' dependencies { compile project(':library') compile project(':camerafragment') compile 'com.google.android.gms:play-services:11.0.0' compile 'com.squareup.picasso:picasso:2.5.2' compile 'com.mcxiaoke.volley:library:1.0.17' compile 'com.android.support

Android N - Download Manager Notification Cancel Button

本小妞迷上赌 提交于 2019-12-18 17:34:32
问题 Android N has a new Cancel Button in the Download Manager Notification. I would like to excecute some code in my app to stop a progressbar when the user presses this button. If any, which method is called? Please also note that the Intent filter action DownloadManager.ACTION_NOTIFICATION_CLICKED is triggered only when the user clicks on the notification itself, not when he/she clicks of the Cancel button. if_downloadManager = new IntentFilter(); if_downloadManager.addAction(DownloadManager

Android N - Download Manager Notification Cancel Button

淺唱寂寞╮ 提交于 2019-12-18 17:34:00
问题 Android N has a new Cancel Button in the Download Manager Notification. I would like to excecute some code in my app to stop a progressbar when the user presses this button. If any, which method is called? Please also note that the Intent filter action DownloadManager.ACTION_NOTIFICATION_CLICKED is triggered only when the user clicks on the notification itself, not when he/she clicks of the Cancel button. if_downloadManager = new IntentFilter(); if_downloadManager.addAction(DownloadManager

How to know whether Notifications are enabled or not for an application in android?

房东的猫 提交于 2019-12-18 14:53:39
问题 I've a ListView which has the list of installed applications and for each application, I need to know whether the notifications are enabled or not. Currently I'm using below code to know if the notifications are enabled: appOpsClass = Class.forName(AppOpsManager.class.getName()); Method checkOpNoThrowMethod = appOpsClass.getMethod(CHECK_OP_NO_THROW, Integer.TYPE, Integer.TYPE, String.class); Field opPostNotificationValue = appOpsClass.getDeclaredField(OP_POST_NOTIFICATION); int value = (int

putExtra using pending intent not working

穿精又带淫゛_ 提交于 2019-12-18 12:48:00
问题 I have written a code in my GCMIntentservice that sends push notifications to many users. I use the NotificationManager that will call DescriptionActivity class when the notification is clicked. I also send the event_id form the GCMIntentService to the DescriptionActivity protected void onMessage(Context ctx, Intent intent) { message = intent.getStringExtra("message"); String tempmsg=message; if(message.contains("You")) { String temparray[]=tempmsg.split("="); event_id=temparray[1]; } nm=

Use a persistent notification to allow the user to return to running Android app

只谈情不闲聊 提交于 2019-12-18 12:29:48
问题 I am developing an app with numerous Activities. I would like to create a persistent notification that (more or less) says, "AppName - Return to AppName" that will be present whenever my background services are running. Creating and disposing of the notification was no problem. Now, the user could be on any of several screens/Activities, leave the application, then want to re-enter the app via the notification. The problem is , the notification must have an intent, which launches a