use of multiple google api in android app using switch - java

I am trying to develop an app for android which is a personal mobile search engine based on the user's history and their current location. To search for results I have used the Google search api.
Unfortunately it has a limitation of 100 searches per day. To overcome this I had planned on using multiple Google search api keys (using switch). The problem I'm facing is that whenever the resultactivity (the function in which search and results are gathered) is called the counter is reset. As a result my app is using only 1 of the keys rather than all 3. Is there any way I can rectify this problem?
I have attached the code here (but without the switch).
https://docs.google.com/file/d/0B6z6YZ5pqVLdRjhGNmRpTHQ1Rzg/edit?usp=sharing
Please help me its my final year engineering project.

You can change the location where you store the number of searches to the Application class.
and if you the user quits the application you could store it in the SharedPreferences as well.
But I think the problem you are going to face is bigger then this. I don't really sure that Google allow to produce several keys for the same SHA1 keystore and the same package name including your application name.

Related

How to restrict a user from deleting my android app with a password?

I know this question has been answered here(on this platform) many times before. But it's around 8 years before and things have changed. Almost every answer has been deprecated by android. That's why I'm asking it again and please be kind to answer.
I'm developing an app for parents to limit their children's mobile phone usage. But there would be no point if the child can delete the app. Therefore, I'm looking for a solution where I can ask for a password before uninstalling it. The password can be provided in the first use of application and when the user going to delete the app it should ask for the password. How can I do this?
PS: I'm using java for developing the app and the lowest api level I have chosen is 23.

How to use a server to analyse data between two android devices?

Basically what I would like to do is have two phone in close proximity press a transfer button which will notify a server about both the devices latitude, longitude and unique ID. From here I would like the server to compare the latitude and longitude of both devices to check there within a close proximity of each other. If they are within the accepted proximity range the server will swap the ID's of each device so that they can then retrieve information about each other from a database.
I have been stuck for a while and seen a few options but am unsure about there difficulty of implementation and there capability of performing the required task.
I am using using Android and Firebase and have this mostly done except for the server data analysis as mentioned above. The first idea was to try Firebase Functions as it is simple to integrate with the Firebase database but I have had a hard time finding examples in Typecast to perform the functions I want. The other option I see is to use node js which I know next to nothing about and don't want to invest an unnecessary amount of time into just for it to fail.
I have searched a good amount and haven't managed to find any solutions to fit this criteria so if this question has already been asked and answered please link me to the page.
I know this has already been done by Bump but theirs literally no information available about how there back end worked.
If any of you guys can recommend any solutions to resolve this issue it would be greatly appreciated. If I forgot to mention something or you need more information let know.
Firebase cloud functions + Firebase Database is a good fit to your problem statement.
When the two devices initiate a session, you can create a node(session) on Firebase realtime DB and then have a cloud function listen to changes in a node where the sessions would be created. The Firebase cloud function could then compute the logic about the proximity and swap id's.
Where is that you are stuck?

Count how many times an android app has been opened for all devices combined

I'm developing an Android App, and I want to know how many times it has been used worldwide. Not how many times it has been installed but rather how often it has been opened.
I read about using persistent storage to count uses per device, but I want to take all of those uses and get the total sum of these values. How could this be done?
You can use Google Analytics API to report about "main screen is opened" event. Aggregation by-days will be performed by analytics itself.
See for details https://developers.google.com/analytics/devguides/collection/android/v4/#screen-view
You can also use Crashlytics for that, check out http://try.crashlytics.com/answers/
I added a counter in an html page which is presented every time a user opens the app, this is a welcome back screen and shows some news. This sends some code to the server and increments a value in my DB. This value is then presented in Settings, which has a message that says "Sessions since 'date': 'myValue'".
Thanks for all the answers, I might migrate to them if needed.

How to use google cloud storage with ADT?

Total beginner here.... :(
I am using Eclipse with ADT and Google App Engine plug in.
I have built my "awesome" android app, but now I want to save some of the data the app produces onto a cloud service so I can share it between my users.
So I am trying to do this with google services. I have incorporated in my project both Cloud Storage API and Google Cloud Datastore API, both using the GDT plug in, but that's as far as I can get :((((
I know I am asking a lot, but I don't even know if it is a lot, it might be a few lines of code, at least that's what I think.
So now I need a way, through some Google API to connect to a database that "belongs" to me, and store 5 numbers there from each of my users, and share other user's numbers with each other...
Can someone take me by the hand and tell me what I need to import and what not...?
I have spend hours reading all documentation about these APIs I could find and I ended up going in circles :( either trying commands that cannot be resolved, like DataStoreService(), or simply not even finding where do I put my info to get to "my" database....
Thank you all.

Android Project - Required Tools

I'm in the process of starting a new Android project that will:
Display a Google map
Track and record users movements
Display the route on the map
Show local points on interest on the map
My question is what extra tools will I need to accomplish this? I can already get a basic Google Map working with zoom controls and place overlays etc. but my main concern is how I will track the users movements. I was thinking there maybe some sort of fleet management API but I really have no idea.
A link to some sort of tutorial would be great or even just to possible tools.
Use the class http://developer.android.com/reference/android/location/LocationManager.html to obtain the device geographical location
A Caltrans planning grant went towards creating an Android app called CycleTracks that does all of your bulleted items except the last one about points of interest.
You can download the source code here: http://www.sfcta.org/downloads/cycletracks/CycleTracks-android.zip
I haven't looked at the license to see how free you are to use it as a starting point, but I have to imagine it might be helpful just to be able to look at it even if the license is restrictive.
You can read more about it at http://www.sfcta.org/content/view/666/375.
You don't need any extra tools. Use the GPS or radio cells to get the location of the phone. This thread explains how you can get the location:
How do I get the current GPS location programmatically in Android?
If you want to Track the users movement you'll need to run a webservice on a server and have the app report the location of a user at regular intervals.
Be careful though, if you don't tell the user this is what you are doing, and provide an opt out, you could be pulled from the market pretty quickly.
Be sure you aren't recording any sensitive information as well. Usually position, phone type and OS type is allowed but much more could get you in trouble.

Categories