Re: [android-developers] App Backgrounded check, onTrimMemory Activity finish(), behaviour

2014-09-01 Thread Mukesh Srivastav
why not just check the current pid state of the app rather than doing all
those things..




On Fri, Aug 29, 2014 at 11:25 AM, Omkar omk...@gmail.com wrote:

 Hi All,
 I am working on a App where functionality is when ever User goes out of
 the app and comes back it should ask him login details, so when ever user
 kicks himself out of app, by pressing home button or multi-task button or
 start other app on my app, then my app should automatically logoff/logout
 user and when he comes back ask for credentials.

 To check backgrounded state of app I tried using
 ActivityManager.getRecentTasks(1); and check if topactivity package is
 other than my app package and if yes then I assumed app is backgrounded,
 This works good till Kitkat/OS L where google has deprecated
 ActivityManager.getRecentTasks method for privacy purpose.

 Second solution we implemented was to use ComponentCallbacks2 and check
 onTrimMemory(int level) for level = TRIM_MEMORY_UI_HIDDEN. This worked in
 almost all cases, but one. onTrimMemory Component call back is registered
 for Application class.

 When call to Activity finish() happens onTrimMemory call back will not be
 triggered. Say I have activity A and B, Activity A starts Activity B, Now I
 complete some work in Activity B and call finish() on B, From time when
 finish() on B is called till Activity A's onStart/onResume will be called,
 in this timeframe if user press home buttom/ multitask button and goes out
 of the app, onTrimMemory is not called and it is not possible to know if
 app was backgrounded, because of this we can not logoff session. So if user
 gets out of app in that timeframe and goes back he will get same session
 back.

 Second case we detect same behavior is, if we call finish() in activity
 B's onPause() and user press home/multitask button or start other app from
 notification area then because of this finish() call in onPause, we are not
 getting onTrimMemory call back.

 There should be some standard api/call back to check if app is
 backgrounded, if not, apis like onTrimMemory should be consistent with
 their call backs. Kindly help.

  --
 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.




-- 
Warm Regards,
*Mukesh Kumar*,
Android Consultant/Freelancer,
India,Hyderabad.

-- 
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] Emnulator window issue

2014-09-01 Thread dashman
I created a new emulator.

Defined it as a standard phone - nexus 4.

When the Window is displayed - it's in portrait orientation (i.e. the frame)

But the contents of the window (i.e. the emulated screen is landscape - 
rotated 90 deg. to the right.

i..e if I turn my head right 90 deg - then that would be a standard 
landscape display - i.e. the Window frame + content.


If I press Ctrl+F12 to switch orientation - the frame + contents is 
landscape - that's normal and expected.

Cntrl+F12 again - frame portrait (correct) but the contents are rotated 90 
(i.e. the title bar is vertical on the right side of the frame)


Any help?

-- 
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] Re: Native crash during rendering

2014-09-01 Thread Avetik Kazhoyan
Thanks Andrew. Well, the problem is I'm not using regions in any way, and 
it's difficult to understand how they are related to paths and drawing.

On Sunday, August 31, 2014 10:26:34 PM UTC+4, andrew_esh wrote:

 I took a look at android::Region::createTJunctionFreeRegion here:


 http://androidxref.com/4.4.4_r1/xref/frameworks/native/libs/ui/Region.cpp#185

 I would look at the region being passed in to there. I wonder if some of 
 the arrows you're rendering are not valid regions by the time they reach 
 this function.
  


-- 
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.