android-notifications

How to stop android notification ringtone after 30 seconds?

妖精的绣舞 提交于 2019-12-04 09:37:40
问题 I'm writing an app that notifies a user of very time sensitive information, and I think a lot of them would want to use a phone ringtone instead of just the short notification sounds. I enabled this feature by setting android:ringtoneType="all" in my PreferenceScreen, and it works great EXCEPT that when a phone ringtone is chosen, it keeps playing FOREVER until the user touches the notification bar... how can I get it to turn off after 30 seconds or so, without canceling the notification?

show pop up like gmail in android [closed]

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 08:52:06
I want to show an alert in my android just like gmail notification in desktop how should I approach. Solution made it showing like this Dialogs cannot be triggered without an activity.. So ,you can create an activity with dialog theme. <activity android:theme="@android:style/Theme.Dialog" /> Now from your service ..just call this activity when your notification arrives... And it will pop up like a dialog... Edit: While calling your activity: startActivity(intent); overridePendingTransition(R.anim.enter_anim, R.anim.right_exit_anim); Now create the two anim files in a seperate folder called

Android notfication BigPictureStyle disappearing text

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 08:05:46
问题 I'm being implementing Android rich notifications using the compatibility library, so all my notifications are being built using android.support.v4.app.NotificationCompat.Builder the code I'm using is the following: // Base notification NotificationCompat.Builder b = new NotificationCompat.Builder(context); b.setSmallIcon(R.drawable.ic_actionbar); b.setContentTitle(title); b.setContentText(Html.fromHtml(msg)); b.setTicker(title); b.setWhen(System.currentTimeMillis()); b.setDeleteIntent

android notification large image not working

时光毁灭记忆、已成空白 提交于 2019-12-04 08:05:41
I am creating my notification like this: Intent intent = new Intent(this, OfferNotification.class); PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0); Uri soundUri = RingtoneManager .getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder( this).setSmallIcon(R.drawable.unknown) //.setLargeIcon(BitmapFactory.decodeResource( getResources(), R.drawable.unknown)) .addAction(R.drawable.ic_launcher, "d", pIntent) .setAutoCancel(true) .setContentTitle("Offer from " + restaurantName) .setContentText(offerDescriptoin)

how get message body when FCM notification message is tap?

半世苍凉 提交于 2019-12-04 07:19:09
When app is in background, the notification message is deliver by Notification, when the notification is tap, app is launch, how can i get the message body? the intent is this: Bundle[{google.sent_time=1470813025421, from=568540028909, google.message_id=0:1470813025865549%31bd1c9631bd1c96, collapse_key=com.google.firebase.quickstart.fcm}] no message body in intent, only message id! Thanks! try this @Override public void onMessageReceived(RemoteMessage remoteMessage) { // TODO(developer): Handle FCM messages here. // If the application is in the foreground handle both data and notification

NotificationCompat cannot be resolved to a type

杀马特。学长 韩版系。学妹 提交于 2019-12-04 07:18:22
I am newer to Android and receive the error message: "NotificationCompat cannot be resolved to a type" MinSDK=9, TargetSDK=18, As of yet, all sources are very vague on how to resolve this issue and simply note: "update the JAR files". What JARs do I need and where can I find them, so that this issue is resolved? You need the support library. Here are the instructions on how to download them: http://developer.android.com/tools/support-library/setup.html I needed to add "android-support-v4.jar" to my project to use the ActionBar . Sometimes Eclipse gets hung up on this class, and no amount of

Group Firebase FCM on Android Device

这一生的挚爱 提交于 2019-12-04 07:04:37
问题 I am trying to send cloud messages using the Firebase console. I am doing this for android device. The push notifications do appear on the device fine along with the data sent with it. But each notification shows up on its own. Meaning if I send 3 notifications three items show up in the notification bar. What I want to achieve is that all the notifications to be grouped under one heading. As you have in WhatsApp or Facebook. How can this be achieved using the Firebase Console? 回答1: By

Android notification turn on banner setting programmatically

微笑、不失礼 提交于 2019-12-04 06:17:11
Is there any ways for turning on the banners setting (display on top of the status bar) in application notification programmatically? <pre><code> // send notification to NotificationManager Notification.Builder notificationBuilder =new Notification.Builder(context); notificationBuilder.setSmallIcon(R.drawable.icon_32x32) .setLargeIcon(bitmap) .setContentTitle("title") .setContentText("content") .setContentIntent(contentIntent) .setAutoCancel(true) .setDefaults(Notification.DEFAULT_ALL) .setPriority(Notification.PRIORITY_HIGH) .setCategory(Notification.CATEGORY_MESSAGE); if (Build.VERSION.SDK

How to open the main app from the wearable?

空扰寡人 提交于 2019-12-04 05:30:11
I'm playing a little with wearables, I already created notifications from my micro app (which runs on the wearable ) with some little restrictions and I'm wondering how I can create a pending intent for an action to open the main app on the phone. My solution that I've just tested and it works is add a message listener on the Android application and simply send from the wearable the details of what I want it to do. public class WearMessagesAPI_Service extends WearableListenerService { private static final String OPEN_APP_PATH = "/OpenApp"; @Override public void onMessageReceived(MessageEvent

Notification: Sony devices do not show any notification

三世轮回 提交于 2019-12-04 05:23:00
问题 I use these lines of code for showing notification in my app but sony devices(xperia p, sola, acro s) does not show any notification. I dont have any problem with other android devices. Intent notificationIntent = new Intent(context, ActivityShowQuestion.class); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent contentIntent = PendingIntent.getActivity(context, Integer.parseInt(id), notificationIntent,