android-notifications

Open specific Activity when notification clicked in FCM

守給你的承諾、 提交于 2019-11-27 01:08:38
I am working on App in which I am required to show notification. For notification, i am using FireBase Cloud Messaging (FCM) . I am able to get Notification when app is in background. But when I click on notification, it redirect to home.java page. I want it to redirect to Notification.java page. So,please tell me how to specify Activity in on Click of notification. I am using two services: 1.) MyFirebaseMessagingService 2.) MyFirebaseInstanceIDService This is my code sample for onMessageReceived() method in MyFirebaseMessagingService class. public class MyFirebaseMessagingService extends

How To give notifications on android on specific time?

安稳与你 提交于 2019-11-27 00:22:54
问题 I want to give notification to my app on a specific time. Say everyday i have to give notification on 7 AM even if the app is closed. How can i do this? Any tutorial? Please mention the link. 回答1: first you need to use a broadcastreceiver. and because a broadcast receiver up only for a short time from the android developer blog.When handling a broadcast, the application is given a fixed set of time (currently 10 seconds) in which to do its work. If it doesn't complete in that time, the

Set Drawable or Bitmap as icon In Notification in Android

点点圈 提交于 2019-11-26 23:13:27
问题 I download a image from server as bitmap and convert it to drawable now i want to use this drawable as notification icon. But i am unable to do that. here is my code: Notification notification = new NotificationCompat.Builder(context) .setContentTitle(title) .setContentText(message) .setContentIntent(intent) .setSmallIcon(bitmap) .setWhen(when) .build(); but icon is a Resources int value so when i used it it gives error. Any help Edit: Now i update my code and now i am doing like that :

Custom notification sound , android Oreo?

非 Y 不嫁゛ 提交于 2019-11-26 23:10:32
问题 I want to set a custom notification sound from a raw mp3 or wav file in my app. Below is my code private void sendMyNotification(String message) { Intent intent; if (sharedPreferences.getBoolean(SPConstants.IS_LOGGED_IN, false)) { intent = new Intent(this, ActivityNotification.class); } else { intent = new Intent(this, ActivitySplash.class); } intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);

Heads-up Notification - Android Lollipop

陌路散爱 提交于 2019-11-26 22:22:25
I'm trying to show a notification-type heads-up but I could not. What I tried final Notification.Builder notif = new Builder(getApplicationContext()) .setContentTitle(getString(R.string.title)) .setContentText(getString(R.string.text)) // .setTicker(getString(R.string.tick)) removed, seems to not show at all // .setWhen(System.currentTimeMillis()) removed, match default // .setContentIntent(contentIntent) removed, I don't neet it .setColor(Color.parseColor(getString(R.color.yellow))) //ok .setSmallIcon(R.drawable.ic_small) //ok .setLargeIcon(BitmapFactory.decodeResource(getResources(), R

On Android 8.1 API 27 notification does not display

 ̄綄美尐妖づ 提交于 2019-11-26 22:14:58
I get Toast on Android 8.1 API 27: Developer warning for package "my_package_name" Failed to post notification on ... Logcat includes next strings: Notification: Use of stream types is deprecated for operations other than volume control W/Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case E/NotificationService: No Channel found for pkg=my_package_name The full information in the Toast and in Logcat can help in the localization this problem. If you get this error should be paid attention to 2 items and

NotificationCompat with API 26

試著忘記壹切 提交于 2019-11-26 21:58:09
I dont see any information about how to use NotificationCompat with Android O's Notification Channels I do see a new Constructor that takes a channelId but how to take a Compat notification and use it in a NotificationChannel since createNotificationChannel takes a NotificationChannel object Create the NotificationChannel only if API >= 26 public void initChannels(Context context) { if (Build.VERSION.SDK_INT < 26) { return; } NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); NotificationChannel channel = new

Android FCM notification grouping

落花浮王杯 提交于 2019-11-26 21:43:07
问题 I was trying to implement FCM notification for a chat app and I want to achieve "WhatsApp-like" notification where the notification will be grouped by conversation. Say when Alice replied to a conversation with Bob inside, Bob will receive a notification with the body "Alice: the content ". But if Alice quickly reply to the conversation again, Bob will get another new notification but I just want to append the new reply onto the prev notification instead. How can I achieve that? 回答1: By

android 4.3 Bluetooth ble don't called onCharacteristicRead()

谁说我不能喝 提交于 2019-11-26 21:40:55
问题 I've set the notification into android, It is not calling to method onCharacteristicRead() ???? It does not enter into the function. Why it is happening so?? Any help is appreciated Request the solutions. This is my code: private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() { @Override public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) { if (newState == BluetoothProfile.STATE_CONNECTED) { Log.i(TAG, "Connected to GATT server."); //

Any way to link to the Android notification settings for my app?

本秂侑毒 提交于 2019-11-26 21:35:35
Is there any way I can launch an intent to get to Android's notification settings screen for my app (pictured below)? Or an easy way I can make a PreferenceScreen item that just leads here on a click? shhp The following will work in Android 5.0 (Lollipop) and above: Intent intent = new Intent(); intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS"); //for Android 5-7 intent.putExtra("app_package", getPackageName()); intent.putExtra("app_uid", getApplicationInfo().uid); // for Android 8 and above intent.putExtra("android.provider.extra.APP_PACKAGE", getPackageName()); startActivity