I don't know this API, but I guess you just could use the easy route and put a boolean flag. Manage it on your onSaveInstanceState() and onRestoreInstanceState() to keep its state on orientation change.
Marina On Sat, Jan 21, 2017 at 11:50 AM, Aman Pathak <amanpathak...@gmail.com> wrote: > Hi > > I wanted to get the location once as soon as the app gets started.So i > implemented GoogleApiClient in Main Activity.And i added toast to display > the Location in onConnected() of GoogleApiClient.onConnectionCallbacks.And > hurrah i got the Toast filled with info as soon the app gets started.But I > observed an issue that when i change the activity (For e.g Main Activity to > Setting Actvity or any Activity) and return back to main activity the toast > gets displayed again. And gets displayed again and again as i change the > activity and return back. > And same happens if i change the orientation of device. Is there any way > to do this? I only want that the location should be fetched only once and > displayed only once as the app gets started not with changing the activity > or orientation. > > -- > 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. > To post to this group, send email to android-developers@googlegroups.com. > Visit this group at https://groups.google.com/group/android-developers. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/android-developers/1a272635-cc6f-4f45-be0b- > 4428f54646f9%40googlegroups.com > <https://groups.google.com/d/msgid/android-developers/1a272635-cc6f-4f45-be0b-4428f54646f9%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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. To post to this group, send email to android-developers@googlegroups.com. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/CACaNmX37XgpSbkd9z%2BYfmcy%3Du6xv4HvjYL5mDN%2BipLe48vEUrw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.