[Q] Problems with GCM - Java for Android App Development

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

Related

directpush protocol questions (exchange replacement possible?)

I am using mail2web free service to have my mail pushed to my WM5 device, but I don't like the idea of forwarding my private email to a company I don't know and I don't trust.
Normally I have my email at a home mail server running linux, and I was wondering if there's any open/free solution compatible with directpush technology to replace the need for an exchange 2003 server.
If it does not exist (i have been searching and couldn't find it), what is preventing someone of writing a free replacement? patent issues? authentication issues? I haven't sniffed the protocol yet, but I think it's impossible that no one has thought about it before... wouldn't you like to have your home imap server pushing your inbox to your PocketPC phone? If the protocol is not very obscure it should be easy to write a daemon that does it...
any thoughts or experiences?
Kerio Mail Server has the push compatibility.
Not free though, but it is an alternative to Exchange.
Their latest beta supports it. I reported a bug to them re: contacts getting corrupted but they say they fixed that in the latest build.
Can't retest now since that server is at another site I won't be visiting for a while.
Hmm the directpush "protocol" is pretty trivial it shouldn't be impossible to implement an open alternative.
I installed the latest Kerio MailServer yesterday. It works great!
Especially nice is that it runs on XP as well as Linux. Too bad about the price!
pof, have you had the chance to sniff the protocol?
not yet ivorh, been too busy with many other things, but this is still on the queue
sniffed
Heh, got bored so I setup an exchange account and sniffed the packets.
I'll go through them and post some details when I get a chance.
great ivorh!
Can you attach a capture in pcap format?
update and thoughts
Pof,
Hmm, ok a bit more thinking and digging and I'm not sure implementing an open alternative directly is that useful. Let me explain why:
The direct push only works with the outlook exchange active sync. When the device gets a "direct push" byte, it triggers a sync with exchange - the functionality is tightly bound together, and as far as I can tell you cant dip in and get it to do something else. So to get it working you would need a server providing the exchange http interface. This wouldn't be impossible but would need a lot of effort for little benefit.
I took a look at the open-exchange but that doesn't seem like an ideal solution since it would require a completely different server installed rather than IMAP or POP and as far as I can tell the Outlook connector isn't one of the open-source components anyway.
Now what I'm currently thinking would be a neat workaround would be to implement a custom "direct-push" to basically do exactly the same, have a client app on the device open an http connection to a server running, er, "OpenPush" if you like... use exactly the same technique of a keep-alive connection and occasional heartbeats, but on a message notification on the client get the client to trigger an IMAP pull.
Now this is where I need some advice.... I haven't done any Windows Mobile development yet, so can anyone tell me what sort of API is available to the messaging app? Can you/how do you trigger a mail pull? (oh someone please tell me it's not the same horrible old MAPI interface??).
PS I've just been capturing the data using a simple http proxy actually, I'll make some samples and upload them with descriptions.
Cheers,
Ivor.
http://www.ivor.it
Hi pof,
try funambol. It was formerly known as Sync4j. I once found it when I searched a complete sync solution that I could implement in the mailserver of my company. We are using kolab so I only tried the old Sync4j cause there is a kolab connector available for v2.3.
v3.0 implements (real) Push-Mail. Microsoft Active Push works with a http connection that is opened by the client. Funambol Push-Mail connects to a port the client opens. I didn't want to test any further cause I'm using a Wapflat and thus only get an internal IP and have to use a proxy.
http://www.funambol.com/opensource/
Perhaps this is what you are searching for
What I forgot to say: For funambol you install a java program on your phone wich will insert the received mails in your Pocket Outlook
Yay!
Pof,
Ha! Ok I've whipped up a version 0.0.0 of OpenPush. and it works rather nicely!
Basically it consists of two parts one is an app that runs on the mobile and operates in the same manner as DirectPush. It opens up a socket connection to the server and waits for a notification byte. If it recieves a byte it kicks off a mail retrieval.
The other is a daemon that runs on the server and watches for a change in the users mailbox if it changes (i.e. a mail has arrived) then it pops a byte down the socket.
It just needs finishing now...
Currently the daemon is just an app that listens on a dedicated socket. I plan on turning it into a mod_perl module and using http keep-alive in the same fashion as directpush.
Regards,
Ivor
ivorh, that sounds cool!!
I had a look at funambol but seems too 'bloated' for my needs, I think your OpenPush will be more tight to what I was looking for, so if you want a beta tester just send a link to it
Is there any specific server configuration? I am running a Gentoo server with courier-imap, sendmail and apache2.
Any chance you could extend the daemon so other programs can tie into your new-item notification? It would be cool to write a program that can keep files synchronized over-the-air with a desktop machine using push sychronization.
Pof,
Yeah it's just a prototype at the moment. So I need to write it properly next. At the moment the requirements are simply "perl". It's independent of mail system, it simply monitors a directory/file you give it for changes.
I'm going to write it to be a mod_perl module for various reasons, so the requirements will be just apache and mod_perl.
I'll hack some more tonight and try and get a 0.0.1 ready.
aatreya,
Well I'll keep it simple for now and just doing one job well.
Sound interesting to me.
I am new to this. Pardon me for some questions.
Do I need to buy a server at home?
This server can be any OS?
I am really happy to see some people trying to do just about the same I intended to. Today I started experimenting with Open-Xchange. I also have a Gentoo server that provides an ebuild for Open-Xchange, but after a bit of browsing it just seems like the thing MS Exchange and OX have in common is the similarity of their names. So installing OX and doing all the Exchange stuff with it does not seem to be an option.
So I looked into Funambol - sort of again. About a year ago I already tried to get Sync4J running to sync my SyncML phone. I did not succeed, but that just makes me eager to try it harder this time.
I also have to use a Proxy-Server for my GPRS connection but I want to have it working via WLAN, too, hence without proxy and the whole tunneling disco.
PS: Ivor, I am glad to meet You once again. When our roads crossed the last time, You just figured out how to get the CLE266 MPEG2 stuff working, respect!
A very rough pre-alpha version should be ready this weekend. I can only apologise in advance for the quality of my WM5 app!
But it's "working for me".
CWKJ,
At the moment the "server" is a simply perl app that watches for changes to a directory or file so its pretty portable. I run it on linux since that's what my mailserver is on.
As for needing a server at home... well its entirely up to you, really you want the server running wherever your mail is retrieved from.
If the app/system gets a bit more polished and advanced you might even find independent ISP's willing to add it as a service.
rabinath,
Heh! Small world.
I'd also like to be considered for Beta testing when available,
I run Ubuntu 5.10 Server at home, hosting 5 domains for myself, and would Love to not have to forward them through mail2web anymore as I don't like to reply because it will go through Mail2Web. I know I can create a separate "account" in Pocket Outlook but you can only have 5. I need more than that...
with direct push over the o2 wap proxy all https conections are closed after 2 min. this is becausse all 2 minutes a new sync is needed. This eats much battery. So why is it nnot possible to mak e a ppc client that just sends the current ip adsress to the client on the server. and the server just push the email to the known ip adress. The client on ppc just has to send a new ip in case it changes. this wouldt be much better for battery life.
Thats the reason Exchange-Activesync works the way that it does. The server sends out a text message that is handled at the system level on the PPC, and this is basically an instruction to sync with the server. No unneeded traffic just to check if there is anything new.
Most Celllar service providers are using NAT technology so reporting your IP address to a server and telling it to make a connection to that IP, would just be telling the server to connect to the "gateway" back into the Cellular network. A text message sent to what is called the "SMTP Gateway" for each service provider will get to the phone no matter if the phones IP changes.

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

VNC/RDP like server... to run on the phone?

I know this is a strange request, but I've needed this feature more than once.
I have been using WaveSecure for a while and it is fantastic, and has located my phone more than once (did I leave my phone at work or is it out in the car???) as well as retreiving SMSes when needed if I didnt have the phone, but the features are pretty much limited to that.
However, would it be possible to have remote desktop capabilities on the phone itself? Having the phone as the server and the desktop as the viewing client?
I understand the challenges, especially considering the fact that the IP addresses are dynamic. However that shouldnt be a problem.
I know leaving the server open all the time listening could cause a battery drain issue so sending a simple SMS command to open the program and begin listening as well as reply or e-mail the current IP address would fix this problem. In my experience the phone will keep the same IP address for a good few minutes so if a SMS command could wake up the data connection, and then somehow reply with the phone's current IP address that would be fantastic. If not would it be possible to port a dynamic DNS type of application to run on the phone similar to what you'd run on a PC if you have a dynamic IP address.
Traffic also shouldn't be a problem as my 3G connection on my phone uploads faster than my road runner turbo! I can regularly upload at 600-700kbps compared to my road runner's 512kbps. Plus you're only having to transmit 320x480 pixels at say 256 colors.
I know there were programs like this for win mo but how hard would it be for android?
This is also what I'm looking for. Screencast is cool, but I would love some remote android goodness. Kinda like Mymobiler and SOTI Pocket Controller.
superstudinor said:
This is also what I'm looking for. Screencast is cool, but I would love some remote android goodness. Kinda like Mymobiler and SOTI Pocket Controller.
Click to expand...
Click to collapse
Yeah, I used MyMobiler on my touch pro but that was only via USB (atleast at the time I used it)
BTT....
10char
anyone????
http://www.toremote.com/ i think you might want to look at this maybe its what your looking for. good luck
H4k3r4r34l said:
http://www.toremote.com/ i think you might want to look at this maybe its what your looking for. good luck
Click to expand...
Click to collapse
He's looking for it the other way around, at least if I am reading it correctly.
While I don't know of any pre-existing solutions, I can envision exiting tools that would collectively allow you to do what you want, there would just need to be some sort of wrapper / script that could pull it all together from different tools.
For example, PicMe, the utility used typically for screen shots, has a 'live' option to view/control your phone from your computer's web browser, and you connect to it over WiFi and/or the Mobile Network.
So, if there was a way to send a command to your phone to email you its current Sprint IP address, then automatically fire up PicMe (which can be hidden), you could then access the phone on the PicMe port (8082), to view the screen, see what is going on, or control the phone, etc.
What I don't know, and I haven't looked, is if there is any sort of scripting engine / macro tools that could allow you to utilize the existing tools to automate the various tasks. Would be cool though.
Wow, PicMe is awesome!!! However I can't figure out how to control it. I goto the live view and it does nothing.
Hmm, never mind. Re-booted and it worked fine! THAT'S FREAKING AWESOME!!!
Now, the only thing I'd really need is to write a simple application that will intercept a SMS (similiar to mobile defense or wave secure) that will e-mail as well as reply via SMS my current IP address, then launch the picme application. I say e-mail because if you don't have access to -a- phone, you can SMS via sprint.com and then check e-mail for the ip address.
THIS IS FANTASTIC!!!
Thank you sooo much!
poor_red_neck said:
Hmm, never mind. Re-booted and it worked fine! THAT'S FREAKING AWESOME!!!
Now, the only thing I'd really need is to write a simple application that will intercept a SMS (similiar to mobile defense or wave secure) that will e-mail as well as reply via SMS my current IP address, then launch the picme application. I say e-mail because if you don't have access to -a- phone, you can SMS via sprint.com and then check e-mail for the ip address.
THIS IS FANTASTIC!!!
Thank you sooo much!
Click to expand...
Click to collapse
Keep us updated please. Would love to have this figured out
let me know when you figure something out
If you haven't already finished the SMS intercept idea, I think the best way would be to incorporate it as some type of "firewall"... like those apps in the market. Just put some extremely obscure message into the SMS, something like "adsf;lkasdf jaeo8taupwetap0", and have the program only filter that. Just make sure the message is obscure, you don't want anyone's SMS turning it on/off!
Well, this may take some time.
I haven't studied the SDK for android yet, and its been a while since I've fiddled with java... soooo.... I dunno if this is even in my scope.

Advice on the choice of querying a remote DB

Hello everyone,
I come to you for some advice about an application I'm developing for Android 1.6 and higher.
Specifically, this application must be able to query a remote MySQL database and display the retrieved data. It need also be able to UPDATE data on this databse and that is where things get complicated ...
For selection queries, I wrote a small PHP script on the remote server that retrieves the desired data in the database and encodes them in JSON. From my Android application, I have no problem to retrieve, process and display them.
Now I wonder about the solution (if there is one ...) to run UPDATE from my application on the remote database. For now, I see only two solutions:
- Develop a webService on the server with an update method. Several problems with that: it seems webServices on Android are not easy (not native, have to go through external libs). Moreover, as it's UPDATE query, I want to make sure nobody else can use this webService.
- Alternatively, write a PHP script that makes the UPDATE and call it via HTTP. Same problem as webService: I want to secure this call to be sure that only I can use this script. These scripts can be integrated into an application already present on my server and which is secured by login / password. So, if it is possible to manage PHP sessions from Android, it's won! but Ican't find anything about it ...
What do you think? Ideas?
Thx!

[IDEA/POLL] Use C2DM app for remote phone access

These apps allow you to remotely access your phone from a web browser. However, they all run a web server on the phone, and I cannot connect to any of the over 3g (Verizon).
LazyDroid Web Desktop
Remote Desktop
Remote Web Desktop
I want to move the web server off phone, and (hopefully) onto private sites.google.com site. App Engine might be necessary, but I'm hoping this could be done solely in JS.
The hosting site would provide the UI, and interact with the phone using C2DM (the magic that powers Chrome2Phone, GMail, and installing apps from the web Market).
The UI is pretty obvious. It just needs a whiz to create HTML, Javascript, etc.
The C2DM backend is a still a bit mystifying to me... and searching for c2dm and javascript does not yield any obvious working implementations. But it seems plausible. Push a command to the phone, phone returns/uploads data to website, and UI updates.
Then there is the Android end. Well, there are the 3 projects above, Tasker for a quasi-hackish approach, and RPC (promising, but it seems like a WIP).
Thoughts? Volunteers? Geniuses?
Ooo... 2 birds with one stone!
This would also kill 2 birds with one stone.
No more typing in dynamic IP addresses! You get to use DNS to handle the connections. Bookmark your site in your desktop browser (it is always the same!). And set a preference in the Android app.
On lazydroid i've in planning some kind of trick that will let you connect behind firewall ... similar to a vpn...
CloudsITA said:
On lazydroid i've in planning some kind of trick that will let you connect behind firewall ... similar to a vpn...
Click to expand...
Click to collapse
I tried it again last week, and it is still unsuccessful. Webkey is currently the only application that I can successfully use to reach my phone.
Now, I could be wrong, but I believe all of these apps run a web server on the phone. I get a lovely, private 10.x.x.x IP address, which I can't reverse the route to. I have tried and failed to get DynDNS to work.
I have been looking into a solution since my original post. I have not had any time to do code squat, but I have loosely figured out all of the parts.
The big architectural difference I have been seeking is removing the server from the phone. I am not an Android expert, but I don't believe it even requires a running service. (Thank you, C2DM.)
With the app-webservice separation, you can work a "protocol" that reduces the overall bandwidth used... and thus improve battery life. Put all the "hard work" on a webserver, and (things get fuzzy here) possibly push it off onto the client browser (JS).
C2DM Browser Links
I could probably make something like WebKey but with C2DM and some more features. If you want you can give suggestions and I'll start making on saturday (after my exams). It would probably be possible in javascript for the actual sending from server and php just for logging in to your google account. The phone would just be registered on the server and no services (just as you wanted )
nebkat said:
I could probably make something like WebKey but with C2DM and some more features. If you want you can give suggestions and I'll start making on saturday (after my exams). It would probably be possible in javascript for the actual sending from server and php just for logging in to your google account. The phone would just be registered on the server and no services (just as you wanted )
Click to expand...
Click to collapse
I am not sure "more features" is necessarily the direction I'm headed. I am focused on making a "seamless" experience (i.e. less separation of phone and computer).
I was headed to App Engine (Python bias + easy Google integration). I have a project created. I haven't pulled together the various examples to make the core, but it seems <naive>simple</naive>. Stir in some templates, CSS, a sprinkling of JS, and voila!
The big "tricky" part that I can't convert from f***ing magic to a clear approach is the data link in the server. I want to avoid any storage to a Google disk, or otherwise, even temporarily. No stored data = easy privacy policy.
nebkat, if you're really chomping at the bit to code, here's my Android client concept.
- C2DM is a wake-up call. (cheat an borrow ChromeToPhone's ID to begin with)
- Connect to web server, send "I'm here," and wait for further instructions (Channels API/Comet/AJAX/.........)
- make the command set extensible
- each command is blockable in the client. (Permission control is set on the phone, not remotely.)
- After N minutes of no activity, send a "good bye," disconnect from the server, and fade into the background.
Don't worry, I'm very experienced with the server side stuff and I know exactly what you want. The only information stored on the sever side would be google account, the device c2dm registration id and some logging features just for statistics. A password could be set on the phone that would be sha512 hashed on the ajax request and would be sent to the phone. Even if a hacker found the hash, it would be useless without being logged in to the persons google account or knowing the server side auth token.
For now i'll just make the reciever, processor and command output and later on the extra security and ui stuff. It will work exactly the same way as Chrome2Phone except it will have server side php and the different commands. The connection from pc to phone will be something like this.
user command -> ajax request -> php c2dm request -> phone
phone -> php server http request -> controller page status
BTW I'm saving up for a Nexus S, how much would people pay for this type of app? There would definitely be a free version, but I just need to get the Nexus S because I have a Galaxy Spica now and it isn't the best for app development. I'm new to how stuff at xda works, would a donate version get me enoguh for the Nexus?
nebkat said:
Don't worry, ... <snip> ... auth token.
Click to expand...
Click to collapse
Alrighty then. I'm feeling like I can stop contemplating implementing this.
BTW I'm saving up for a Nexus S, how much would people pay for this type of app? There would definitely be a free version, but I just need to get the Nexus S because I have a Galaxy Spica now and it isn't the best for app development. I'm new to how stuff at xda works, would a donate version get me enoguh for the Nexus?
Click to expand...
Click to collapse
Since I was learning the ins and outs of App Engine, I read their quota rules and realized if this were popular it would require funding. I don't know where you are going to your web server, but I assume you'll have to pay someone to keep it running. But I had thought about $$$ already.
"Give away the razor, and sell them the blades."
Make the app free, no feature restrictions.
You get your money through various "membership" levels on the server. (See the account levels at fastmail.fm for an example.) So, you can use the app for free, but you only get, say, 2-3 MB of traffic per day, and only X sessions per day. Need more? See the pricing chart.
user command -> ajax request -> php c2dm request -> phone
phone -> php server http request -> controller page status
Click to expand...
Click to collapse
user command -> php server http request -> phone
phone -> php server http request -> controller page status
user command -> php server http request -> phone
lather, rinse, repeat.
C2DM is not deterministic, and acts up in low signal conditions. So, I made a decision to only use C2DM to initiate a session. Once both ends are connected to the server, everything goes over HTTP.
Oh.... and not that we need another Lookout/Phone Finder, but a shared-secret SMS code for the case where "they" have shut down the data connection.
I have my own server nebkat.com and there is nothing on it anyway.
The only other way to make "push" requests to the phone is with WebSockets. It would probably be better than c2dm because we have full control over what gets sent (google limits some requests). The advantage of WebSockets is that they send no header information which means that we could send our messages in 20 to 30 bytes.
I'll look into more detail on friday.
With web sockets won't you need to ensure the phone has a routable, external IP address? I know, for one, t-mobile does not expose an external IP address for their phones. Unless, of course, if the phone is connected over WiFi. C2DM works great for me (I have used a couple of apps with it and it is really useful).
MrGibbage said:
With web sockets won't you need to ensure the phone has a routable, external IP address? I know, for one, t-mobile does not expose an external IP address for their phones. Unless, of course, if the phone is connected over WiFi. C2DM works great for me (I have used a couple of apps with it and it is really useful).
Click to expand...
Click to collapse
No, WS is server initiated and the ip address' shouldn't make a difference.
MrGibbage said:
With web sockets won't you need to ensure the phone has a routable, external IP address? I know, for one, t-mobile does not expose an external IP address for their phones. Unless, of course, if the phone is connected over WiFi. C2DM works great for me (I have used a couple of apps with it and it is really useful).
Click to expand...
Click to collapse
You need an valid external IP address if you are attempting to initiate contact with your phone, which is why the 4-5 apps I've mentioned do not work on carriers like t-mo and verizon.
But the phone can establish a connection, and the carrier NATs (or whatever) will handle the routing for outgoing and incoming data.
I think the right questions are: Will Verizon/T-Mo allow the ports and protocol for WebSockets? Do Android and desktop browsers implement the draft API correctly and consistently?
I like C2DM. I works well when you have a good connection. But there are 3 issues with it.
1) The message size limit is 1024 bytes. Not ideal for file transfers.
2) In a poor signal areas, since the service retries sending messages, you will get delayed and/or duplicate messages. I work in a large "concrete" building, so I get this behavior often enough that I don't want to rely on it.
3) I believe there is a limit on the number of messages you can send. So, hunting around the filesystem could hit this limit (but unlikely in reality... I hope.)
It would be interesting to see exactly how those apps handle all of the data. Do they only use C2DM, or do they hand over to another protocol?
Ok my exams are over and I am starting with it. I'll give updates on this thread

Categories

Resources