Re: [android-developers] Do SQLiteDatabase references go stale?

2013-07-30 Thread TreKing
On Mon, Jul 29, 2013 at 7:00 PM, Nathan nathan.d.mel...@gmail.com wrote:

 If I manage to get logs from the users, I might know what exception it is.


I wouldn't rely on waiting on users to send you anything. Have your app
automatically send you reports using something like ACRA, then flood your
app with log that are also sent in your report until you track the issue
down.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
-- 
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] Do SQLiteDatabase references go stale?

2013-07-30 Thread Nathan


On Tuesday, July 30, 2013 9:33:44 AM UTC-7, TreKing wrote:


 On Mon, Jul 29, 2013 at 7:00 PM, Nathan nathan@gmail.comjavascript:
  wrote:

 If I manage to get logs from the users, I might know what exception it 
 is. 


 I wouldn't rely on waiting on users to send you anything. Have your app 
 automatically send you reports using something like ACRA, then flood your 
 app with log that are also sent in your report until you track the issue 
 down.


I agree with that advice. I am finding any failure places and am treating 
them as a non fatal exception that should be reported in Crashlytics 
without user intervention. 

This probably means that it will take more than one update to fix, but 
that's the breaks. 

Nathan
 

-- 
-- 
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] Do SQLiteDatabase references go stale?

2013-07-29 Thread Kristopher Micinski
Won't this happen when the app dies and goes out of memory, and is
then restarted?

Kris


On Mon, Jul 29, 2013 at 8:00 PM, Nathan nathan.d.mel...@gmail.com wrote:
 Based on previous discussions of best practices here, I employ a factory
 method for opening SQLite Databases.

 /**
  * Factory method ensures only one instance of database in memory.
  * @param path on external storage
  * @return
  */
 static public SQLiteDatabase getInstance(String path)
 {
 try
 {
 if(alreadyOpened.containsKey(path))
 {
 return alreadyOpened.get(path);
 }

 SQLiteDatabase tdb= SQLiteDatabase.openDatabase(path, null,
 SQLiteDatabase.OPEN_READWRITE |SQLiteDatabase.CREATE_IF_NECESSARY);

 alreadyOpened.put(path, tdb);
 return tdb;
 }
 catch(Exception ex)
 {
 Log.e(TileDatabase, openExisting, ex);
 return null;
 }
 }

 This ensures that an SQLiteDatabase is opened once and closed never, which
 Diane and others here said is a reasonable pattern.

 Nonetheless, I get some reports from some users that their data dissappears
 and reappears. In the morning it works, in the afternoon it is not
 available, and the next day it is back again.

 Ie, there is a query for blobs in this database and is either coming back
 with zero results or throwing a SQLiteException that I am handling and
 returning not available. If I manage to get logs from the users, I might
 know what exception it is.

 So in general, my question is this. Is there a reason that SQLiteDatabase
 object may become inneffective, due to some changes in the system or
 something I am doing, such as leaking a cursor or something? Could a
 terminated process, due to Android wanting more memory or a crash, cause me
 to be unable to open the database when the process starts again?

 Should I be calling SQLiteDatabase.isOpen periodically or anything like
 that?

 Nathan

 --
 --
 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] Do SQLiteDatabase references go stale?

2013-07-29 Thread Nathan


On Monday, July 29, 2013 6:14:34 PM UTC-7, Kristopher Micinski wrote:

 Won't this happen when the app dies and goes out of memory, and is 
 then restarted? 

 Kris 


Not in my experience, no. Wish it were that easy to reproduce. 

Nathan 

-- 
-- 
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] Do SQLiteDatabase references go stale?

2013-07-29 Thread Kristopher Micinski
Can't you send it a kill signal: that should reproduce the behavior.

Kris


On Mon, Jul 29, 2013 at 11:01 PM, Nathan nathan.d.mel...@gmail.com wrote:


 On Monday, July 29, 2013 6:14:34 PM UTC-7, Kristopher Micinski wrote:

 Won't this happen when the app dies and goes out of memory, and is
 then restarted?

 Kris


 Not in my experience, no. Wish it were that easy to reproduce.

 Nathan

 --
 --
 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] Do SQLiteDatabase references go stale?

2013-07-29 Thread Nathan
On Monday, July 29, 2013 8:20:02 PM UTC-7, Kristopher Micinski wrote:

 Can't you send it a kill signal: that should reproduce the behavior. 


It doesn't. I have no trouble opening opening databases after a kill, even 
after such databases were left open. Never have. 
But it could certainly be different on some device I don't have. OEMs go 
out of their way. 

In the customer cases in the field, I'm not sure the process ends at all, 
forcibly or otherwise. 

Nathan 

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