-4

I am trying to set up a Tasker task that will delete all alarms in the clock. I had it setup and working great on my old phone. What I did was made a copy of the alarms database when there were no alarms. When I want to delete the alarms that are currently set, Tasker runs a shell command to delete the current database with the alarms in it. Then Tasker runs a shell command to copy the empty database and rename it. Then some commands to change permissions and owner.

When I tried to move this all over to my new phone is when I ran into some trouble. The new phone is a One Plus 3 for what it's worth. So I copied everything thing over and the only thing that looked like it needed to be changed was the package name for the shell commands. I changed that and tried the Tasker task. No luck. The clock app froze up. I restored everything from my backups. I decided to do some testing to see where the issue is.

I used the Root Explorer app to copy the alarms database. When I tried to open the copied database I got the following error message:

An error occurred while opening the database. Attempt to invoke virtual method 'android.database.Cursor android.database.sqlite.SQLiteDatabase.query(java.lang.String, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String)' on a null object reference

I can still open the original database just fine. But it appears something is happening when I make a copy of it. Any insight would be a big help. Thanks

DasPete
  • 831
  • 2
  • 18
  • 37
  • 4
    post your code sir – apelsoczi Aug 30 '16 at 02:08
  • No code. I was just using the app Root Explorer to copy the database. – DasPete Aug 30 '16 at 03:34
  • Are you copying your own app database ? or some other database to your app ? – dex Aug 30 '16 at 04:23
  • you want to copy own app database through programmatically, right ? – Jitesh Prajapati Aug 30 '16 at 05:22
  • This a bug in that app. – CL. Aug 30 '16 at 08:56
  • Hey all. Thanks for the help thus far. I tried to keep my original question short and simple but I don't think I had enough detail in there. I updated the question to better reflect what's happening – DasPete Aug 30 '16 at 17:26
  • 1
    This has nothing to do with programming though. You're just having trouble using your android device. Of course, we can't vote to close questions that have open bounties. – Stealth Rabbi Sep 01 '16 at 20:35
  • Please elaborate. I am writing a Tasker program to modify databases. When I copy a database I get an error. I don't understand the error, that's what I am seeking help with. I fail to see how this does not have to do with programming. I also fail to see how you assumed from my question that I do not know how to use my device. – DasPete Sep 01 '16 at 20:42
  • 1
    You're in the wrong website entirely to ask your question. You are not writing a program in Tasker (Though it may seem this way, I guarantee you aren't). This is all everyone has been saying. Your issue is entirely about end-user functionality, and not the development of an application. For better results and less flak you want to use the "Android Enthusiasts" Stack Exchange. – gelliott181 Sep 08 '16 at 20:31
  • This is the most help I've gotten yet! And while it may not seem it, actually do have some light experience in programming. I know Tasker isn't strictly programming, but I figured the shell commands, sqlite databases and error messages were. While I may not be asking about something as interesting as high end security protocols this is still a project I'm invested in. I know when I've fallen on deaf ears. I'll try elsewhere. I do appreciate your genuine help! Thanks! – DasPete Sep 09 '16 at 05:22

1 Answers1

0

Problem as I understand it:
You say "When I copy a database I get an error", if it's in the copy process then it's trivial, if you don't mean that, then say that. Moving on... You have copied an sqlite database from somewhere, to some where (you don't say where, it may matter), and you don't permission to open it [maybe you do, then say so, give ALL permissions] (but you can open the original). File Permissions comes to mind (user permissions on the file). This method works on an old phone but now does NOT work a new one (API versions would be useful, these methods have changed a LOT). The error is about Cursor queries. see my answer about Cursor's, and cursor management Do not assume your original code was perfect because it worked. More detail required. Post some minimal code the is involved in the error. We are not trying to steal your code, we cannot answer your question, without seeing the code that makes it fall over, how can we do that ?. ALSO include the catlog. You never know, we might give you code that works ;O)

Community
  • 1
  • 1
Jon Goodwin
  • 9,053
  • 5
  • 35
  • 54
  • Thanks for a legitimate response. It's become quite clear this isn't the proper forum for my issues. I think I'll move on elsewhere at this point. But I do appreciate the effort you've put in. Thank you! – DasPete Sep 09 '16 at 05:15