Is there any way I can connect to a remote Neo4j server from an Android Project at all ? I have used several approaches: JDBC driver and through REST API using Jersey Client however none of these approaches are successful. All of these work in a pure Java project but fail miserably in Android. At this stage I lost hope that there exists a way I can talk to the database through android. Is that feasible or am I wasting my time trying to find impossible solution ?
If Neo4j exposes an HTTP REST interface, then yes of course you can access it from Android. There are many different ways, including HTTPUrlConnection and Apache HttpClient.
If you want to use Jersey, there's no reason why that wouldn't work. I'd start with one of the above first though to prove to yourself that the basics work.
Here someone as written a Java binding to the REST API.
https://github.com/neo4j-contrib/java-rest-binding
You can use (most) Java libraries in Android.
Related
So I have to build an offline project using MongoDB (with morphia), Java and React/Angular. I'm planning to work with react but all the solutions point to me using Spring Boot or Spring Data for this purpose. Is there no other framework that I could use to make this?
Its a very simple application where we need to list out some database entries and allow a user to make a request and change the entry values based on it.
I know Struts is also an option but remember that Im not actually going to deploy this online. This is like a show and tell to these lecturers on my own device.
NOTE I would have used Spring Data but as far as I know it doesnt have proper support for morphia? I could be wrong. Please let me know if it does
There are literally dozens of Java [micro]frameworks to chose from:
Vert.x
Javalin
Spark
Micronaut
Ratpack
Dropwizard
Ninja
Rapidoid
... and many more.
You can also try Play or Ktor or Grails. Or do some hardcore with Netty or Undertow.
Not to mention plain old servlets...
Vert.x in particular supports reactive MongoDB drivers: https://vertx.io/docs/vertx-mongo-client/java.
Nowadays more and more chat bots are being created, as the process is relatively easy if you activate a facebook developer account, and create a facebook page for this purpose.
Probably the most popular method is to using NodeJS - Heroku, as it is explained in the following article:
https://chatbotslife.com/how-to-make-a-facebook-messenger-chat-bot-in-1hr-af6bec5e7aec#.xqgu2lb46
After a research I found that making connection with facebook IS possible via Spring boot (as explained here: https://spring.io/guides/gs/accessing-facebook/ ) but I have not found any information or - even similar to the NodeJS - method to handle a messenger conversation using a Spring Boot server.
Is it possible to request and send facebook messenger messages from Spring Boot? I would prefer that over NodeJS, as I have a system already built in Spring Boot, and it would be much easier to integrate this feature there, than creating a new service, which would be then connected to the existing one. (even if in some cases I definitely would stuck with the 'microservice' structure.)
It is possible.
Cast a glance onto that project:
https://github.com/messenger4j/messenger4j-spring-boot-quickstart-template
Though I understand your reason why you want to 'keep things together', I definitely would recommend to separate things to smaller pieces when you can, as it is a much better strategy generally.
I would like to program a WebService embedded on my android device (not the client part).
I've been evaluating Restlet Framework (Restlet) but i don't know if I go on the right way.
What do you think? Is that framework viable for my goal?
Any suggestion is welcome!
Thank you so much!
Regards.
You should check whether Restlet is compliant with android,
not just from server side code, but also from client side code (respectively).
This means for example that every JAR that Restlet framework depends on has to contain code that is compliant with Android.
An alternative approach would be to run a simple HTTP server on your device, for example the following nano http server I read about.
Another interesting project you should check is jetty for android which will hopefully give you support for servlet API as well.
Yes, you will have to spend some time on developing mapping requests and building resource handling logic, but that task is not that difficult:
A. You already have Android code for JSON processing -
For example, look here
B. Using the Java URL object you can analyze the URL of the request and understand which resource you should handle (i.e - add resource to collection, fetch collections, etc).
C. After performing the CRUD operation (i.e - store your resource in some SQLIte table), you can send back a response, and once again, composing JSON if needed is easy.
I first successfully connected via JDBC to a remote MySQL server with a Java program. That I understand how to do. My goal is do the same thing with an Android application and display data from a remote MySQL server.
Question 1 Can someone explain the process outline to do this via Android ? (I am new to Android and am a little stronger with Java, could use a little guidance).
Question 2 I found this tutorial on javatutorialpoint.com titled: Android MySQL Client but it wants me to use the SOAP API. Not sure why, if someone could explain.
Not asking for it to be done for me. I just want someone to outline the main steps in order to make it happen. Just the process that needs to occur is all I am asking.
Question #1:
I stumbled upon this link some time ago:
http://docs.oracle.com/cd/E17076_02/html/installation/build_android_jdbc.html
(Disclaimer: I haven't read the whole tutorial myself)
It tells you what's needed for getting the MySQL connector to work with Android.
Basically, from what I know, the standard MySQL connector for Java, doesn't work out of the box for Android. You'll need to build it on your own.
After building the connector, you can include it in your Android project, precisely the same way as you do in a normal Java project.
Your Question #2:
SOAP is a mere layer of abstraction, for not working directly on the database. If you use a layer like SOAP, you can swiftly change your database layer without affecting much of the communication from-and-to the Android app.
You can use the same methods in Android you used in Java (Android is written in Java, after all, and you are able to use the majority of its libraries in android). However, be careful with doing so.
It would probably be better from a security standpoint to set up a web service to communicate with the database, rather than you allowing your android app to communicate directly with it, which would actually require you to embed your mysql username and password in the app code. A SOAP or RESTful web service could enable your server to communicate with the DB and then serve the data from it to your app.
It's done the same as in Java (Android apps are build in Java unless you're using the NDK).
You don't need SOAP if you only want to get data from a remote DB.
See this question.
2 month ago i started to develop an android application which needs to call remote methods and receive complex objects (custom objects with custom feilds in it) from a server.
My friend and I splitted the work so he worked on the android client and i on the server.
Before we started, we built the base interfaces which provide the functions that the client needs from the server, so my friend can program easly the application (by using fake classes as implementation for the interfaces), and after i finish the implemntations of the interfaces in the server-side he will make the connection and call the functions from the server and not from the fake classes.
Now the problem is that we can't find a way to pass those interfaces from the server to the client.
We tried to use java RMI, but we faild because android doesn't support java RMI,
then we tried to use JAX-WS (with tomcat 7) and we also faild because JAXB can't handle intefaces. (-you can see more details here about jaxb issue-)
My friend and I feel really lost.. we don't have any idea how to pass those interfaces between the server and the android client.
Is it possible what we're trying to do? if not,
what other options avaible for us to call remote methods and receive complex objects from the server?
Thanks!
You can expose webservices on the Server, so the client can interact with the server whenever its needed that might be quickest solution.
Or you can write a kind of servlet programming to get the json request from the client, process it and send the json respoonse back to the client. If the application is data intensive, the JSON helps you a lot
Not sure if this is too late now (after 2 months of development), but there are frameworks that should make RPC easier for you (take care of linking both ends). Two I know of are Apache Thrift (definitely usable with Android - there are apps that use it) or Apache Etch (possibly).
Apache Thrift:
http://thrift.apache.org/
Apache Etch:
http://incubator.apache.org/etch/
Blog about Evernote choice of Thrift:
http://blog.evernote.com/tech/2011/05/26/evernote-and-thrift/
If your application is limited to communication between Java on the server and Android (no other clients e.g. IOS) then an easier RPC path compared with IDL based solutions is to use jsonrpc. This solution provides both server and Android client components. It is extremely easy to implement on both client and server. One limitation is that byte arrays have to be encoded because the JSON transport does not support binary.