I want to use google map API for my desktop application. The application will be totally connected to the internet.
While I was searching some research notes about this implementation. I found a ideal site with the configurations, but it has some java files to be downloaded, but when I tried that website its not loading. which is swinglabs.org
http://today.java.net/pub/a/today/2007/10/30/building-maps-into-swing-app-with-jxmapviewer.html
Any other options of doing this api implementation to my desktop application? and one more thing. I tried downloading the google api. even it ask a url.We have to provide a url then only we get a key to download it. And the api should run in that specific url. Otherwise, its not working. How this appears to a desktop application
any ideas welcome.
At the moment it is illegal to use the JXMapViewer with google maps, reason being that this component requires direct access to Google's tile server. According to Google's ToC:
Can I access the Maps and Satellite
images directly?
You may not access
the maps or satellite images through
any mechanism besides the Google Maps
APIs (such as the creation of your own
mapping API or the use of a bulk tile
download script). Your application's
access to the tiles will be blocked if
it accesses them outside of the Google
Maps APIs. See section 5.3 of the
Google Terms of Use for more details.
More information can be found here. You should be able to download the packages from here. They moved the domain and many sites still point to the old domain, hence taking you nowhere.
Currently the only way you can use the JXMapViewer by displaying maps from OpenStreetMap.
You can, however, display static maps on your application. You basically build a URL. This tutorial should give you a basic idea on how to be able to build a URL to be able to request static maps. You then use an HTTP Get request to get the image back.
Last but not least, Google is planning on allowing direct access to their tile servers, but this might take a while.
You can use google maps in desktop applications.
For this you need to embed a browser in your application and then open up html/javascript files which render a map.
Different languages and api provide ways to embed a browser. For example wxwidgets/c++ has a widget called WebView which allows to embed webkit on linux and trident on windows. Similary mfc/c# also allow the same. So checkout how to embed a browser into your application.
The api should also provide a way to execute javascript code in the embedded browser. Then you can modify the google map through the code of the application as and when needed.
I have a desktop application that calls a similar API. They require the API calls to come from one particular domain (and URL). So, I have the desktop app contact my own web server, which calls the third party API and returns the results.
Related
How can I make an online server to access API's and handle requests? Then how can I have my android app access this online server to make requests?
I have an android app that I am building for a school project. This app will need to use multiple APIs to gather information to display to the user. However I don't want to allow people to decompile to source code and take my API keys. My plan is to build an online application that will do all of this work on the server side. This way the user only submits a query and the server sends information in response to their request. This will speed things up for the user and keep the keys from being accessed by other individuals.
Steps I think I need to take.
Set up server to access the API's
Make app access online server through HTTP requests
3....
4...
I have a very general concept in my head, but I'm not sure where to begin. If I'm wrong on any part of this question please correct me.
I do plan on moving this to the app store in the future.
edit: Do you know of tutorials that show the building of the API and then loading it to Amazon AWS or another server?
There are many options when building restful services for api consumption. You could start with php, which is the easiest to start with. Here is a nice tutorial that takes you through the initial stage all the way to the end of building login system for android using mysql and php as the server language. It contains the barebone details of setting up the infrastructure and logic. I think from there you manipulate and go further.
https://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/
check out java rest easy, it is a nice tool to use to build web API's. You can host it for cheap at red shift or amazon using their pay what you use billing.
The cheapest way for you to host your REST API is to use Amazon's API Gateway. You pay for what you use and pay nothing if it is not being used. API Gateway plays very nicely with Amazon's Lambda service that allows you to run discrete code units - again, you only pay for what you use. Lambda itself plays nicely with Amazon's pay-as-you go NoSQL datastores (SimpleDB and DynamoDB).
i need to implement a desktop application (possibly with Java Swing) in which i can implement maps (not only Google maps but also other services) in two ways: online and offline. Online means the application calls API services by internet, while offline means that i have maps services saved locally and i can request for them also without an internet connection..
Specifically, my application has to draw a polygon on the map (with the API) and do some computations on the background..
Given this, what services can i use to implement at least one way (online or offline) or both? Thanks so much
Initially, google maps only allowed online use of it's API. Any attempt to save maps for use offline was an offence.
I know that the current google maps app (Android / IOS) supports storing maps offline but I don't think this is open to third parties such as yourself. As with everything google, they want your data so they won't let you use the maps offline since they can't see how it's being used.
I've seen many offline mapping applications based on open street map. These maps are open source and free to use as you please (online / offline).
Currently I have a very basic desktop Java application in Eclipse that is meant to add entities to an existing project's datastore on Google App Engine. I have it all setup right now but since I am new to working with Google App Engine, I have no clue on how to get the application to send the Entities into the datastore of my existing project.
I tried looking this up online but most of what I found was for making java web apps. My goal is to have the application running as its own application, not through a browser.
So, what do I have to do to make the application connect to my GAE datastore? Is there some code I need to type, or perhaps some xml file I need to have within the project? I am just using the Java Eclipse plugin for Google App Engine.
Thanks for the help!
Based on the language of your question, I think you really need a big-picture sort of answer, rather than any specific code. Therefore:
You have a desktop application. This runs on some desktop computer.
You have a Google App Engine application with its data store. This runs in Google's data centers.
These are not the same computer. Therefore, they must communicate over the network in some fashion — that is the missing piece you're looking for.
Since GAE is designed around doing web applications, I recommend you think of this as a “web service” situation — that is, your desktop application makes HTTP requests to your GAE application. (The situation is simplified over the general case because you are writing both the client and the server.)
I recommend you read about designing simple web services and do whatever seems to fit your application.
One important warning: Unless your GAE application only ever has one user, you must not simply write a bridge that gives access to the data store over HTTP, because then anyone can make arbitrary changes to other people's data. As it is said for multiplayer game design: don't trust the client — that is, only accept network requests that make sense according to the rules of your application, and do not expect the client to enforce those rules. This is because anyone can make requests to your GAE application using something other than your desktop application, so you must assume you could receive arbitrary requests. This is the fundamental nature of the Internet.
For example, in the simple case of a multi-user application whose users do not interact with each other using the application, this means that every request that, say, updates a record, should only update a record which belongs to the logged-in user, not one of any other user.
For anyone that gets this problem in the future, I got an answer to it. I just tried experimenting around with the project settings and found it. So as it turns out, after you have installed the GAE Eclipse Plugin, you can just right click your project folder in the Package Explorer, go the Google sub menu, then click on App Engine Settings... .
From there, you need to check the Use Google App Engine checkbox, then in the deployment section, just fill in your project's Application ID. Your project's application ID can be found under the Application Settings tab of your project's online Google app engine dashboard. It is listed there as your Application Identifier.
Turns out that for me, I will need to find a different solution as you cannot integrate GAE with a desktop application that uses the Java Swing library. Bummer :/
I'm helping develop a Java Web Start* application and am looking for ways to retrieve the user's location. An ideal solution would be something like JSR-179 which uses the best available hardware, but failing that then interfacing more directly with GPS hardware (if available) is one possible option.
Has anyone out there implemented something like this, and if so what approach did you take?
Since I haven't been able to find any JSR-179-like APIs out there, I'm investigating a couple of potential solutions, but they both have drawbacks:
Read GPS data from a (virtual) serial port.
Would only support hardware which interfaced via a serial port.
As far as I'm aware we can't automatically detect which port to use, so would have to allow the user to configure this. This would be far from ideal!
Make use of HTML 5's Geolocation API, interfacing with it via the ScriptEngine API.
I've never used either of these before, so I've no idea how feasible this is at this point!
Can anyone suggest other potential approaches, or tell me if either of my ideas are dead-ends?
*Though we currently use Web Start, and would prefer to continue doing so, we might consider dropping that in favour of something like getdown if that would allow us to implement geolocation.
Edit:
An additional requirement I didn't originally state is that we need to be able to track the user's current location, not just the location they were at when they launched the app.
Instead of deploying your application as a Java Web Start application you could deploy it as an applet. In this case it becomes possible to call the browser API through LiveConnect.
The ScriptEngine API will not help you because it's not linked to the browser supporting the Geolocation API. Also, a Java Web Start is completely independent from the browser (you can close the browser and the application will keep working, unlike an applet), so it's not possible to call the Geolocation API.
A solution would be to provide the location parameter to the JWS application via an external mechanism that would use the HTML5 Geolocation API. For example, instead of calling directly the JNLP file for launching the application, you would load a page with a JavaScript snippet that query the Geolocation API and then call the URL of a JSP file:
http://www.example.com/myapp/launcher.jsp?latitude=....&longitude=....
The launcher.jsp page will generate the JNLP file with the appropriate parameters:
<resources>
<property name="jnlp.myapp.latitude" value="<%= request.getParameter("latitude") %>"/>
<property name="jnlp.myapp.longitude" value="<%= request.getParameter("longitude") %>"/>
</resources>
And you can then retrieve the coordinates in your application as system properties.
This will work if you are only interested in the static location of the user. If the user moves you won't be able to track him.
A question and idea more than an answer, but here goes.
What hardware are your users running on? I am guessing a laptop.
Could you insist that the user also has a smartphone and write a small app which would query their GPS position and report it to your main app?
(They may have smartphones already so this may not be an excessive requirement)
This reporting could be done by the phone uploading the position to a central db on the internet, and the app downloading that info, or it could be sent from the phone to the laptop wirelessly somehow.
I have used WURFL Java API (also using the web browser patch) to create a standalone application for device detection. When a user agent for mobile app is used , it returns generic web browser (or blank field if web browser patch is not used) for Android and application version as device_os_version for Apple iPhone app user agents. The algorithm used in the new api as described in new api algorithms should give correct results but its not!
Can anyone help me how to tackle this problem?
I've not used the JavaAPI myself, but I have had good luck so far getting support directly from the WURFL community forums. They have a subforum for API problems. I would suggest making a post there, including the user agent string that's giving you problems and a sampling of the source code you've attempted to use before.
http://www.scientiamobile.com/forum/index.php
Sorry I couldn't give you a direct answer.