Connecting app to existing service - Android Software Development

Hi,
together with some friends, we try to make a musicplayer for Android and we have a little problem. Our GUI creates on start the service which is responsible for playing music. When the music is started and the starting GUI is stopped, the music goes on as intended, but when the GUI is started again, we have no control over the service and we cant stop the music anymore (probably because of the newly created service). How can we verify if there is an existing service and connect to it?

Noone here, who can tell me, how to find a specific service and connect my app to it?

Take a look at Context.bindService(...), first parameter is Intent that identifies the service to connect to. The Intent may specify either an explicit component name, or a logical description (action, category, etc) to match an IntentFilter published by a service.

Related

Data Call between two XDA's

Hi
I am new to this form.
I had a look at the tsril.zip example as it seems from this forum that to make/receive a data call the ril is the only option. Unfortunately the documentation for ril is nonexistent and I want to ask if someone has done an example of a client/server data call, data transfer between to XDA's.
Thanks in advance.
Anton
It all depends on what type of data you want to transfer. I have never used RIL so I don't know the advantages of it, over the normal programming interface. I say normal, not thinking there is anything wrong with RIL but the little I do know is that RIL is operating system level and is normally hidden from the application programmer. There must be times when RIL must be used if Microsoft forgot functions in the normal APIs.
However I would say that for a data link between 2 devices then RAS seems the way forward. One device would be the Server and the other the Client. I have only ever programmed RAS from the client side, making a Telnet link to an already running server.
I just had a look at the help on Embedded Visual C++ 3.0 and under 'Creating a TCP Stream Socket Application' it explains the server side and then links to the client side. Have a read there.
RAS is not an option as it is a server consept, which I think does not even exist as a service on the desktop windows os let alone on a Pocket PC.
What I am looking for is something similar that you would be able to do with a landline modem or a gsm modem connected to a serial port of a pc (even a usb modem) which is to send AT commands to make/accept a call and then to make use of the serial port as if it is an io stream. This is possible on windows, linux using either c#, c++ or java. I can even do this with an embedded gsm module like the siemens TC45 java module.
What I can not understand is why Microsoft and the XDA suppliers (I am using a Qtex running Pocket PC 2002) is making it so difficult to make/answer a data call and let you run your own protocol over the connected stream.
RAS (Remote Access Services) is built into all Windows Operating Systems, including Windows CE. Did you look up the help example I pointed to ? What you do with RAS on an application level is for you to code but the connection itself is handled by the operating system.
As to making a connection similer to a modem and using AT commands. Then no you can't use AT commands directly, but you don't need to. To get that type of connection you need to use TAPI. Once Tapi has made a DATA_MODEM type connection, you use the TAPI callback connect event to then ask for a file handle that you can use with the normal WriteFile and ReadFile commands.
I already have something on this forum about that see:-
http://forum.xda-developers.com/viewtopic.php?p=7857&highlight=#7857
The problem is not so much making the data call but it is accepting/answering the data call that I can not get working on the XDA
Not sure if this is your problem, but in Australia they have a seperate "data" phone number for the same SIM. If yo call one number you get voice, if you call another number you get data on the same sim. Not sure if this may be effecting you.
I just looked into all this ras stuff a bit deeper, and yes I think I may of been talking rubbish. Although RAS does exist in PPC2002, it can't see any functions that allow the device to answer the line. I can see that PPC2003 has a Ras Server and RasIOControl that looks like the answer there.
Also looking into Tapi, I can't see how you answer a data call using that.
So I now understand your problem. It seems PPC is made as a client device.
Is GPRS the answer ? With that the link is always present and then you can use the built in Ras functions on seperate devices. Since you only pay for data actually sent then would it matter if the network link was always present ?
I have only worked out Tapi and Ras from the client side so I have never had this problem, but I agree it is an interesting one. I will have a bow out of this thread for a bit and see if anybody else knows how to Answer a Call.
Thanks for trying.
GPRS is also not the answer as you need a server in between that both XDA's can connect too and use as a router as the XDA's do not get fixed IP adresses but actually a NAT adres from the APN so you can not connect directly between the two.
Now that's an interesting thought, how about using some free web space to act as a pigion hole for your data ?
Believer: A seperate number? How do you know this, and what would the number be?
I can actually make two XDA connecting to each other using TCP. The trick is that I have one client always connect to a server to register it IP address with an ID. Then the caller send a query to the server to look up the callee's IP address.
In this way, accept() and connect() work fine.
I am using AT&T network and not sure about if other networks behave the same.
I wrote two application using TAPI. One is ModemDial and the other is ModemWatch, if I make a voice call the ModemDial dials the number successfully and ModemWatch reports that an incoming call exist. But when I change the behavior of call to DATAMODEM, the ModemWatch couldn't track any incoming call.
Is there any one, had some experience with pick a call for DataModem?
Best regards,
A. Riazi
riazi said:
I wrote two application using TAPI. One is ModemDial and the other is ModemWatch, if I make a voice call the ModemDial dials the number successfully and ModemWatch reports that an incoming call exist. But when I change the behavior of call to DATAMODEM, the ModemWatch couldn't track any incoming call.
Is there any one, had some experience with pick a call for DataModem?
Best regards,
A. Riazi
Click to expand...
Click to collapse
In your ModemWatch application make sure you are calling lineOpen with dwPrivileges (the 7th parameter, 1 based) equal to LINECALLPRIVILEGE_OWNER and dwMediaModes (the 8th parameter) equal to LINEMEDIAMODE_DATAMODEM.
If you're able to answer a voice call successfully, making these changes to the ModemWatch application should allow you to answer a data call.

remote data software?

was not sure where this post would go so i put it here.
what i am trying to do is this (i might lose ya, but here we go):
I have a home server located in a not-so-easy to get to place that is running opensuse 10.2 and is headless. there applications on there that i would like to see the status of and also any system events that need my attention. these are not complex items, just stuff like kernel updates, disk failures, file usage, etc. i do use realvnc to access that machine from my main computer to check stuff but that is a bit of a pain in the butt. usually the times i vnc in are when the **** has already hit the fan and i am greeted with a dead connection. and yes, before you ask, this server pc is oooollllld. that is why i put it out to pasture just to host my development websites and music/videos for parties (not worry that stuff is backed up).
now to the point. what i want to do with that info is have it sent to my main pc in general and to my wizard in specific. can this be done? i had tried the sms alert apps and the email alert apps that i found on the opensuse forums but they are cludgey and not very detailed and sometimes false positives like if someone (me) deletes a file(s) on purpose i get an alert for each damn thing that gets moved or changed.
so to sum up: i would like help developing a package to send system alerts (temps, hd usage, kernel panics) to my wizard while my wizard is connected to my main pc by usb or when my wizard is on my locally secured wifi network. can this be done?
i see 3 stages here
1) the opensuse machine must run a system event logger (has this already) that can broadcast over the net certain stats (havnt seen this)
2) the main pc will have a client "listening" for these events and routes the information to the wizard either through usb or wife re-routing (this can be done for syncing data over wifi/bt/usb so the protocol is there)
3) a listening app on my wizard to recieve the info sent to it by the main pc. this application will not be on all the time (like when i am not home..in that case i use the opensuse email/sms app) but only when it is within wifi range or is docked to my main pc.
i have found several temp monitors for linux that do log data or that allow other apps to hook into it. filesystem errors can be handled by the overall system health apps as well. i can send data to and from my wizard with a little rinkydinky test app i wrote but the problem seems to be the transfer of system level data to a remote machine. the only problem i am having is connecting all the pieces.
any help or pointers would be welcome. not asking for handouts but help or else i wont learn much in the process =)
wergeld

Location Alert APPLICATION

A simple application to alert user when he reaches a destination. It uses the broadcast messages being provided by network. e.g. HUTCH, INDIA. So depends on your network. have seen lot of post regarding this issue so here is my application. Requires .NET CF 2-3, Tested on HTC TOUCH. copy the EXE to any location on your mobile. for alarm the location of wav file should be /windows/Alarm5.wav
You need to setup your phone settings:settings->phone->more->enable broadcast channel, create a new channel name with channel number 050 to receive broadcast message on your windows mobile.
Is it still in development
Hi Mohit,
Curious to know if the location alert app in active development?
Thanks,
Jamal

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!

Sockets on Wearos

Is it possible to use IP/TCP to exchange data between a Wearos watch and a Smartphone?
From the following words in https://developer.android.com/training/wearables/data/data-layer I get the impression that is some how impossible:
"Warning: Because these APIs are designed for communication between handhelds and wearables, these are the only APIs you should use to set up communication between these devices. For instance, don't try to open low-level sockets to create a communication channel."
I have now tried low level sockets on Samsungs Wearos Watch4 and Linux send and recv syscalls work perfectly well. The problem I found is on the Android level, namely onAvailable(Network network) is never called, but onLost(Network network) is. This will give problems if you stop network operations after a call to onLost, you and start them again in onAvailable.
EDIT:
Now I also find onAvailable in my logs.

Categories

Resources