Re: [android-developers] Notifications and killed app

2013-04-24 Thread Piren
Were you talking about the notification of the service? because that can 
obviously cannot be removed while the service is running.. it's whole point 
is to show you have a foreground service.

On Wednesday, April 24, 2013 1:14:43 AM UTC+3, Larry Meadors wrote:

 OK, there was a foreground service involved. I added a call to 
 stopForeground(true) in my app when the service stops, and that seems 
 to make it behave better. 

 Larry 


-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Notifications and killed app

2013-04-24 Thread Piren
The swipe thing has a funny way of working when you have a foreground 
service... everything in the app gets closed (all activities are gone) 
except for that service... that means that if you re-launch the app you 
need to figure out the state the app was before.

in you case, display which files are being played and go back to showing 
the ui in playing mode. 

regarding the notification, see my other response.

On Tuesday, April 23, 2013 7:47:32 PM UTC+3, Larry Meadors wrote:

 BTW, there is a foreground service here, and that service lives on. 

 That's what I can't quite get my head around. The service is still 
 running and our activity starts and binds to it. 

 But when we call notificationManager.cancelAll(); from the service, 
 it doesn't cancel the previously created notification. :-/ 

 Larry 


-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Notifications and killed app

2013-04-24 Thread Larry Meadors
On Wed, Apr 24, 2013 at 12:58 AM, Piren gpi...@gmail.com wrote:
 Were you talking about the notification of the service? because that can
 obviously cannot be removed while the service is running.. it's whole point
 is to show you have a foreground service.

I was trying to remove the notification from the service after
stopping the service.

So I was calling service.stopSelf() then
notificationManager.cancelAll() in that order.

That doesn't work, I had to call service.stopForeground(true). That worked.

Larry

-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Notifications and killed app

2013-04-24 Thread Larry Meadors
On Wed, Apr 24, 2013 at 1:01 AM, Piren gpi...@gmail.com wrote:
 The swipe thing has a funny way of working when you have a foreground
 service... everything in the app gets closed (all activities are gone)
 except for that service... that means that if you re-launch the app you need
 to figure out the state the app was before.

 in you case, display which files are being played and go back to showing the
 ui in playing mode.

Yeah, I expected the swipe to really kill everything - so I was
surprised that the service survived so persistently (a good thing).

The UI worked as expected now - the only thing I can think of that
would make it better is if it could somehow set up the activity stack
when launched from the notification. Right now it goes directly to my
MusicPlayerActivity and back exits. If I could get it to go to
MusicPlayerActivity with the back stack looking like MainActivity 
TitleDetailActivity  MusicPlayerActivity, it would be perfect.

This'll do for 1.0, however...so close... :)

Thanks for your help, guys.

Larry

-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Notifications and killed app

2013-04-24 Thread Piren
Change the notification intent to point to the first activity and add a 
flag to indicate you want to open the other activities (propagate through 
the activities).


On Wednesday, April 24, 2013 1:16:12 PM UTC+3, Larry Meadors wrote:

 On Wed, Apr 24, 2013 at 1:01 AM, Piren gpi...@gmail.com javascript: 
 wrote: 
  The swipe thing has a funny way of working when you have a foreground 
  service... everything in the app gets closed (all activities are gone) 
  except for that service... that means that if you re-launch the app you 
 need 
  to figure out the state the app was before. 
  
  in you case, display which files are being played and go back to showing 
 the 
  ui in playing mode. 

 Yeah, I expected the swipe to really kill everything - so I was 
 surprised that the service survived so persistently (a good thing). 

 The UI worked as expected now - the only thing I can think of that 
 would make it better is if it could somehow set up the activity stack 
 when launched from the notification. Right now it goes directly to my 
 MusicPlayerActivity and back exits. If I could get it to go to 
 MusicPlayerActivity with the back stack looking like MainActivity  
 TitleDetailActivity  MusicPlayerActivity, it would be perfect. 

 This'll do for 1.0, however...so close... :) 

 Thanks for your help, guys. 

 Larry 


-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Notifications and killed app

2013-04-24 Thread Larry Meadors
So if the flow is main - title detail - player, do you mean the
MainActivity (by the first activity)?

Larry

-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Notifications and killed app

2013-04-24 Thread Piren
Yes.

It's actually weird to me that it wasn't already like that... If you wish
the notification to bring the app forward, the intent should match the
launcher intent. the additional bundle flag you add will also make sure to
start activities if they weren't already there.


On Wed, Apr 24, 2013 at 2:51 PM, Larry Meadors larry.mead...@gmail.comwrote:

 So if the flow is main - title detail - player, do you mean the
 MainActivity (by the first activity)?

 Larry


-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Notifications and killed app

2013-04-24 Thread Larry Meadors
On Wed, Apr 24, 2013 at 6:03 AM, Piren gpi...@gmail.com wrote:
 It's actually weird to me that it wasn't already like that... If you wish
 the notification to bring the app forward, the intent should match the
 launcher intent. the additional bundle flag you add will also make sure to
 start activities if they weren't already there.

Heh, I'm going to have to do some more research to understand what
you're telling me here - I'm not sure I'm following you completely.

Larry

-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Notifications and killed app

2013-04-24 Thread Piren
If you have the flow : main - title detail - player, you press Home, then
the Launcher icon for you app, it will just go back to your app with
player being the displayed activity.
it basically just took you back to where you were. This is because the
intent the Launcher used is the same intent used to start the app in the
first place.

If you add a notification and you want it to open the app like the launcher
does, you'll use the same intent as well. That means that if player is
shown, and you press the notification either the app will launch normally
(if it was removed by swipe) or will just bring the app forward like any
launcher intent does (if it was running previously and got backgrounded).

If the intent directs to player directly and player isn't singleInstance,
 it will create a new player and add it to the stack (so the flow would
be main - title detail - player - player)

Now days it is actually much more complex because of the addition of
TaskStackBuilder (which btw can be used instead of propagating the
inten)... you can read more about it here:
http://developer.android.com/guide/topics/ui/notifiers/notifications.html


On Wed, Apr 24, 2013 at 3:11 PM, Larry Meadors larry.mead...@gmail.comwrote:

 On Wed, Apr 24, 2013 at 6:03 AM, Piren gpi...@gmail.com wrote:
  It's actually weird to me that it wasn't already like that... If you wish
  the notification to bring the app forward, the intent should match the
  launcher intent. the additional bundle flag you add will also make sure
 to
  start activities if they weren't already there.

 Heh, I'm going to have to do some more research to understand what
 you're telling me here - I'm not sure I'm following you completely.

 Larry


-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Notifications and killed app

2013-04-23 Thread Kristopher Micinski
Swiping it away doesn't really mean killing the app, iirc.  The app
lives on within Android, it's just not displayed within your task
manager window.  (Meaning, it's not a process kill, at least for the
ones I've seen..)

Kris


On Tue, Apr 23, 2013 at 10:07 AM, Larry Meadors larry.mead...@gmail.com wrote:
 I have an app where I create a notification that when touched jumps to a
 specific activity.

 It works reasonably well, but if I go through the steps to create the
 notification, then kill the app using the recent apps button and swiping
 it out, the notification stays, and never goes away.

 Surely there is a way to clear the notification when the app is killed, but
 I can't seem to figure it out.

 Any suggestions?

 Larry


 --
 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Android Developers group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to android-developers+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.



-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Notifications and killed app

2013-04-23 Thread Piren
actually it does kill the process... as long as there's no foreground 
service (and that's debatable on the newer versions of JB). If you enter 
the app after your swipe, you'll see it is starting clean.

I had the same notification issue, but i can't remember how i resolved it.. 
heh

On Tuesday, April 23, 2013 5:28:26 PM UTC+3, Kristopher Micinski wrote:

 Swiping it away doesn't really mean killing the app, iirc.  The app 
 lives on within Android, it's just not displayed within your task 
 manager window.  (Meaning, it's not a process kill, at least for the 
 ones I've seen..) 

 Kris 


 On Tue, Apr 23, 2013 at 10:07 AM, Larry Meadors 
 larry@gmail.comjavascript: 
 wrote: 
  I have an app where I create a notification that when touched jumps to a 
  specific activity. 
  
  It works reasonably well, but if I go through the steps to create the 
  notification, then kill the app using the recent apps button and 
 swiping 
  it out, the notification stays, and never goes away. 
  
  Surely there is a way to clear the notification when the app is killed, 
 but 
  I can't seem to figure it out. 
  
  Any suggestions? 
  
  Larry 
  
  
  -- 
  -- 
  You received this message because you are subscribed to the Google 
  Groups Android Developers group. 
  To post to this group, send email to 
  android-d...@googlegroups.comjavascript: 
  To unsubscribe from this group, send email to 
  android-developers+unsubscr...@googlegroups.com javascript: 
  For more options, visit this group at 
  http://groups.google.com/group/android-developers?hl=en 
  --- 
  You received this message because you are subscribed to the Google 
 Groups 
  Android Developers group. 
  To unsubscribe from this group and stop receiving emails from it, send 
 an 
  email to android-developers+unsubscr...@googlegroups.com javascript:. 
  For more options, visit https://groups.google.com/groups/opt_out. 
  
  


-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Notifications and killed app

2013-04-23 Thread Larry Meadors
On Tue, Apr 23, 2013 at 9:10 AM, Piren gpi...@gmail.com wrote:
 I had the same notification issue, but i can't remember how i resolved it.. 
 heh

Now you're just teasing me. :-P

Larry

-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Notifications and killed app

2013-04-23 Thread Larry Meadors
BTW, there is a foreground service here, and that service lives on.

That's what I can't quite get my head around. The service is still
running and our activity starts and binds to it.

But when we call notificationManager.cancelAll(); from the service,
it doesn't cancel the previously created notification. :-/

Larry

-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Notifications and killed app

2013-04-23 Thread Larry Meadors
More interesting - if I touch the notification after killing(?) it's
owner, it still works in the sense that the activity starts and binds
back to the service that created the notification. The activity can
still control the service (it's a media player service).

However, when the activity stops the service that it binds to, the
service calls notificationManager.cancelAll(); but the notification is
still present.

/me goes to google more...

Larry

-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Notifications and killed app

2013-04-23 Thread Larry Meadors
OK, there was a foreground service involved. I added a call to
stopForeground(true) in my app when the service stops, and that seems
to make it behave better.

Larry

-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.