[Q] SQLite Bad Practice? - Android Q&A, Help & Troubleshooting

So I feel that I already know the answer to this question (Which is no) but I feel I should ask just in case.
I am developing my first app for android and have a question whether or not my current method of storing data in a SQLite database is considered bad practice and should be re-evaluated before I go any further.
Basically I am creating a changes tracking app. The user can specify a project and add entries for that project to track changes, ideas, etc.
The current way I am storing the data in the SQLite database is by creating an individual table for every project and then storing the entries for that project within that projects table.
This is what my question is in regards to, is it bad practice to create a separate table for each project? I realize that with enough projects my database would be overrun by tables.
If anyone has any suggestions of a better way to do such a structure in SQLite (Projects with entries) it would be greatly appreciated.

Related

[Q] User generated layouts

Hi all
I am developing an app in which I would like to allow user-generated content. Specifically, this will be a remote control application, and I would like people to be able to add custom layouts, capable of sending "events" through the app, but I am not sure how to do so.
There are a couple of ways I have been looking at. The first is using a WebView so that this content can be developed in HTML. This would be nice and easy from their point of view, but it does have it's downsides, especially where security is concerned. If I was to do this, I would want to bind a "send" Javascript interface to my app, but disallow any other Javascript (I do not, for example, want it to be able to relay the button presses to some other place). I'm not sure exactly how I could do this.
The second way I can see would be to use an XML file and build up the layout from that. Here, the only way I could see it to parse the XML file and programatically build the layout. This seems a lot of work, and I would rather avoid that.
A third way would be to import a layout purely as an image plus an XML file describing hot-spots for triggering events. This seems to have too many limitations.
The final option is to expose an interface to other apps, and allow users to build separate applications which hook in to provide these layouts. This seems a terrible approach for such a simple objective.
So, does anyone know of a simple way to do what I am after, or any comments on the options listed above? Has anyone done anything similar, or know of an open-source project which acheives something similar?
Thanks in advance

[Q] feasability / Idea for an app

I work at a branch of BASF (chemical plant) and we have these lists of things that need to be checked regularly .. (valves and their state (open or closed), values for temperature, pressure, ...)
I was wondering if it would be possible to tag each valve/measurement with a QR code and have a device (tablet, or whatever..) that has a library of these valves/measurements and when a valve's/measurement's QR code gets scanned you could assign an open or closed attribute or a value.
This would make it much easier to get an overview of the entire situation, and would create a standard for the registration (one person does this differently then the next which sometimes leads to miscommunication)
Does anyone have an idea if this would be possible ?
I myself do not have the knowledge to create such an app, but I feel it should be fairly simple for someone who does.
If you can offer me any information on this matter It would mean a lot to me ! thanks in advance !

Newbie app development help.

Hello guys, this is my first post here in the forum and i'm looking for a very specific answer, hope you can help me.
So I had this idea for an app that could really optimize the way people work here @ my workplace, but the thing is: i know nothing about programming and development
The question is: how hard would it be/how long would it take for a complete newbie to develop this app? (description below).
It consists basically in a scheduler & task assignment app. It must be able to:
Register two kinds off app users: workers/schedulers (WS) and schedulers only (SO).
Create WS subgroups (something like tags or flags so tasks can be assigned to a specific subgroup of WS').
Allow WS to create their own daily schedule and share it with all schedulers.
Allow SO to have access to all WS' schedules and fill them remotely.
Allow SO to auto-assign tasks to the nearest availabe WS of an specific subgroup.
Allow both WS and SO to see wich tasks were assigned by each one.
This is the main idea, of course there are some minor changes and details that I need to add, but this is enough to get the main idea.
Waiting for an answer, thank you in advance.

android db (SQLite, Realm or Redus)

I have a to chose between those Database :SQLite, Realm or Redux
witch one is the best for regular db update ?
Hi smauh117, this is my opinion:
Persistence - why Realm, not Room (SQLite)?
Room Persistence Library is a part of google's android acrhitecture components announced Google IO 2017. It provides an abstraction layer over SQLite to allow fluent database access while harnessing the full power of SQLite, works well with LiveData.
But, SQLite is not simple, and relational database is not easy for a lot of android developers. In almost android application, local database is offen used for data caching only, and isn't center of bussiness processes.
Realm is a mobile database, a replacement of SQLite and ORMs. It is much more simple than SQLite, but really powerfull, easy to learn in minutes, not hours, for every mobile deveopers, both Android and iOS. Even "Realm Database is much faster than an ORM, and often faster than raw SQLite". With lazy data loading, your app can easy to archive better performance and user experience, it's really difficult if you are using Room.
Room works well with LiveData and lifecycle aware to prevent memory leaks, how about Realm ?
It dosen't matter, Realm can easy to adapt with LiveData, read more: Android Architecture Components and Realm.
For full article and source code, please visit my project here.
I also created this project to compare Realm and SQLite (with ROOM). Please checkout different branches.
Thank you
:good::good:
smaug117 said:
I have a to chose between those Database :SQLite, Realm or Redux
witch one is the best for regular db update ?
Click to expand...
Click to collapse
AFAIK: Redux is an architectural pattern and not a database like Realm and what do you mean by "regular db update" ?
Anyway, Google's Room is a pretty good and established abstraction layer over SQLite on Android. I don't recommend Realm because there're a couple of pitfalls regarding multithreading. If you don't want to use SQLite + Room check out Objectbox.
smaug117 said:
I have a to chose between those Database :SQLite, Realm or Redux
witch one is the best for regular db update ?
Click to expand...
Click to collapse
SQLIte/Room may not be the best option depending upon what you actually mean by regular db update.
That is SQLite and therefore Room (Room being an abstraction layer over SQLite) is intended as an embedded database and thus each device has it's own distinct database and synchronisation with external data would have to be coded/developed, just pulling data from one source wouldn't be overly difficult. However, two/multiple way/device synchronisation would introduce complexities and hence why many solutions use other databases that are intended as a client server solution (e.g. MYSQL for example).
Firebase, not that I've used it, could be a solution as this is a client/server solution and is designed for Android use.
Personally I find native SQLite easier and therefore faster to use than Room. I've never used Realm.
it depends on your data architecture, if you'd like to use a non relational database just go with Realm, it's like mongo for mobile apps, otherwise there is Room, which represent the relational database by using Sqlite.
@MJT said:
SQLIte/Room may not be the best option depending upon what you actually mean by regular db update.
Personally I find native SQLite easier and therefore faster to use than Room. I've never used Realm.
Click to expand...
Click to collapse
I completely agree. I use SQLite to save user preferences in the application. It is simple and stable.
And this is a cross-platform solution (not only for android).

Not sure about approach for future app

Hello,
I took over as the developer for a company that currently has a PHP code base and native apps written for Android and iOS. One of the key features of the native apps is that it takes geolocation data points constantly and sends them off for processing. It needs to keep taking those data measurements even when the screen is not in use. I'm struggling to find an answer to the question -> "Is it possible to satisfy that requirement using a progressive web app or hybrid app?" Not having 3 separate code bases would be ideal for future development projects.

Categories

Resources