Text inside sql or text file - Java for Android App Development

Hi,
I am designing my first android app. The app I have in mind is a songbook. I have a question on which would be better in terms of performance. Storing and retrieving the songs from individual text files or using an sql database with a text field. Would the number of song entry play a part in this decision too?
Thanks in advance

nyeknyek said:
Hi,
I am designing my first android app. The app I have in mind is a songbook. I have a question on which would be better in terms of performance. Storing and retrieving the songs from individual text files or using an sql database with a text field. Would the number of song entry play a part in this decision too?
Thanks in advance
Click to expand...
Click to collapse
Both are eventuality using a text file for storing the data.
If you are lazy you can store it in the shared preferences as a json string using gson for serialization.
Using an SQlite for storing the data can require a bit more code.

Thanks for the reply.

Related

Auto backup of sms

Hi,
I'm looking fo a software that backup the SMS in real time, not scheduled once or twice a day
I mean that the SMS received and sent are stored elsewhere from the poutlook as they arrive
Is there a way to do this ?
I don't know if such a tool exists; however how much cpu and battery time would this take if it was constantly backing up in real time?
WB
I don't think that it would use more that other app'
I mean it stay in memory load as a service or something like that and when an SMS is sent or received (a new entry in the database) the software will just store it in a text file a something like that
I don't mean a complete backup but one by one...
For a simple implementation have a look at this:
http://www.cjcraft.com/blog/2008/06/17/30DaysOfNETWindowsMobileApplicationsDay16SMSLogger.aspx
I'm currently implementing something similar but instead of putting the sms into a text file (like in this example) I'm storing them into a sql table so that further analysis can easily be made (sort/count by sender, ...).
Some feature like autostart after reset would also be nice.
Any other ideas?
P.S.: Unfortunately I still haven't found a way to also get notified when sending messages.
heliosdev said:
For a simple implementation have a look at this:
http://www.cjcraft.com/blog/2008/06/17/30DaysOfNETWindowsMobileApplicationsDay16SMSLogger.aspx
I'm currently implementing something similar but instead of putting the sms into a text file (like in this example) I'm storing them into a sql table so that further analysis can easily be made (sort/count by sender, ...).
Some feature like autostart after reset would also be nice.
Any other ideas?
P.S.: Unfortunately I still haven't found a way to also get notified when sending messages.
Click to expand...
Click to collapse
I know that the sms data are stored in the cemail files in the root of the device.
Scanning the database (it's a database) every x minutes.... (to heavy I think)
There is no event that is catchable like RS232 connect, syncronisation, alarme.... ???
heliosdev said:
For a simple implementation have a look at this:
http://www.cjcraft.com/blog/2008/06/17/30DaysOfNETWindowsMobileApplicationsDay16SMSLogger.aspx
I'm currently implementing something similar but instead of putting the sms into a text file (like in this example) I'm storing them into a sql table so that further analysis can easily be made (sort/count by sender, ...).
Some feature like autostart after reset would also be nice.
Any other ideas?
P.S.: Unfortunately I still haven't found a way to also get notified when sending messages.
Click to expand...
Click to collapse
Hi, can you please share your sql table create/read/update code in VB .NET?
For sent sms notification, there is a way to do this using inthehand api's professional editon.

How to transfer SMS Messages from a Nokia phone to X1 (Win Mob device)

Hi Guys,
This is my first post. I have recently purchased an Xperia X1 upgrading from an N73. I was searching for a way to transfer sms from the Nokia N73 to Windows Mobile but came up empty handed. I found a few threads on this forum which asked the question, but didn't end up helping me. I have found a way to do this, I will admit this may be a pain in the ass, but if you stick with it (and if its important enough) you will have your SMS messages transferred across to your WM device.
Tools you will need
Nokia PC Suite (whichever version you need for your mobile)
SMSImport for PPC (http://www.freewarepocketpc.net/ppc-download-smsimport-v1-0-1.html)
ABC Amber Nokia Converter
XML Notepad 2007
Steps
1. Firstly its best we extract the messages from your Nokia phone first. Open PC Suite and view ALL the messages you want to transfer. I just selected my inbox
and copied all messages.
2. Create a folder on your desktop and paste all the messages in the folder.
3. We will leave the messages alone at this stage and prepare the xml file template you use to import your messages. Copy SMSImport to your PPC device (doesnt matter which memory you choose) Run the app. Its best to run this with some sms messages in your inbox so you can see how its exported. Export a copy of your messages to a file. If your doing this on a fresh install below is the xml structure.
<SMSExport><store name="SMS"><folder name="Deleted Items"/><folder name="Drafts"/><folder name="Inbox">
<message date="DATE" sender="SENDER MOBILE NUMBER" recipient="">MESSAGE CONTENT</message>
</folder><folder name="Outbox"/><folder name="Sent Items"/></store></SMSExport>
You may notice that there are additional folder names. You can export messages from other folders on your phone and import them under the headers in a similar format as per below
<SMSExport><store name="SMS">
<folder name="Deleted Items"/>
<message date="DATE" sender="SENDER MOBILE NUMBER" recipient="">MESSAGE CONTENT</message>
</folder><folder name="Drafts"/>
<message date="DATE" sender="SENDER MOBILE NUMBER" recipient="">MESSAGE CONTENT</message>
</folder><folder name="Inbox">
<message date="DATE" sender="SENDER MOBILE NUMBER" recipient="">MESSAGE CONTENT</message>
</folder><folder name="Outbox"/>
<message date="DATE" sender="SENDER MOBILE NUMBER" recipient="">MESSAGE CONTENT</message>
</folder><folder name="Sent Items"/>
<message date="DATE" sender="SENDER MOBILE NUMBER" recipient="">MESSAGE CONTENT</message>
</store></SMSExport>
Simply put, there is a message in each folder above, it will restore this message in each folder on your PPC device. Got it? Good =)
4. We will return to your copied messages now. Open ABC Amber Nokia Converter and open all the messages in the folder you created earlier.
This will list all messages and show you the details of each message.
5. Now depending on how you view your SMS messages on your PPC, there is Conversation view or the normal sms itemised view. If you decide to use the Conversation view, to show the messages in the correct order from which they were recieved, you will need to sort by date, oldest messages at the top. If you use the normal sms itemised view, you dont need to worry about sorting (as far as I know).
6. Select all messages and export to a excel spreadsheet (xls). Why are we exporting to Excel? Because the next stage will make preparing the output
for the xml doc so much faster and easer.
7. Open the excel sheet and you will see all your messages listed with the individual details separated by column. YOu will need to edit this output to resemble the following order
DATE/TIME, MOBILENUMBER, MESSAGE
8. Next we need to insert the xml tags to make life easy. You will need to create the following tags.
<message date="
" sender="
" recipient="">
</message>
9. Now for each line you will need to insert additional columns for each of the above tags. The end result should be like this
COLUMN A = <message date="
COLUMN B = DATE/TIME
COLUMN C = " sender="
COLUMN D = MOBILENUMBER
COLUMN E = " recipient="">
COLUMN F = MESSAGE
COLUMN G = </message>
Ensure that this format is consistent for all messages.
10. Once you have completed this, Select all text and copy it to notepad. When the data has been pasted there will be a lot of tab spacing. These will need to be removed. The best way is to copy a block of these spaces (a tab space) and use find and replace to remove the spacing. HINT Find box will have your tab space, Replace will have nothing. Click Replace all and this will remove all the tab spaces.
11. Once this has been done you will need to then sort out your messages into the folders that you want them to be imported into. Use the example above as your guide.
12. Once you have done the sorting of your messages, you will need to add the following to the top of the document
<SMSExport><store name="SMS">
And the following to the end
</store></SMSExport>
Save as a .xml file.
13. As xml is picky on which characters are accepted, you will need to vet the xml file for bogus characters which SMSImport will reject, Open your xml file in XML Notepad 2007. It will flag the location of unsupported characters with an error message, giving the line number and character number. The status bar in Notepad will help you with the locations if you have a large amount of messages. Typical characters that arent supported will be @ & and other non English standard lettering. If there are no errors, the xml file will load and display a tree output which you can expand the folders and see your messages.
14. Now for the final step. Copy the xml file to your PPC device and start SMSImport. Point to your xml file and tap it. If things are right, You will see the app processing and adding all the messages into your SMS folders!!!
Thats it!!!.
Now I should mention on a side note that the mobile numbers do not display the + sign on the mobile number like +61000000000 for example, so linking it to your contacts will not work. If you want to be anal about how the SMS display (you want to see the Contacts name instead of the number) you will need to do the following
1. Using Notepad, and the find and replace option, search the first 3 numbers eg 614, replace it with +614 (Im using Australian country codes and the 4 is the second number for mobile numbers in Aus) This will make the numbers a recognisable format for your mobile.
2. So your messages display with the contacts name you will need to replace the following string
<message date="DATE" sender="SENDER MOBILE NUMBER" recipient="">MESSAGE CONTENT</message>
With the following
<message date="DATE" sender="""CONTACT NAME" <SENDER MOBILE NUMBER>" recipient="">MESSAGE CONTENT</message>
This will be a time consuming process if you arent to savvy with your mates mobile numbers, but it makes it worth it in the end. Once you have made the changes save the xml file and follow steps 13 and 14 to check the import file and import into your PPC.
This process took me a few hours to figure out and im happy with the results. I agree its not the simplest way of doing this, but so far the only documented way I have found that works.
I hope this helps
I just wanted to thank you for your HowTo! I had to to this from an old SE-Phone (W960i) but the steps have been mainly the same. Although I needed up to 3 hours to handle 300+ SMS I'm now happy to have them all on my X1
Also I will indeed never read them all again, but it feels just good for me to have them not lost
THX a LOT!
thx for this idea, I transfered my sms from nokia 3110c to my htc wizard with your help :")
I made updated version of the transfer guide: http://forum.xda-developers.com/showthread.php?p=4385729#post4385729
Also made a little parser for simple user-friendly xml creating.
Check it out :")
Hi dude, i need a similar kind of help, I am sending my Xperia X1 for repairs, I wanted to backup my sms onto my PC, do you any way I could acheive this?
Your help will be much appreciated.
Thnaks
PIM backup? Jeyo SMS backup? I think the best would be full backup with SPB backup utility
Do u know how to transfer sms from X1 to PC ?
How to transfer sms from X1 to a PC ?
Hi dude, i need a similar kind of help, I am sending my Xperia X1 for repairs, I wanted to backup my sms onto my PC, do you any way I could acheive this?
Your help will be much appreciated.
Thnaks
Help!!
Ran this procedure on a HD2 and completed all steps successfully. However, I don't see any messages when I go to the message panel on the home screen. what could be the possible issue?
thanks in advance.
Try http://www.bloove.com
MOBILedit!
Hello,
I would like to point out a software for mobile phones management called MOBILedit.
MOBILedit is a PC software, which is among other things able to browse, edit, copy, backup and migrate data within connected mobile phones. Mobile phones may be connected by cable, BlueTooth or even IrDA.
Especially the possibility to migrate contacts, messages and other content may come handy in this case.
It is not free, but it is totally worth it.
I hope you will give it a try - there is a lite version available to see how it works.
Thanks!
its a very awsome mobile phone............i like its specification............
yeah that takes ages, but deleting messages is always like loosing part of your life so thanks a lot

[Q] How to turn Handcent texts into a word document?

I recently had this hilarious long text and i want to share screen it over facebook to share. I don't know how to turn a string of texts into a word document that is exportable or at least copy and paste able. How should I tackle this problem?
You could install a notepad app on your phone and hop between the Handcent and the notepad copy and pasting one text at a time. Save the notepad as a .txt file and push that to your PC. Open with an office suite and edit from there.
If you'd been using Google Voice, you could have logged in and simply copied the whole exchange.
Sorry, but the slow bit by bit method is all I can think of right now.
thepaddedroom said:
You could install a notepad app on your phone and hop between the Handcent and the notepad copy and pasting one text at a time. Save the notepad as a .txt file and push that to your PC. Open with an office suite and edit from there.
If you'd been using Google Voice, you could have logged in and simply copied the whole exchange.
Sorry, but the slow bit by bit method is all I can think of right now.
Click to expand...
Click to collapse
Thanks for the input. I've thought of that too, brute forcing it, but I rather I export this big long thing as a whole rather than ctrl c ctrl v-ing every single entry...
Not sure how long it is, but normally I just forward it, and instead of sending it out, I cut all the txt and paste it into a new msg. Then back out of that msg, handcent will save as draft. Repeat the steps of forwarding and cutting the txt and continue pasting it into the draft msg. Once u got all msges, u can cut that and paste it into other apps or email it to yourself if you want it on the computer...ect.
Will that work for what you want?
Sent from my HTC Vision using XDA App
wilnotdie said:
Not sure how long it is, but normally I just forward it, and instead of sending it out, I cut all the txt and paste it into a new msg. Then back out of that msg, handcent will save as draft. Repeat the steps of forwarding and cutting the txt and continue pasting it into the draft msg. Once u got all msges, u can cut that and paste it into other apps or email it to yourself if you want it on the computer...ect.
Will that work for what you want?
Sent from my HTC Vision using XDA App
Click to expand...
Click to collapse
Let's just say I have over 100 entries in the thread I want to put up onto facebook...
I don't know how I can cut ALL the entries at once,...
Another idea:
There are several SMS backup apps in the market that promise to back up to Gmail. Maybe you could backup the thread via one of those apps and copy the whole thread from your Gmail account.
Sent from my HTC Vision using XDA App
hmm. for something that large, idk. Someone would have to create a specific app or something.
Closest i got was using SMS Backup, which turned my texts into an XML file.
Opening that in excel 2007 allowed me to filter by a certain number, and than copy and paste the msgs to a word doc.
Thats the only quick option I could find....sry

[Q] Retrieve contacts from database

I have a problem with my Defy running CM11. Yesterday it just rebooted randomly during writing of SMS message. I wouldn't really mind this(because it happens sometimes with unstable fw) but half of my contacts were gone. I know I should sync them with my Google account but I didn't for some time now and I really would like to restore them. I copied 'contacts2.db" file, opened it in text editor and it is possible to find those missing numbers there, but the context is really hard to figure something out. I found it in the table named "search_index_content". The table is looking like that: "CREATE TABLE 'search_index_content'(docid INTEGER PRIMARY KEY, 'c0contact_id', 'c1content', 'c2name', 'c3tokens')". Number is in the "c3tokens" column, there are two ids in first two columns and some probably encoded text in "c2name" column. Does any one know how to decode the text from this column or how to generally restore ALL contacts from "contacts2.db"?
qwert940 said:
I have a problem with my Defy running CM11. Yesterday it just rebooted randomly during writing of SMS message. I wouldn't really mind this(because it happens sometimes with unstable fw) but half of my contacts were gone. I know I should sync them with my Google account but I didn't for some time now and I really would like to restore them. I copied 'contacts2.db" file, opened it in text editor and it is possible to find those missing numbers there, but the context is really hard to figure something out. I found it in the table named "search_index_content". The table is looking like that: "CREATE TABLE 'search_index_content'(docid INTEGER PRIMARY KEY, 'c0contact_id', 'c1content', 'c2name', 'c3tokens')". Number is in the "c3tokens" column, there are two ids in first two columns and some probably encoded text in "c2name" column. Does any one know how to decode the text from this column or how to generally restore ALL contacts from "contacts2.db"?
Click to expand...
Click to collapse
First of all export your contacts to SD card. Then you can find 00001.vcf file in SD card. Open it using a text editor and look for missing contacts. Or after exporting it display ......contacts copied. If it equals to your full contacts list then import it.
Sent from my MB526 using Tapatalk 2
I wouldn't name you answer brilliant, but no offense you tried. If I'm working with database to restore at least some of the lost contacts if not all of them do you really think it's that simple to click "Export to SD" on my phone. I wrote that the contacts are missing. There are not showing in directory so they won't be exported to vcf
Nonetheless I managed to encode the text. It's in hex system, however it's not ASCII, I'm not sure which encoding it is. Topic can be closed.

app-php-db or parse?

I need to create an android app where the user info like (name,phone_no,address,personal_note) should be stored in my sql database on submitting. I need a real time notification when the user submits the data. I did some search on how to implement this and found we can use app-php-sql method. Where I can load the php script on my server which deals with the data coming from app and stores it in my SQL database. Is this reliable when there are like 50-100 requests per day ? And how to implement a real time notification on receiving the data in my database?
or should i go with PARSE ? someone suggested me to use parse and that it can handle all these issues and notify me on there dashboard.
Hello,
a26484306 said:
Where I can load the php script on my server which deals with the data coming from app and stores it in my SQL database.
Click to expand...
Click to collapse
I am not sure to understand your question but I will try to answer.
Upload your PHP script on your website. Up to you to decide where you put the file (which folder). The trick is to refer the script URL in your Android Java code.
a26484306 said:
Is this reliable when there are like 50-100 requests per day ? And how to implement a real time notification on receiving the data in my database?
Click to expand...
Click to collapse
50-100 requests per day ? Of course. Imagine your app is used 24 hours per day : 100 / 24 = 4.16 requests per hour ... :good: I think your website will able to accept that.
a26484306 said:
And how to implement a real time notification on receiving the data in my database?
or should i go with PARSE ? someone suggested me to use parse and that it can handle all these issues and notify me on there dashboard.
Click to expand...
Click to collapse
Parse is a good solution.
You can use as well, a Google solution as GCM (Google Cloud Messaging).
Good luck and regards,
I'd say parse

Categories

Resources