Android :: Can I Avoid Sending Notification When Activity Is Currently On Top
Sep 13, 2010
I have a server socket bound to a port and I want to send notifications using NotificationManager when a client connects. This all works well.
What I want to avoid is sending notifications if a specific activity is currently being used by the user. E.g., I'm trying to avoid something like GMail notification if I'm already reading email.
View 2 Replies
Oct 13, 2010
I have total 3 activities.
First activity(A) starts second activity(B). From Activity B, 3rd activity(C) is called.
Activity B, shows list with checkbox to select items and single OK button. On clicking OK button Activity C is called with selection.
When user clicks BACK button in Activity C, by default Activity B is displayed (with selected checkbox).
I want to display Activity A when BACK button is clicked in Activity C.
How to achieve that?
I have handled OnKeyDown() in Activity C to startactivity(A). it is working. But when user clicks BACK button on Activity A, again Activity C is displayed. while application should end.
In this direction how to skip Activity B is ever called?
View 1 Replies
View Related
Jun 17, 2010
Since I seem to have caught two activity references in a heapdump, where the Activity is set to singleTask. Romain's advice on avoiding memory leaks includes: "Avoid non-static inner classes in an activity if you don't control their life cycle, use a static inner class and make a weak reference to the activity inside"
What does this mean exactly? I can't find any examples, positive, or negative for this rule. I do have some non static inner classes in my activity. Most of them are anonymous inner classes like this one. I see hundreds of them in the samples:....................
View 24 Replies
View Related
Jul 31, 2010
In my application I notify the user with notifications, if something special happens:
public void triggerNotification(String msg) {
notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Intent contentIntent = new Intent(this, ABC.class);
Notification notification = new Notification(R.drawable.icon, msg, System.currentTimeMillis());
notification.setLatestEventInfo(this, "ABC", msg, PendingIntent.getActivity(this.getBaseContext(), 0, contentIntent, PendingIntent.FLAG_CANCEL_CURRENT));
notification.flags = Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(notificationCounter, notification);
notificationCounter++;
}
If the user clicks on the Notification, the onCreate() method is called. But I want that a specific method in my app is called, or if the app is not in the foreground, that it is brought back to the foreground. I know there are lots of tutorials that explain how to handle notifications, but I just don't understand them completely and wasn't ever able to implement the things like I'd like to.
View 1 Replies
View Related
Mar 18, 2010
From notification manager, how do I resume a task instead of creating a new instance of it?
I want to create a link in the status bar on the phone through notification manager. When I click on it, I want want a particular task to come to the foreground.
However, it seems my code always launch a new task even if there is an existing one running. For example, I click on the link the first time, a task shows up. When I click the second time, I see an animated task showing up again ... repeat that 5 times. And then when I hit "back" button, the 5 instances will disappear one by one (proving it's not just a single instance). code...
View 2 Replies
View Related
Jul 28, 2009
I have fixed the activity screen orientation to portrait on AndroidManifest.xml file. When I open or close the keyboard the activity gets restarted. How to avoid this restart?
View 4 Replies
View Related
Aug 11, 2009
when i open my keyboard, it restarts the activity. i use only landscape mode and dont want the activity to restart.
View 2 Replies
View Related
Jul 30, 2009
I have a service running, and would like to send a notification. Too bad, the notification object requires a context, like an Activity, and not a service.
Do you know any way to by pass that ? I tried to create an Activity for each notification bu it seems ugly, and I can't find a way to launch an Activity without any view.
View 1 Replies
View Related
Sep 23, 2009
I am having issue for sending data from service to Activity through notification , I click a notification a activity get invoked but when i try to add some parameters through bundle i am not able to get the parameters in that called intent , I have gone through the link
http://stackoverflow.com/questions/1198558/how-to-send-parameters-from-a-notification-click-to-an-activity. but still no luck has any body occurred with the same issue.
View 1 Replies
View Related
Nov 24, 2010
I have an Android Service which copies files to an ftp server.
While it is doing that, I want to send feedback to my Activity so the user knows what happens.
I tried implementing it using the RemoteMessengerServiceSample code, but I have a problem ... All messages I send during the ftp transfer arrive at my Activity the moment the copy operation is finished ... not message by message while the copy job runs as I would like.
Is there any way to fix this? Maybe i'm using the wrong method for sending messages to my activity?
View 1 Replies
View Related
Sep 24, 2010
I was wondering if there was a way for a website to send an alert/notification to a cell phone (smart phone, android, iphone... stuff like that) where the notification will ask the user a question and they have to answer the question and the response is sent back to the website and their answer is logged in the database.
I would also like to know if this notification could have checkboxes? I am needing this for a project and would like to know if there is anything out there like this.
View 2 Replies
View Related
Feb 16, 2010
I am little confused with the use of intents used for sending data to activity from service. In my application I have to have startactivity from the service and have to pass data ,so that activity can utilize the data while launching.For this i have written the following code Intent intent = new Intent(Service.this,Activity.class); intent.putExtra("data", data); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.start Activity(); I assume that the data is passed to the activity and can be parsed on the oncreate function of the activity.Now the service running in the background has to pass data to the activity continously for UI updates.For this I have written the following codeIntent intent = new Intent(Service.this, Activity.class); intent.putExtra("Data", data); intent.setAction(Intent.ACTION_ATTACH_DATA); sendBroadcast(intent,null); (Do I need to broadcast the intent???) In activity I have done following things:- Implemented broadcast reciever:private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (Intent.ACTION_ATTACH_DATA.equals(intent.getAction())) { Bundle extra = intent.getExtras(); float Data[] = extra.getFloatArray("Data"); update(Data);
View 4 Replies
View Related
Mar 11, 2009
Is there a built in activity for sending picture text messages? If so, what does the intent look like that fires it off?
View 2 Replies
View Related
May 28, 2009
I have two activity Main activity and child activity when I press a button the child activity is lunched. Still now I have no problem. I want to send some data back to the main screen. I used The Bundle class but it is not working. It throw some run time exception.
View 2 Replies
View Related
Feb 19, 2009
I have a newbie question which is puzzling me regarding using Intents to start a new Activity but passing some data with the Intent for the new Activity to use. My app has (say) MainActivity from which I want to launch a second activity, SecondActivity, within the same app, whilst I pass an integer parameter to SecondActivity. Now my problem is : how do I receive the Intent when SecondActivity gets started and recover the value of the integer parameter ? Which member function of.
View 3 Replies
View Related
Aug 13, 2010
I am a bit new to Android. What I need to do is send data back and forth between an activity and a service locally. The information sent is sensitive and must not be able to be picked up by other apps. This excludes using broadcast and the onBind() function if I understand things correctly? So the activity needs to send some string parameters to the service. Also it somehow needs to tell the service which activity started it so the service can reply to the correct class since many different activities will use this service.
Once the service has fetched the information via a http request it is suppose to send that data (just a long string which will later be parsed) back to the activity that started it. How do I go about doing this? Using static variables/functions is not an option since again many actives will be using this service. Sure it would be possible to use a static array to hold the classes but that just seems ugly. It's only possible to send simple variables (not objects) via the intent? There must be a better way to do this.
View 1 Replies
View Related
May 22, 2012
Within the past week, I have gotten a "Sending..." notification at the bottom of my screen when I turn my phone on. Also, my phone gets a bit warm and the battery doesn't last a half a day. I use Handcent and have cleared the cache and the "unsent messages". I don't know what other program is sending things.
Nexus S AT&T
Android 4.0.4
View 1 Replies
View Related
Oct 9, 2010
I'm just wandering if there is a way to stop the notification tone from playing after I send a message?
Running android 2.1.
View 2 Replies
View Related
May 21, 2012
I have gotten a "Sending..." notification at the bottom of my screen when I turn my phone on. Also, my phone gets a bit warm and the battery doesn't last a half a day. I use Handcent and have cleared the cache and the "unsent messages". I don't know what other program is sending things. It sucks.
View 2 Replies
View Related
Mar 5, 2010
I have a notification in the status bar for my app.The problem with this is that when you press the home button from the app (pushing it to the background) then press on the notification in the list accessed from the status bar, it starts a fresh copy of the activity. All I want to do is resume the app (like when you longpress the home button and press on the app's icon). Is there a way of creating an Intent to do this?
View 1 Replies
View Related
Aug 4, 2009
How can i start my own activity when a new notification arrives to our status bar if click that notification my activity should play...
View 4 Replies
View Related
Apr 9, 2009
When MountService received event from HAL and start a notification, it would display an AlertActivity after user's click. However, I found the AlertActivity is created and can't be displayed.
I got some log as below:
CODE:........
Is it related to "FLAG_ACTIVITY_NEW_TASK"? however, how to solve it?
I've tried to use "launchmode as singleTask", but is doesn't work.
Is there anyone give me a hand? Why my activity can be created but can't be displayed?
View 3 Replies
View Related
Jul 16, 2009
Can use notification to goto other activity?? eg: from a to b use c.
my a.java code is:
CODE:........
But it dosen't work?
View 2 Replies
View Related
Jun 30, 2010
Is there a way of recieving a notification of some sort when a activity is launched. I'd like to monitor which applications are used and how often. Is is possible to register for some broadcast telling me when an application is launched, installed, unistalled etc? I believe I found a discussion or solution to this yesterday when I was looking for something else, but I'm not able to find it today.
View 3 Replies
View Related
Oct 26, 2010
In my app, I'm creating a notification with the FLAG_ONGOING_EVENT flag set.I'm cancelling the notification in onDestroy, but if my app crashes before calling onDestroy, is there any way to have my notification go away?
View 2 Replies
View Related
Sep 22, 2010
I am trying to start an activity from the notification bar but it needs to get an int. From activity to activity I would just put an int into the intent but I can't seem to figure out where to add the extra for the notification bar? Is this possible? If not is there a better way to do it?public void notifyMe()Code...
View 1 Replies
View Related
Aug 30, 2010
I am launching a mail activity by
//Sending mail final int SENT_MAIL = 1;
startActivityForResult(Intent.createChooser(i, "Send mail"),SENT_MAIL);
and in
onActivityResult(int req, int res,Intent data)
I am trying to find the result of email sending, so as to confirm if my mail was sent or was discarded by the user. I am receiving null for Intent data.
i.e. data =null
parameter in onActivityResult(int req, int res, Intent data), res is always 0.
ie. res = 0;
View 1 Replies
View Related
Oct 30, 2010
I'm trying to pass data from notification to activity.
View 1 Replies
View Related
Nov 3, 2010
I am creating like timer application and when I start timer I have option to go to android Home or start any other activity .When I start timer I set a notification bar icon and if i use some other application (mean go from started timer activity) and now I need to go to back to my previously started timer activity by clicking on notification icon?When I click I am starting a new instance timer activity , not the previously started timer activity and if I then click back button it show me a previously timer activity .Question is: How to call previously started activity trough notification bar , not to start new instance of that activity?
View 2 Replies
View Related
Jul 31, 2010
How can I resume my activity when a notification in the statusbar is clicked?
View 1 Replies
View Related