Injecting items in Android browsers caches - java

I am currently trying to find a way to programatically inject items into a mobile browser's cach on Android devices. The browser type doesn't matter, it can be Firefox, Chrome, Android's built in browser, etc.. Is there any documentation or examples of ways to programatically inject objects into the browsers of Android devices?

Not really an answer, just a heads up. Seeing that your question is tagged java, I assume you want to do this from an application, and not from the browser. I'm pretty sure that's impossible, because each Android app is running in it's sandbox. Communication between apps is done through Intents and IPC. In both cases, you are limited by what the target app is offering support for.

You can use proxy, to get this structure :
Client => Your APK => Server
(Like this application).
With your APK you can choose file to send.

Like already mentioned by Corneliu, its impossible for an normal android app to write into the data section of another app.
Although it should work when the phone is rooted. Apps like TitaniumBackup which require root can read and write the data saved by other apps. You can use TianiumBackup to make a backup of the browsers and look in the *.tar.gz file for the internal data structures and the SQLite DB files...

Related

Same Sencha app for web and mobile

Query is : I have a current web application in place to provide me data in a list which is built using java and ui is built using jsp. I want to design a mobile app in Sencha to perform the same task and simultaneously want it in desktop using Sencha/ExtJs.
Now I am confused in following manner :
Do I need to create separate applications for web app and mobile app?
For the web app I need to load a separate set of files whereas for the mobile app it is different. If the application is one then can I do this?
Also, all the java files which I am using for the getting the list data, should be in same code base or separate?
Thanks in advance.
Sencha is a mobile app development framework based on HTML5 and query. So the controls and views are basically designed for mobile screens. But it does not stop you to display the same content on normal desktop browsers. Although what looks great on mobile may not look that good on a browser and vice versa.
Do I need to create separate applications for web app and mobile app?
Not really, everything can be same, views middleware and even backend. If you can design a UI that may look both on mobile and desktop then you are good.
For the web app I need to load a separate set of files whereas for the
mobile app it is different. If the application is one then can I do
this?
As I said above, except UI nothing should be a concern. If you want different look and feel for web and mobile then just create different HTML files for the said purposes. But you can use the same backend logic.
Also, all the java files which I am using for the getting the list
data, should be in same code base or separate?
Generally dynamic web applications fetches the data from backend servers using ajax/http service calls. You may manage the code in a single project or can divide it in logically smaller projects for better management. Maven should be a good choice to manage your projects.

How do I connect my Desktop Java Application to an Existing GAE Datastore?

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 :/

Retrieving geolocation in Java Web Start

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.

Better way to develop a remote database driven android app?

i have a wordpress blog hosted over my personal shared hosting.Now i want to develop an android app for that blog so the users can use the mobile app to see what i am writing on my blog.
Like for example you can take mashable.com android app.
so basically i have experience in programming android aap but i am just asking this so i can code it in a better way.
i have 3 idea to do this now:
1.Use rss feed of my blog and parse it and display the contents but it has a issue that rss only display most latest contents.So whether i need to store the feed contents timely on android device so a user can view the previous most content also.
But i think it's not a good idea because it will unnecessarily increase the size of database and make diff copies on every device.
2.Just simply use complete java code to pull data from my web mysql database as per the user request and just display it over the screen without storing it locally on android device.
3.Develop some sort of API solution on my web server then send the data in json or xml format so i can use it on my android device(via java) without bothering to connecting to mysql server as a core part because that part already done by on web server and my api already sending data in required format.
So these are 3 idea i have now.So please suggest me a better one form these three or you can give any other idea.
I am asking this question because previously i never programmed this sort of mobile aap where i need to pull the data from remote server.
-Thanks
You can simply install WordPress Mobile Pack to display Mobile site of your wordpress blog/site
Or
You can check this link to find out other plugins: 11 Ways to Create a Mobile Friendly WordPress Site
Now, If you want to create an app then you can simply implement it by using WebView.

Java Web Start - Does it work with Android?

As the title says, is deploying/using applications through Java Web Start a viable option? I found a few posts online from years ago saying that the JavaME applications are only available.
No, it's not an option. Android has an Application Store (called Android Market) that serves a similar purpose: managing applications install, updates and versions... So, technically, you don't need JWS.
Why not just host the .APK file locally on your lan on a webserver and allow people to download it from their browsers?
I believe the only way to get automatic updates like webstart is to use the android market. However, if you just want to deploy your app in your local lan, you can put the app as a link on an internal web server and have people navigate to it using the browser.

Categories

Resources