[Q] Just a question about servers communicating with android - Java for Android App Development

Im planning on building an android app. Its like a 'mini' social networking site that users can upload their pics, messages etc but im having trouble knowing how to 'start off'..
Servers, SQL, PHP and those types are not my thing, i have never came close to them as I have never done anything relating to servers but now I need to get close to them.
This is where im having the confusion:
Should I build a website that is the social networking site and store everything in the server that the website it connected to and then from the app i build, the app can fetch data from the website (or the server if thats possible) OR can I just directly build the app and make it communicate with the server so that gets rid of the issue of building a website.
Ive done a little research and have gotten some information but not a clear answer. I think my server will be using SQL so will the app be able to communicate with the database in the server directly or do I have to create a middleman such as a PHP/XML/JSON server for the android app to understand the SQL server since this is probably the common answer ive gotten when researching about android communicating with databases? (http://fahmirahman.wordpress.com/2011/04/21/connection-between-php-server-and-android-client-using-http-and-json/
Which approach is the easiest since im completely new to server languages (if thats what you call them).
Thanks for the help.

Hi man!
BTW the easiest way is to setup a PHP page on a server which sends JSON objects when data is requested by the client. Of course if you're good enough you could create a REST API for your server. After you get data from the server simply load the objects via a http/https request via your client.
I strongly recommend you make the API for the same. I'm doing an Android project which involves the same.
Sent from my Nexus 4 using XDA Premium 4 mobile app

boggartfly said:
Hi man!
BTW the easiest way is to setup a PHP page on a server which sends JSON objects when data is requested by the client. Of course if you're good enough you could create a REST API for your server. After you get data from the server simply load the objects via a http/https request via your client.
I strongly recommend you make the API for the same. I'm doing an Android project which involves the same.
Sent from my Nexus 4 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Oh ok. Thanks for the reply. Right now, im learning SQL since thats what most servers use. Then I'll probably get a server and experiment with it, although I have no idea on how create an instant messaging app Im pretty sure theres guides on the interwebs though

Don't forget to make APIs so that you don't have trouble figuring out client side programming. It will save you a lot of trouble.
Please give a thanks if you think this post helped you!
Sent from my Nexus 4 using XDA Premium 4 Mobile App .

boggartfly said:
Don't forget to make APIs so that you don't have trouble figuring out client side programming. It will save you a lot of trouble.
Please give a thanks if you think this post helped you!
Sent from my Nexus 4 using XDA Premium 4 Mobile App .
Click to expand...
Click to collapse
Sorry but im a bit new to android programming. What does API mean? Is it like Android version 2.2, 2.3, 4.1, 4.3 etc? And how can I make an API?

TwilightLoz said:
Sorry but im a bit new to android programming. What does API mean? Is it like Android version 2.2, 2.3, 4.1, 4.3 etc? And how can I make an API?
Click to expand...
Click to collapse
Straight from*Wikipedia:
In computer science, an application programming interface (API) is an interface that defines the ways by which an application program may request services from libraries
Java contains many libraries in those packages (Swing, etc.), and*the API*is the interface by which we request services (perform actions, etc.).
Since we're using Java for Android we are actually using the Java API by using any of Java's classes. All of Android's custom classes like Activity etc are part of the SDK library.The API is just a hook so you can latch on to libraries.
So in fact what you can do to create an API is a whole different topic altogether.
I suggest you Google it.
I'm thinking maybe I'll write a tutorial on this on xda for all members amateurs or pros alike.

Yeah I think you should write a tutorial. It'll help the community.

Related

XDA II Interface with SQL Server CE as backend

can anyone here tell me or point me on the right direction on how to connect to a SQL Server CE database using an XDA II ? i want to create a database application that is working on the XDA II that uses SQL Server CE as its database. any help will be much appreciated. thnx in advance.
anyone here in the forum ...
that is actually a developer for the XDA ?
it's for both xda and xdaX
wallaby forums are only for xda and so forth
if you want to access a db using oleDB then which type of db as in access or mssql or mysql or.....
all comes down to the connection string
of cause the sql server will have to be avaible to the xda
as in you can access it using gprs or usb or bluetooth or wifi or....
Visual Studio.Net 2003 has support for developing against the .Net compact framework (I think you might need professional or above). This has plenty of information and samples for connecting to SQLCE.
You may be able to do it with the Embedded VB using a connect string but this is not something I have even looked at!
Hope this helps,
Denver
thnx for the reply
i am currently studying VB.Net and reading on some of the white papers regarding Mobile Development but i still have yet to find an article that explains/shows how to connect to a SQL Server CE database using VB.Net running on a PocketPC Phone (particularly the O2 XDA II). i probably need to do more research about this but if anyone can provide more insights regarding this, i would really appreciate it.

Android SQL Client

Hi All,
Does anyone know of a SQL client for Android? Just something for running basic queries when I need to check on a system and can't be arsed waiting for a computer to boot up. The databases I use are MS SQL Server.
I've searched about and can't find anything. I've also had a look at the dev docs for Android and it looks like it should be straight forward using the java.sql class but unfortunately Java isn't in my skill set at the moment and the day job & life in general doesn't leave me with much time to learn it.
If there isn't a program does anyone have any plans to write one ;-)
Cheers
Keith
Anyone ???
It'd be pretty darn insecure to open up your databases to use a remote client like that, why not just use something like phpmyadmin for it? It runs fine in the android browser and theres tons of alternatives that probably have iphone themes that would work great. Alternatively you could get debian set up and grab one of the hundreds of apps to do it in the repository
I need this as well. I'm constantly on SQL Enterprise Manager on my PC and when mobile, I have to teamviewer to my desktop and run queries there, which is such a torture.
I've bought RemoteDB, which I can't seem to get to work properly, I can't switch databases and the connection registry is very confusing.
Anybody?!
Also interested
I'm also interested in this topic.
As far as opening your db's up to the internet, that's a bogus argument. Anyone remotely managing enterprise databases will be using a vpn tunnel, and not the open web.
Having an Android app to connect to Microsoft SQL and Oracle would be extremely helpful. I've been trying to figure out how to mod Oracle's SQLDeveloper to do just that but without any success so far.
aSQL - Remote Control, new launch
Remote Control Client for Microsoft SQL Server 2005/2008/2008R2/2012.
aSQL - Remote Control Lite is a powerful Microsoft SQL Server client providing Access to your server in your Pocket. Access all of your databases, Jobs and Processes as well from your mobile device.Simple and Fast application providing advanced features.
aSQL - Remote Control Lite Provide features like:
- Providing connectivity to different servers on your Network.
- Ability to store Server Information for future use.
- Job START/STOP only a click away.
- Kill any running Processes From your mobile device.
- View Databases details - View File size.
Google Play Store link -
"market://details?id=com.sqlforce.aSQL"
SQL Client
Hi Guys
I looked for something like this for a while as well, and couldn't find anything that did what I wanted, so I made one myself
Key features I wanted are the following
Be able to connect directly to a db server. I used the jdts jdbc driver for Java to get this right
Be able to connect to any SQL Server db. I'll add support for Postgres and MySQL if this gains any popularity
List of all databases on the server (excluding system dbs) and allow you to quickly switch between them
List tables in the currently selected db, and generate Select statements for them
List stored procedures in the currently selected db, and pull the code for them so you can change it
Use a tabbed interface for the different sql queries, to allow you to run many queries at once
This is all done and works really well. Large queries take longer to run than they would on a pc, but they run nonetheless.
Let me know what you think, and feel free to suggest features. If enough people like it and use it, I'll bite the bullet and buy the developer so I can publish it on the Play store
I hope you enjoy it
ps. The installer is signed with the standard testing key, so you will need to go into your settings and allow applications from unknown sources
pps. I ask for internet access to get access to the network sockets, but dont actually connect to the internet.
danegoodwin -
I've downloaded it and played with it a bit - looks good. One feature I'd suggest off the top is storing the connection info. It's a pain having to enter the server address and username each time.
If you are still looking for a SQL client I had written one as well.
It should cover most of the popular databases and works well with tablets and phones.
SQLTool Pro
https://play.google.com/store/apps/details?id=com.nraboy.sqltool
I'm also open to suggestions and questions if anyone decides to give it a try.
nraboy said:
If you are still looking for a SQL client I had written one as well.
It should cover most of the popular databases and works well with tablets and phones.
SQLTool Pro
https://play.google.com/store/apps/details?id=com.nraboy.sqltool
I'm also open to suggestions and questions if anyone decides to give it a try.
Click to expand...
Click to collapse
so, this one does BOTH MySQL and MS SQL, and, your other one *just* MySQL ?
thanks, anyone
abbots said:
so, this one does BOTH MySQL and MS SQL, and, your other one *just* MySQL ?
thanks, anyone
Click to expand...
Click to collapse
Correct. The pro version will handle MySQL, MS SQL, PostgreSQL, Sybase, and Oracle up to version 10.1.
The MySQL version is strictly MySQL.
nraboy said:
Correct. The pro version will handle MySQL, MS SQL, PostgreSQL, Sybase, and Oracle up to version 10.1.
The MySQL version is strictly MySQL.
Click to expand...
Click to collapse
thanks for reply (and for nice app!)
nice, looks good... even better, seems to work well....connected to remote MySQL OK
suggestion: please auto-suggest correct ports for relevant SQLs
so, editing can only be done via queries ? (time to learn SQL syntax..?)
next, I'll try connecting to MS SQL, whilst I know a tiny bit about MySQL, I know nothing about MS, might be asking for help...
Nic,
need some help, if you can:
having issues with MS SQL, MS SQL is on a cloud server, for all I know, port could be blocked..
I've setup definition with port 1433, get 'failed to connect'
how to t/s outside of the app ?
should "telnet host 1433 " work ?
I'm getting
# telnet mssql2008.xx.yy 1433
Trying 202.111.22.33...
telnet: connect to address 202.111.22.33: Connection timed out
what else can I try ?
thanks for any pointers!
abbots said:
thanks for reply (and for nice app!)
nice, looks good... even better, seems to work well....connected to remote MySQL OK
suggestion: please auto-suggest correct ports for relevant SQLs
so, editing can only be done via queries ? (time to learn SQL syntax..?)
next, I'll try connecting to MS SQL, whilst I know a tiny bit about MySQL, I know nothing about MS, might be asking for help...
Nic,
need some help, if you can:
having issues with MS SQL, MS SQL is on a cloud server, for all I know, port could be blocked..
I've setup definition with port 1433, get 'failed to connect'
how to t/s outside of the app ?
should "telnet host 1433 " work ?
I'm getting
# telnet mssql2008.xx.yy 1433
Trying 202.111.22.33...
telnet: connect to address 202.111.22.33: Connection timed out
what else can I try ?
thanks for any pointers!
Click to expand...
Click to collapse
Hinting a default port is a good idea. I will see about adding in an upcoming release.
Yes right now anything beyond a simple select or delete must be done with a custom query. My goal is to make it more like the desktop editors, but since I am the only developer it might take a while. But I am not saying it won't happen.
If telnet is failing to connect then there is a firewall rule blocking your IP. Three things could fix this.
1. Add your IP to the database allow list (talk to the DBA)
2. If you can connect to the network the DB is on via VPN then you should. The db might be restricted to local IP
3. Use the SSH features of SQLTool to connect to a server on the databases allow list
You were smart to try the telnet. I would have done the same thing.
Feel free to contact me here or through the tools site. I'm happy to help
nraboy said:
You were smart to try the telnet. I would have done the same thing.
Click to expand...
Click to collapse
ahem, not that smart.....
forgot to specify sql type...... ooops
suggestion: don't allow save unless all req. stuff filled in...
OK, I seem to be in.
can I dump/backup with this app ?
thanks.
decent app, well done, wish you success in further development, if I can help in any way, happy to try
now I need to figure out how to dump this MS SQL into my Linux machine
abbots said:
ahem, not that smart.....
forgot to specify sql type...... ooops
suggestion: don't allow save unless all req. stuff filled in...
OK, I seem to be in.
can I dump/backup with this app ?
thanks.
decent app, well done, wish you success in further development, if I can help in any way, happy to try
Click to expand...
Click to collapse
Nice catch on the SQL Type. I will work to correct that.
For dump / backup are you referring to data or structure or both? Right now I have exporting DDL on my things to do list, but if you're referring to something else I'd like to hear it.
Thanks for the compliments on my app. I definitely want to hear more suggestions if you have them. Also please don't forget to rate well when you get a chance

VMware View Open Client port to Android?

I'm not a dev, so this is way out of my league.
http://code.google.com/p/vmware-view-open-client/
They have several clients developed for different *NIX platforms, so I was curious what would need to be done to port this to Android.
I have a View server I can test with, but it's not available to the public for testing.
Thoughts/Suggestions?
Kind of off topic, but I heard from someone who works for VMWare that they are releasing and version of VMWare for Android within the year!
I asked our rep, but no word. I'm presenting at our local VMUG tomorrow, I'll ask again then.
Bump
-------------------------------------
Sent via the XDA Tapatalk App
bump
We're running view 4.5 and still no Android client
Wyse PocketCloud does have a VMWare View client with some key limitations. Currently it requires entry of username and password in the configuration which means either created and deleting your profiles all the time or risking your credentials being compromised if your device is lost or stolen (only protected by the device not being rooted...!!!) Also, if you use RSA SecurID, your RSA SecurID username must match your active directory username otherwise it will not complete authentication. I have requests in on their forums for fixing both of these issues. If they do, it appears to be a very nice client.
I saw that in the market. Problem is it's $15, iirc.
Yes an Android client is currently in beta. I saw it at vForum. The reps reckon a couple of months.
vmwClient - vSphere Android client
Available on Android Market!
Please, search for vmwClient on YouTube and Android market.
Short URL goo.gl / YMbNm
Rewintous said:
search for vmwClient on YouTube and Android market.
Click to expand...
Click to collapse
It's nice to see the client, but what about a View Client?
Its available on the market
An updated version coming in couple of months

[Q] many to many user

hii all,
i am fresher in android app developer,i face a problem in connection many user to many user also role of admin.in this process. like example one user can send some text to other user but after confirmation of admin it will push the text to desire user.how can it possible globally without investing any cost in trial host.any code if possible . plz suggest me how its possible
You need to have a central server for what you want to do. You could setup the server on a small PC or Raspberry Pi. Its quite simple actually. The server needs to be connected to the internet.
Sent from my Nexus 4 using XDA Premium 4 mobile app

[Q] Problems with GCM

Hi guys, I have basically never touched android development before and still meddling around with some tutorials (and i really do not understand most as it is somewhat quite different from Java).
Now i have an project which i need to do basic to advanced development (i think its quite advanced).
I am planning to have an app that can receive a signal from the server that a order is done and it will vibrate or wake the phone screen up.
server would be running php, apache and mysql
1) i key in (or scan in) a string of numbers (tracking number etc)
2) In the server, an entry of this tracking id and its details should be already created in the mysql database with a column 'ready' with values [true/false]
3) when 'ready' turns true, I want it to contact the app. But i do not how to implement this part. I saw some articles talking about CGM but i am not sure.
4) it should be able to connect via wifi or mobile network or check connection to server
5) and how do i mark this order as done on the app-side,; if not it will keep polling the server for this tracking id
As you need both side communication.GCM CCS(Cloud Connection Server) is perfect for your needs.Check GCM CCS Docs.I hope it will help you.
mohitsinghs said:
As you need both side communication.GCM CCS(Cloud Connection Server) is perfect for your needs.Check GCM CCS Docs.I hope it will help you.
Click to expand...
Click to collapse
Which is better or easier?
Using CGM or set the application to poll the server if a tracking number exists?
For example is a PUSH or PULL recommended
sianzb0i said:
Which is better or easier?
Using CGM or set the application to poll the server if a tracking number exists?
For example is a PUSH or PULL recommended
Click to expand...
Click to collapse
I think GCM is easy to implement. If you are using android studio,you can add it easily. For examples you may see the sources of iosched and todo.txt backend example.
You should read the documentation and should go through the sources of iosched and todo.txt to see how easily it all happens.
mohitsinghs said:
I think GCM is easy to implement. If you are using android studio,you can add it easily. For examples you may see the sources of iosched and todo.txt backend example.
You should read the documentation and should go through the sources of iosched and todo.txt to see how easily it all happens.
Click to expand...
Click to collapse
I have helped a friend set up eclipse with Google App Engine, but when we were looking through, some of the features in the App Engine is not free (they have $300 worth though).
I will try and give it a shot first. Meanwhile I will also looking into polling the mysql DB via PHP
sianzb0i said:
I have helped a friend set up eclipse with Google App Engine, but when we were looking through, some of the features in the App Engine is not free (they have $300 worth though).
I will try and give it a shot first. Meanwhile I will also looking into polling the mysql DB via PHP
Click to expand...
Click to collapse
GCM HTTP: Downstream only: cloud-to-device.
GCM CCS: Upstream and downstream (device-to-cloud, cloud-to-device).
Thats why I suggested you CSS over HTTP. Note that Google AppEngine does not support connections to CCS so you need your own server implementation if you need both side communication.Otherwise you can try GCM HTTP with AppEngine.That all depends on your need and how you manage it. And If you are willing you may try Android Studio as it is almost stable now [1.0 RC2]. It is very helpful for Cloud Apps as it have builtin support of GCM over Eclipce. Its just my opinion. Happy coding.
mohitsinghs said:
GCM HTTP: Downstream only: cloud-to-device.
GCM CCS: Upstream and downstream (device-to-cloud, cloud-to-device).
Thats why I suggested you CSS over HTTP. Note that Google AppEngine does not support connections to CCS so you need your own server implementation if you need both side communication.Otherwise you can try GCM HTTP with AppEngine.That all depends on your need and how you manage it. And If you are willing you may try Android Studio as it is almost stable now [1.0 RC2]. It is very helpful for Cloud Apps as it have builtin support of GCM over Eclipce. Its just my opinion. Happy coding.
Click to expand...
Click to collapse
Does CGM always run in the background? like a service?
sianzb0i said:
Does CGM always run in the background? like a service?
Click to expand...
Click to collapse
An Android application on an Android device doesn't need to be running to receive messages. The system will wake up the Android application via Intent broadcast when the message arrives, as long as the application is set up with the proper broadcast receiver and permissions .
Click to expand...
Click to collapse
Thats what written in developer docs. I hope you got it.
I was trying to do a simple poll to the server via this simple example as shared in the forum
http://forum.xda-developers.com/showthread.php?t=2325799
I want to automatically poll the results, say every 5 seconds. Similar to setInterval() in Javascript.
Code:
ScheduledThreadPoolExecutor exec = new ScheduledThreadPoolExecutor(1);
final DoPOST mDoPOST = new DoPOST(MainActivity.this, /*editTextSearchString.getText().toString()*/"John");
exec.scheduleAtFixedRate(new Runnable() {
public void run() {
// code to execute repeatedly
mDoPOST.execute("");
}
}, 0, 5, TimeUnit.SECONDS); // execute every 60 seconds
This is what i added to my onCreate method but it only pulls the data for the first time and it doesnt pull anymore. Can someone please enlighten me?
Currently i am following this example to implement the CCS Push service
http://www.androidhive.info/2012/10...ing-google-cloud-messaging-gcm-php-and-mysql/
However, i couldnt get pass to the MainActivity without crashing the app
are there anymore noob friendly tutorial i can follow?
sianzb0i said:
Currently i am following this example to implement the CCS Push service
http://www.androidhive.info/2012/10...ing-google-cloud-messaging-gcm-php-and-mysql/
However, i couldnt get pass to the MainActivity without crashing the app
are there anymore noob friendly tutorial i can follow?
Click to expand...
Click to collapse
Log? Stacktrace? Run the app with your phone connected to the pc and usually Android Studio (hopefully your using it) will display any crash logs, from there we can help you find which lines your code is failing on.
Jonny said:
Log? Stacktrace? Run the app with your phone connected to the pc and usually Android Studio (hopefully your using it) will display any crash logs, from there we can help you find which lines your code is failing on.
Click to expand...
Click to collapse
Hi, i am still very very new to this.
Do you mean the logcat at the bottom?
i am still using the old eclipse juno bundle
I just rectified the crashing. But there are still some issues.
What I can do now:
1) I am able to register onto server
2) Server can see my device
What I cannot do:
1) I cannot contact the device from the server (nothing appears on the client)
2) on exit, the entry is still on the server. Its best to have a "exit" like how AirDroid does it (afterall I need user to confirm termination)
There only errors I get from LogCat is
Code:
12-30 22:49:27.536: E/GCMRegistrar(2614): internal error: retry receiver class not set yet
12-30 22:51:41.276: E/UnRegister Receiver Error(2614): > Receiver not registered: [email protected]
my android manifest is exactly the same as provided in the website (which should include a receiver, I suppose?), except I changed the corresponding package names

Categories

Resources