Re: [android-developers] Re: GPS Background Service Stops Receiving Updates
Hi, For - 1. Check if GPS is supported & if LocationManger is disabled, if so prompt the user to re-enable it, be kind & take them directly to the applicable Android->Setting screen to do this. (See 4 also). 2. Where possible I ignore LocationManager & use the raw GPS NMEA data, http://developer.android.com/reference/android/location/LocationManager.html#addNmeaListener(android.location.GpsStatus.NmeaListener) but be aware some older devices don't support this such as Motorola Defy+ 3. Date & Time from GPS is UTC unless you localise it, (but see 2.) 4. I guess this may happen, perhaps that is related to 1, or the device does not have onboard GPS receiver (eg HP Slate 7 tablet) - then offer to connect to an external Bluetooth GPS receiver & use that instead. 5. That is never an issue if you 'key' the lat lon data with GPS date/time stamps, if duplicate lat lon is an issue in some upload then your server app logic is probably incorrect. Regards On Tuesday, November 25, 2014 9:30:52 PM UTC+11, Mukesh Srivastav wrote: > > Party is not over you might find the issue like > > 1. Though the GPS and Network is disable, The Location manger returns > Network provider and returns the invalid/long distance lat and long data. > > 2.Sometimes, though you put your tablet/application in one place, the > Network/GPS Provider will return the lat longs of the different location. > > 3.Though you mention the distance and time, the Network provider return > the data of Asia pacific. > > 4.At a times, you might also get the locationmanager object as null, > though it work the full day but it fails at one point. > > 5.and also, what is the logic you have put to avoid the duplicate lat and > long to be uploaded. > > I had the situation earlier and i have shared you my experience. > > > > On Tue, Nov 25, 2014 at 1:58 PM, gjs > > wrote: > >> Hi, >> >> re - I am holding the home button and the list of apps comes up and I >> swipe away my app to kill it. This is what others have mentioned above. I >> don't know if this is samsung only or not. Maybe this method is supposed to >> kill all running services and processes of the app and is not a good way to >> test. >> >> Ok I think you are referring to the rectangular 'Recent Apps' button, not >> the Home button, but I get what you mean about swiping to close a recent >> Activity from that list. >> >> And yes, what Treking said about StartForeground. >> >> Regards >> >> >> On Tuesday, November 25, 2014 7:29:07 AM UTC+11, Tony Pitman wrote: >>> >>> It looks like calling startForeground was the key. I am still not able >>> to kill the app using the method mentioned above, but at least now when I >>> let the app sit for a long period of time the GPS notifications keep coming >>> into the service even when it looks like the app has been shut down by the >>> OS for lack of use. >>> >>> I do have another related question. When I did my service I was >>> following the example of a service on the google dev site. This is the link >>> to what I followed: >>> >>> http://developer.android.com/guide/components/services.html >>> >>> You will notice about the middle of the page there is the example code >>> that I followed and then modified. They use a HandlerThread to create the >>> Looper that gets used in the mServiceHandler thread to process the actual >>> work. >>> >>> They pass in a parameter to that HandlerThread called >>> Process.THREAD_PRIORITY_BACKGROUND. >>> >>> Is this different than using the startForeground that now fixed my >>> issue? I left that HandlerThread the way it was and it now works with the >>> startForeground. >>> >>> Thanks! >>> >>> On Monday, November 24, 2014 8:17:18 AM UTC-7, Tony Pitman wrote: Thank you everyone for the replies. Here are my responses: I am holding the home button and the list of apps comes up and I swipe away my app to kill it. This is what others have mentioned above. I don't know if this is samsung only or not. Maybe this method is supposed to kill all running services and processes of the app and is not a good way to test. I tried giving the service a different process. I tried 2 things. First I just added the android:process tag to my service. I gave it a name with the ':' in front so it would be private to my app. This did not change anything. The service still dies when I kill the app. The other thing I noticed is when I go to the Settings -> Application Manager -> Running I see my app. If I tap on it to see what it is doing I get the following sections / information: Active App: MyApp 1 process and 1 service Services: MyService Start by application Processes: MyApp com.mycompany.myappspace:MyService Main process in use. So I decided to try adding the android:process section to the main application entry in the xml as we
Re: [android-developers] Simple PagerAdapter does not display views
Yes, and that's what's so frustrating, Kastya. The breakpoints appear to indicate that everything is working, as does the fact that it responds to a swipe. For example, if I start it off by calling ViewPager with setCurrentItem(3), my instantiateItem is called with position=3, followed by position==2 and 4 (the views to either side). When swiping to go to the right, destroyItem is called with position=2 and instantiateItem position=5 as expected. isViewFromObject is called numerous times and I correctly return true or false. Since the data in the adapter never changes, getItemPosition always returns POSITION_UNCHANGED per the specs. I feel like there is something I'm missing that is failing to make my views "visible", or else there is some undocumented "feature" since they do not provide much info for using the base PagerAdapter (all the samples are using FragmentPagerAdapter or FragmentStatePagerAdapter. I am now considering changing over to use fragments instead of simple views since I know that works even though to me it seems less efficient in this case. Thanks for your response in any case! -- Doug On Monday, November 24, 2014 5:09:31 PM UTC-5, Kostya Vasilyev wrote: > > Did you properly implement the adapter's isViewFromObject? > > How about getItemPosition? > > -- K > > > -- 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/d/optout.
[android-developers] Is it possible, that Android kills a service inside an app?
Hey guys, let's imagine we have an app with a service and an activity inside. Both components live in a same process, our service is started (in terms of Android) and a user does some interaction with an activity. Eventually our app goes to background. My question is, whether is it possible, under certain conditions (low memory, timeout, etc), that Android "kills" our started service separately, without killing entire process? Thank you, Alex -- 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/d/optout.
Re: [android-developers] Re: GPS Background Service Stops Receiving Updates
Party is not over you might find the issue like 1. Though the GPS and Network is disable, The Location manger returns Network provider and returns the invalid/long distance lat and long data. 2.Sometimes, though you put your tablet/application in one place, the Network/GPS Provider will return the lat longs of the different location. 3.Though you mention the distance and time, the Network provider return the data of Asia pacific. 4.At a times, you might also get the locationmanager object as null, though it work the full day but it fails at one point. 5.and also, what is the logic you have put to avoid the duplicate lat and long to be uploaded. I had the situation earlier and i have shared you my experience. On Tue, Nov 25, 2014 at 1:58 PM, gjs wrote: > Hi, > > re - I am holding the home button and the list of apps comes up and I > swipe away my app to kill it. This is what others have mentioned above. I > don't know if this is samsung only or not. Maybe this method is supposed to > kill all running services and processes of the app and is not a good way to > test. > > Ok I think you are referring to the rectangular 'Recent Apps' button, not > the Home button, but I get what you mean about swiping to close a recent > Activity from that list. > > And yes, what Treking said about StartForeground. > > Regards > > > On Tuesday, November 25, 2014 7:29:07 AM UTC+11, Tony Pitman wrote: >> >> It looks like calling startForeground was the key. I am still not able to >> kill the app using the method mentioned above, but at least now when I let >> the app sit for a long period of time the GPS notifications keep coming >> into the service even when it looks like the app has been shut down by the >> OS for lack of use. >> >> I do have another related question. When I did my service I was following >> the example of a service on the google dev site. This is the link to what I >> followed: >> >> http://developer.android.com/guide/components/services.html >> >> You will notice about the middle of the page there is the example code >> that I followed and then modified. They use a HandlerThread to create the >> Looper that gets used in the mServiceHandler thread to process the actual >> work. >> >> They pass in a parameter to that HandlerThread called >> Process.THREAD_PRIORITY_BACKGROUND. >> >> Is this different than using the startForeground that now fixed my issue? >> I left that HandlerThread the way it was and it now works with the >> startForeground. >> >> Thanks! >> >> On Monday, November 24, 2014 8:17:18 AM UTC-7, Tony Pitman wrote: >>> >>> Thank you everyone for the replies. Here are my responses: >>> >>> I am holding the home button and the list of apps comes up and I swipe >>> away my app to kill it. This is what others have mentioned above. I don't >>> know if this is samsung only or not. Maybe this method is supposed to kill >>> all running services and processes of the app and is not a good way to test. >>> >>> I tried giving the service a different process. I tried 2 things. First >>> I just added the android:process tag to my service. I gave it a name with >>> the ':' in front so it would be private to my app. >>> >>> This did not change anything. The service still dies when I kill the >>> app. The other thing I noticed is when I go to the Settings -> Application >>> Manager -> Running I see my app. If I tap on it to see what it is doing I >>> get the following sections / information: >>> >>> Active App: >>> MyApp >>> 1 process and 1 service >>> >>> Services: >>> MyService >>> Start by application >>> >>> Processes: >>> MyApp >>> com.mycompany.myappspace:MyService >>> >>> Main process in use. >>> >>> So I decided to try adding the android:process section to the main >>> application entry in the xml as well. I gave it a different name just in >>> case. I called it MyApp instead of MyService. This did not make any >>> difference. The information shown in the settings panel were the same. >>> >>> So am I to assume that the service is running in the same process as the >>> app so that when I kill the app using the method above that is why the >>> service is also dying? Is killing the app that way the wrong way to test? >>> >>> The whole reason I am doing this is because originally I just put my gps >>> stuff inside the app itself. I would start my app and then many hours later >>> I would enter the geofence area I had set up and the app did not trigger >>> what I wanted it to do. I would go to the app and it looked like it was >>> starting all over. >>> >>> Maybe I should just start my app and let it run for several hours and >>> see if the service keeps going. >>> >>> Thanks for all the help. >>> >>> On Monday, November 24, 2014 7:58:36 AM UTC-7, Mukesh Srivastav wrote: As my understanding here, the service was stopped some where in the code and hence it is behaving like that. On Mon, Nov 24, 2014 at 7:38 PM, Mark Phillips < ma...@phillipsmarketing.biz> wrote: >>
[android-developers] Same database cursor in ListFragment and ViewPager
Hi guys, I have a ListFragment where I load a Cursor through a Loader in onCreateLoader(int i, Bundle bundle). If I click on a ListItem then I replace the Fragment to another Fragment "DetailsPageSlider" and set as argument position and count. In my FragmentStateAdapter in getItem(int position) I create my Details Fragment which needs the database _id as argument. So now I have to match the "position" in getItem with the database _id! How I could solve that problem? 1) Should I load exactly the same cursor for my FragmentStatePagerAdapter to get the database _id through the position. 2) Or Is it possible to use the same Cursor in my ListFragment and also in my FragmentStatePagerAdapter? 3) Or any other ideas? greets Markus -- 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/d/optout.
Re: [android-developers] Re: GPS Background Service Stops Receiving Updates
Hi, re - I am holding the home button and the list of apps comes up and I swipe away my app to kill it. This is what others have mentioned above. I don't know if this is samsung only or not. Maybe this method is supposed to kill all running services and processes of the app and is not a good way to test. Ok I think you are referring to the rectangular 'Recent Apps' button, not the Home button, but I get what you mean about swiping to close a recent Activity from that list. And yes, what Treking said about StartForeground. Regards On Tuesday, November 25, 2014 7:29:07 AM UTC+11, Tony Pitman wrote: > > It looks like calling startForeground was the key. I am still not able to > kill the app using the method mentioned above, but at least now when I let > the app sit for a long period of time the GPS notifications keep coming > into the service even when it looks like the app has been shut down by the > OS for lack of use. > > I do have another related question. When I did my service I was following > the example of a service on the google dev site. This is the link to what I > followed: > > http://developer.android.com/guide/components/services.html > > You will notice about the middle of the page there is the example code > that I followed and then modified. They use a HandlerThread to create the > Looper that gets used in the mServiceHandler thread to process the actual > work. > > They pass in a parameter to that HandlerThread called > Process.THREAD_PRIORITY_BACKGROUND. > > Is this different than using the startForeground that now fixed my issue? > I left that HandlerThread the way it was and it now works with the > startForeground. > > Thanks! > > On Monday, November 24, 2014 8:17:18 AM UTC-7, Tony Pitman wrote: >> >> Thank you everyone for the replies. Here are my responses: >> >> I am holding the home button and the list of apps comes up and I swipe >> away my app to kill it. This is what others have mentioned above. I don't >> know if this is samsung only or not. Maybe this method is supposed to kill >> all running services and processes of the app and is not a good way to test. >> >> I tried giving the service a different process. I tried 2 things. First I >> just added the android:process tag to my service. I gave it a name with the >> ':' in front so it would be private to my app. >> >> This did not change anything. The service still dies when I kill the app. >> The other thing I noticed is when I go to the Settings -> Application >> Manager -> Running I see my app. If I tap on it to see what it is doing I >> get the following sections / information: >> >> Active App: >> MyApp >> 1 process and 1 service >> >> Services: >> MyService >> Start by application >> >> Processes: >> MyApp >> com.mycompany.myappspace:MyService >> >> Main process in use. >> >> So I decided to try adding the android:process section to the main >> application entry in the xml as well. I gave it a different name just in >> case. I called it MyApp instead of MyService. This did not make any >> difference. The information shown in the settings panel were the same. >> >> So am I to assume that the service is running in the same process as the >> app so that when I kill the app using the method above that is why the >> service is also dying? Is killing the app that way the wrong way to test? >> >> The whole reason I am doing this is because originally I just put my gps >> stuff inside the app itself. I would start my app and then many hours later >> I would enter the geofence area I had set up and the app did not trigger >> what I wanted it to do. I would go to the app and it looked like it was >> starting all over. >> >> Maybe I should just start my app and let it run for several hours and see >> if the service keeps going. >> >> Thanks for all the help. >> >> On Monday, November 24, 2014 7:58:36 AM UTC-7, Mukesh Srivastav wrote: >>> >>> As my understanding here, the service was stopped some where in the code >>> and hence it is behaving like that. >>> >>> On Mon, Nov 24, 2014 at 7:38 PM, Mark Phillips < >>> ma...@phillipsmarketing.biz> wrote: >>> On my Samsung Galaxy 4 phone from T-Mobile, I can hold down the home button and get a list of running apps. I can kill each one individually with a swipe, and there is a trashcan icon at the bottom of the screen that will kill all the apps running. I use this feature to extend my battery time when the batter is getting low. It may be a special Samsung app that does this. Mark On Mon, Nov 24, 2014 at 1:13 AM, gjs wrote: > Hi, > > What do you mean by - > > ..."I test this by holding down the home button and killing my app" ? > > If I start an app, then press & hold down the Home button, the app > that was running is sent to the background (not killed) & the only option > that appears is a circle that pops up to run Google Now - if I then swipe >