How to relate geofence with the database in my android device? - android

I am pretty new to the android app development and I would like to develop an app about geofencing. Under my understanding, geofencing can be related to my own database stored in the device memory and it has a limitation that only 100 geofencing can be used at the same time. (Actually I am not sure if my understanding is right. If it is not, please correct me.)
My question is: Can I store several lists of geofences in my device and only enable the list which I want using the app? so, I can have more than 100 geofences but use less than 100 at the same time.

Short answer: Yes, you can. I'm not sure what the exact space requirements would be but I don't see a problem in saving several lists of 100 entries each.
For more information on how to save data in Android I'd recommend looking at this training module. You don't have to save the data - you could just keep it in working memory and redownload the lists every time. Maybe that would make more sense in your case, I don't know.

Related

is it possible to program an app that receives data from an already existing app?

I'm trying to program an app using android studio that receives data (blood sugar levels) from the app tomato (which calculates blood sugar levels automatically every 5 mins or so). The tomato app already exists and is made by a company.
So I was wondering if doing this is possible. if so, how?
I saw this post: Is it possible for an Android app to use data from another app? which is very similar to what im trying to do but i didnt find an exact solution/answer to this.
Any opinions and help are very much needed and welcomed.
You would first need to know how the app is storing the data, you could check your phone's storage using the Device File Explorer in Android Studio. If they have exposed the data then you are able to check and read the files that the app has exposed. However, I have a feeling that they would not be leaving them in plain text for you to take.
Upon some further reading, it seems they read from a device called a MiaoMiao Transmitter. You could ask the producer of this product for a developer kit and see what they say. This would come with documentation as to how you can get data from the product. However, if they do not provide you with any help, you will need to do some investigation as to how the device functions.
Perhaps it sends android broadcasts when it is taking a reading? This is just speculation of course. This is very niche and I believe that is a reason there are only a few apps that use the device - they are trying to lock out "non-verified" developers. However, when there is a will, there is always a way! ;)
Best of luck!

What are the best practices for consuming several API's in Android

I was hoping someone could help me with a question I have.
If I want to consume data from several API's in android (they are checked once a day for changes) and then I combine all of the data and do something with it, what would be the best way to do this from a resource and memory point of view ?
An example would be getting bus timetables from several bus companies operating in a city and then showing what busses are leaving in the next hour for example, that is relative to your location.
I do know how to consume Rest API's in Android, I am just wondering if there is a better way than calling say 20 API's once a day and storing the data ?
If I have not explained the question well enough please feel free to ask me anything and I will try and explain it better.
Thanks in advance.
I think you should make a few question about your solution.
Does your solution require the access to 20 different api's and the mobile app will be distributed in more than one user? If the answer is YES then you need a backend. The backend will execute a batch process to access the data from the 20 sources, consolidate the information and will be available for as many client devices require that information.
If the information will be not updated, you can make one call per day to the backend and keep it cached on the device.
If your app get more complex, could even receive notifications about changes on the data so it could update it.
Hope it helps.

Android app - Perfomance vs Size

I'm in a dilemma that somebody may know the best answer. I'm developing an app, that uses a geographic database to get points and current user position. The database that I'm using is PostGis and has 75MB of size. What do you think that fits best :
Develop a webservice and every 5meters do an http request to get user's position?
Use the database inside of the android and get geo information with queries?
Thanks ;-)
It depends on the purpose of your app.
If your app requires the ability to be offline and still function, then obviously the database is required.
If your app does not require offline ability and the data being passed is small, then a service is a good option. If the data is large, then you are back to the database option.
We have had some real challenges with positioning data and the relative accuracy within our app. Another consideration is battery consumption. If you add messaging to GPS polling, it can suck up a lot of battery. Good luck.

Is using a db40 database in an android application a good idea?

Does anyone see any issues with using db40 object database in android?
db4o.com
I just want it to store some data for me locally on the device, and it is a really simple easy to use object databse.
Will it work on android?
Is there possibly a better/simpler / more standard way to go?
I want it to store a list of users devices.
No there is no any issue in that. We are using it for one of our application.
Even in latest version they have made its foot print very small. Means taking small amount of heap memory when you open it.

Android platform, can I meet those requirements?

Folks, I'm trying to see if my plan realistic at all. I'm ne to
Android platform but not new to software development. This is my first
post here as well :)
We want (in our company) to create Android software to compliment our
truck management software. Basically, it will do couple very specific
tasks.
a. Send GPS updates to server.
b. Receive trip information.
c. Send pickup/delivery confirmation to server.
After evaluationg i. platform and Windows phone 7 platform we came to
conclusion that only Android has multitasking that works for us. So,
Android it is but I have some specific questions.
Data plan we want to use will be very limited. Probably 5M/mo and
no voice/text. I figured 5x1024x1024 = 5242280 bytes will give me 1k
per transmission every 15 minutes (3000 transmissions per mo). It will
leave 2M for other stuff that will happens every couple of days. Does
my math look OK or there is lot of "waste" traffic? Our server going
to be XML SOAP and messages sent will be just Lon/Lat in XML package.
1K will be OK? If I just calculate bytes it will be even less but I
wonder if there is "minimum" packet size, etc. Any insight on this
data limitation appreciated.
Because of #1 we need to "lock" device somehow so there is no other
software that uses network. Possible? If so, what do I need to look
for? I found already created app - firewall and it says phone has to
be rooted for that.
Receiving trip information. What's the best way to accomplish that
given my situation? Should I run some kind of listener? Will my phone
have IP address or something? Or should I get small text plan and use
that for this specific functionality? Can I receive text message in my
own application?
So, as you see we trying to shrink $80/mo service to $15/mo service
that will do big savings to our company but not sure if it's all
possible with constraints we have. Also, we may just give discounts to
drivers who have Android phone and will install our app but we don't
count on that.
Thank you in advance for any help on this subject.
UPDATE:
Now that I think about it - limited data plan present challenges initially but actually helps us do it "right" to make sure we don't overload server with constant polls. What I really like to see is some real-worls experience with data usage. Problem is, to us to even come up with test app - will require considerable effort. Would be much better to rule this out right now if it won't work. For example, if I knew that message size 2k no matter how big of a message itslef - then I would know immediately that it won't work for us..
If you have a very limited kind of data that you are transferring, the overhead of xml might be unnecessary. Instead, pass .csv data to different endpoints dependent upon the data that your are transfering (one endpoint for lat/lon, another for pickup/delivery confirmation)
You do have an ip address on each device, but you're not necessarily going to know that information - it's not constant, or consistent (it can change as the phone moves around). Instead, do a timed polling of the server (that would make your 3rd endpoint) See other mentioned solution of triggering on SMS.
As far as locking the device, I'm not sure about this, but it certainly seems feasible (though it's not consistent with your 'discounts to drivers who have Android phone'. I understand why, but if the phone has no voice/text capability, it's not likely that the phone will be used by the drivers for much besides it's expected purpose.
You are not going to achieve this with a default Android ROM in other words you have to create your own customized ROM from scratch and deactivate quite some stuff in order to get your devices not to use up the 5M/Month.
You can checkout the developers site on the Android source code to check out if that would be an option for you. Giving discounts to drivers owning an Android phone sounds nice and all but I'm quite certain that this is not going to get the desired results which I guess are that you equip all your trucks with such a device and track all of them.
In my opinion it is not going to work with a data plan of 5M/Month but on the other hand I don't know the data consumption numbers without testing.
UPDATE: Also I would not go with XML but with JSON due to overhead.
When you upload a GPS update, have the server reply with any of the trip data you need to push down to the phone at that time.
I think that for the data traffic (the other topics that you asked about are already solved in the other answers) using a bitmask-like solution will be the best option, first bits are for lat, the next for lon, and then some bitmask for the flags, and sending text data only if it is necessary.

Categories

Resources