I will take events from some websites. Then will record them to database and show the user when runs the app according to her location.
Using wamp sql database is an old and deprecated way? Like this
http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/
I will only record event names, location.
Should i use a database, right? I will record longitude and latitude. When user runs app, i only retrieve the events according to her locations? For example +100 - 100 meters to the location, calculating longitude latitude.
I am parsing the information from websites. I already did this in java eclipse. I used Phantomjs and jsoup. So, can i migrate them to android without changing or do you suggest anything different?
I really searched those questions but could not find such satisfying answers.
I guess there is no need to use database. You could just get the location of the device. Make a http query to your website. Parse the data by using some method and then you could show to the users.
For parsing i always use OKHTTP with jackson for parsing json data. It will be very convenient assuming your response data will be in json.
You can use jsoup in android. But not phantomjs.
Related
I'm trying to download the 'Top Queries' CSV and am having a few issues. I started off doing this via Python and I was getting GWMT to send me a CSV with all the results (and also made a script to automatically place it into an SQL database) but stopped using Python for this problem when I realized that I could not set the date range. That would be the first question (as it would make the next question irrelevant):
Does anyone know a way to query specific date ranges using Python to access the Google API? Like I said, I can download everything else but cannot set the date range (automatically gives you a month's worth).
Secondly, in term of the PHP solution, I setup XAMPP on my computer and got that working swimmingly but as soon as I started trying to download CSV's (using code from this link) but every time I load it in the Browser, no CSV is downloaded. There are few reasons why I think this might be:
API authentication not working
Something on my computer not allowing csv to be downloaded
Credentials problem in WMT
Weirdly enough, when I did the OAuth2 yesterday for Python, it worked but then when I started working this morning, the credential had been deleted? Should I just create and go through the same authentication process for Python (which gave authorization for the web property) again to allow the csv to be downloaded?
Anyways, any help on this would be greatly appreciated as the alternative is manual pulling and loading into SQL!!!! :S
The script you linked to is not supported by Google, never was, and it relies on Oauth1 which is deprecated.
Currently the only official way to download Search Queries data is via the Search Queries API, although it's in limited mode, meaning we're (Google) testing it with people who showed interest and subscribed when we announced we'll launch it in limited beta. Once testing is done, we'll very likely launch it for the general public, but I don't have a timeframe for that.
You can find the currently supported methods and more information about them in the API Explorer for Search Console (former Webmaster Tools)
For webmasters.searchanalytics.query it currently says:
[LIMITED ACCESS] Query your data with filters and parameters that you define. Returns zero or more rows grouped by the row keys that you define. You must define a date range of one or more days. When date is one of the group by values, any days without data are omitted from the result list. If you need to know which days have data, issue a broad date range query grouped by date for any metric, and see which day rows are returned.
I am working in an Android project designed for doctors. Doctors are required to authenticate when they open the app for the first time.
This authentication process is done through a HTTPS connection, using PHP code in the server-side that returns JSON code to the app, letting it know if the connection has been successful and, if it is the case, it also returns that doctor's list of patients. Let me show a piece of JSON code that would be returned in case of a successful log-in:
Obviously, if the log-in were unsuccessful, the "listOfPatients" attribute would carry no data. After the server generating this JSON code, the app would simply read through it using a JSON Parser.
Now imagine the doctor doesn't have just 3 patients, but 100 patients. And each patient doesn't have just 3 attributes ("Age", "Phone", "Smoker") but dozens of them appropriately nested where required. We would then have a somewhat large (but maybe not too complex) JSON code to read through.
In this project I am designing the Client code (i.e. the Android App), whereas the Server code is written by other guy. He is asking me how I'd like the server code to be written in order to facilitate the "Android Client - Server" interaction and achieve the best, smoothest user experience possible.
I answered (this is the really-short version of my answer; don't concern about the server-side-code security since it is not the goal of this question):
Create a login.php that allows for POSTS queries. My App would send "user" and "password" and the server would compare it with the database.
The server would then generate appropriate JSON code depending on the success of the doctor's log-in request.
The Android app would simply parse this JSON and display it to the user in form of list-views, and so on (the way I display this data to the doctor does not matter here in this question).
I was wondering two things:
Knowing that the JSON will contain hundreds of attributes, how efficient is this code? Is there a better way to achieve this functionality? How would you do it?
The vast majority of these attributes' values will change on a daily basis (for example, "bodyTemperature" or "bloodPressure"). Furthermore there will be "importantNotifications", where patients would notify their doctors in case of an emergency situation. I don't think it would be efficient to go through the entire process ("server create JSON ==> client read JSON ==> client display JSON") over and over again, minute after minute, hour after hour, day after day. There must be a better way to do it (maybe local storage? I would then have to discern which attributes to read only once a year ("age"), once a month ("phone"), once a day ("bodyTemperature") or every 30 minutes ("importantNotifications"); How could I then discriminate which values I'd need to read from the JSON in each session?)
Now you will be likely using GSON to parse the response from the server. Also you might define default values and tell the server not to return anything that is equal to default values like smoker - default NO (minimize the ammount of data to transfer). You are highly likely to display the patients in a ListView or RecyclerView.. Google a bit how to implement lazy loaders, meaning you tell the server to return just a few results, not all and when the user scrolls to end, you ask the server to give you more if there are any.
Also using caches on Android is a great way to save a couple of unnecessary requests to the server. You define of how long a cache is valid, say 5 mins and if you want to repopulate a list, check if it's still valid. But you should always leave a manual refresh option, SwipeToRefresh is a great and simple way to do just that.
Hope somebody else can have something more as I am interested in this also.
So the Google Map API tutorial Creating a Store Locator with PHP, MySQL & Google Maps takes the output from the mySQL database and processes it into XML using php (excuse my amateur terminology).
My simple question is, is it absolutely necessary to output mySQL data into XML?
Is there no other way whereby the data can be grabbed from mySQL and converted into variables for use in js functions elsewhere? with the example, anybody is able to run a simple query and see all my data? It doesnt seem very secure and in which case why not just simply echo the mySQL query results?
While it is not strictly required to convert the data into XML, this standard format is well suited to represent structured data. But you may very well decide to use JSON for example, or any home-brewed format of your liking. Do not reinvent the wheel though.
The second issue you are rising is not related to the output format, but rather is a problem of access control.
As far as I can tell from a very quick glance at the tutorial, indeed anyone could connect to your server and extract data.
In order to limit access to the data (i.e. limit access to the script phpsqlsearch_genxml.php), you could, for example, verify the presence of a session cookie in the ajax request. Implement such a check at the very beginning of the script, and perhaps generate an error if the user is not logged.
Im developing a very simple native Android App containing a simple Main Menu with the Today, Yesterday, This Week, This Month and Search by Date options.
(I bought the lynda course: "Building Android and iOS Apps with Dreamweaver" with HTML5 and with the design and functionality of the app im not having too much trouble.)
What i entend with this app is this: i will write famous people profiles every day (between 1 and 5). So when people click (for example) in the Today option they will access to the profiles list that i have created for today (Yesterday and others is a check on the past written profiles from database).
So imagine that some android user clicked on today and will be presented with 3 profiles options ("Brad Pitt", "Shakira" and "Cristiano Ronaldo"), that i need the app to access my server database to update it (the "Today" profiles).
and finally...
Before the questions i want to say that i have searched on stackoverflow and found very similar answers, but im a novice on programming and when i'm reading the answers they can differ so much that i got confused going link on link documentation.
The Questions:
I want to create somekind of method that i could have a template with different profiles (Singer, Politician, Soccer Player) and click on somekind of button to start a new profile/article with Born Date, Occupation, Nationality, Biography and etc. Its this possible? How can i do it and in wich programming language?
What kind of server and what kind of database do i have to create and how to configure it to send the info to my app?
There is any server specifications that i must have for this to work the smoother and easiest possible? For this issue price is not a problem.
What kind of code should i write on my app so that it could get the "3 profiles update for today" from my website?
Its possible to show me some code example that would work with this simple step in my app of selectiong "Today" button on main menu and the app check for new profiles for today and present the user as an option? Because if i had this bit of code i could understand better how to do the rest with the profile details on the "Brad Pitt" option for example.
Hope you understood my questions. Thanks in advance. Have a nice day
Assuming that you're using the Phonegap Framework to develop your application, I would do it like so:
First of all get a Server/Webspace capable of running PHP Scripts and a MySQL Database.
You also have to rethink the way these applications work, for example you can't
configure it to send the info to my app
You need a Server Side Script (i would choose PHP for this, it's easy to learn and available on almost every Server). This PHP Script then queries your MySQL Database where all the information about the people is stored. On thing to remember is that your Clients will poll the server and request the content, you're not actively sending anything to Clients unless requested, that's just the way how HTTP works. The interface your Script is providing there is called a REST Interface.
Have a look at the link, it explains everything pretty good. Your output format should be JSON this makes it really nice to work with in the Client App later on. To do things like "what was posted today?" Have a look at how SQL Queries work and implement it in your Script.
Now for the client you can access this data by using JavaScript, most likely jQuery to simplify everything a bit. Use the jQuery $.getJSON function to access the data provided by your REST Interface. Now you can use basic jQuery to wrap this data up with HTML to present it to the user. I know that this is not "example code" or anything you requested, but it should point you into the right direction on how to achieve something like you want to do. Just do a google search for all the keywords listed above and keep reading about it, then you should be able to build a app like that.
hey guys i am developing a final year location-based project(gps) in android.I have to create a server using php and mysql which contains name and location(in latitude and longitude) of important hospitals in Mumbai.The android client should be able to retrieve the the latitude and longitude of locations in mysql(external) database and then plot it on a google map.
Could u plzz tell me whether this is possible?If yes, then how?
Any help would be appreciated....cheers
Your projject would in fact consist of two application. A client running on android, and a server php-mysql application. The client would most likely talk to server using standard http requests.
What is the reason for using the PHP/MySQL combination to achieve this? Unless the list of hospitals is very dynamic it would be far more convenient to just but the data in an SQLite database that Android comes with.
If this is no an option I would put up a simple web service from where you could retrieve your data.
Try this method out. I will be using this method for the current project i am working on.
You basically create a php script on a server and use http posts to send the data to the script, read the tutorial linked below for better explanation.
mysql/android tutorial