From web server, how I can get the exact GPS location of an iPhone? - gps

I want to run my code on web server which will track an iPhone's physical location (using mobile number of card inside iPhone).
How can I do that? Is coreLocation the API that gives that facility?

Your app will have to use CoreLocation to push requests to your web server with the location. The web server cannot pull the location. I do not think you can access the phone number, but you can get the Device ID.

You can get the phone's location in the browser using javascript, please see the answer at question 10567617 .
If you have the location in the browser, you could send it to your server with ajax or any traditional technique.

If you mean, through a regular web request across HTTP, you can't -- that information isn't transmitted for good reasons. However, if you were to create an App that connected to your server's app, then yes, you could simply send the update as a packet to the server as you then have unlimited access to your phones details.

Related

CustomSD service not able to play tracks

I’m currently developing a music service and testing it via customsd. The integration in the controller app is working (iOS App & Windows Desktop App) - so I can browse - but I can’t get a Player to play any track. I keep receiving ‘unable to connect’ errors once I hit the ‘Play’ button in the controller. I can see on the service side that the Player sends a getMetadata and a getMediaURI request, and the SOAP responses delivered by the service are identical to working examples from another source; however, the Player seems unable to process them. I am kind of stuck, and I guess what would help me are the Player logs. Is there any way to get them?
Or, does anyone have any other idea about the root cause of the issue?
EDIT: More or less accidentally, I came across the reason of my problem. Whereas in general, Sonos can handle arbitrary IDs, getMediaURI only seems to work when it requests the URI for an ID of the form track:something. I don‘t remember seeing this as a requirement on the developer pages.
Anyway, got it working now.
If you're getting a getMediaURI request and responding to it with a valid response, then most likely the player is failing to process the media file itself. Are you seeing the media file being downloaded? You could host the media file locally and include the URI to that in the getMediaURI response to check.
Note that the <mimeType> included in the metadata is used to inform the player of the type of media the URI in the getMediaURL response points to.
So if you were to return <mimeType>audio/ogg</mimeType> for track123, but getMediaURI's response contained the URI https://something.xyz/track123.mp3, playback would likely fail due to the mismatch.
Have you seen bonob? Someone made a music service emulator for navidrome (self-hosted music library, a la spotify). It should be a great resource to get you started.
He wrote that your music service has to be available at https for it to even start functioning.
Note, I'm the developer of sonos-ts a library to control sonos speakers from typescript and node. And the external music services are documented here

Google API blocked my app ip address and returns CAPTCHA

My app uses Google API and it worked well for a long time but recently Google blocked the IP address of my server for about an hour and every response to the API was as follows: Our systems have detected unusual traffic from your computer network. This page checks to see if it's really you sending the requests, and not a robot... - they attached CAPTCHA form field as html.
My app is also an API so CAPTCHA can not be done because it is in json format (HTML in json cannot be rendered).
Only app users sends requests so I have a little control over it. Of course, I limit the number of requests per user, but it was not the case. Limits at google console are also fine.
I wonder how can I prevent this happening in the future? Is there any way I can ask them directly? Have you experienced this?

What's new in SMAPI 5.5?

Sonos 5.5 beta seems to have changed SMAPI somehow. Spotify for example seems to know the local time of the client, as it changes its response to getMetadata("root") depending on it, but as both the Spotify uris are https I can't sniff them to see. Anyone know what has changed?
This can be done today by looking at the Client's IP address to determine their geographic location. By refreshing the catalog (via getLastUpdate) at a regular interval you are able to update the root browse as you see in Spotify, Google and Songza to provide time specific playlists or radio.

Communication between a Mac app & local website/server

I want to control a mac app via a local website. I think the best way is to create a webserver with my mac app and then to send (primarily) integer values from the website and vice versa.
I found already CocoaHTTPServer, but I'm not sure how to do it.
For start with I want to have a slider on the website, that updates a slider in my mac application (and vice versa)
You will initiate on a separate thread or operation the web server and always wait for incoming requests. Whenever you receive a request you will handle it accordingly.
Also, if you are using this: https://github.com/robbiehanson/CocoaHTTPServer/
then there are a few examples that show how to do it. Copy the code from there to begin with the web server handling requests. After that, think through what you want to send and what you want to do. Build a form or something for the web site and submit a request to the web server.
CocoaHTTPServer will let you embed the web server into your application, which is a fine solution for what you're trying to accomplish.
Some thoughts on how to engineer it:
You'll need to subclass HTTPConnection.
Model your solution on the PostHTTPServer example.
You could get the data you want to send into the URL. Something like POST http://localhost:12345/updateSlider/123. (You probably don't need an actual POST, but no reason it wouldn't work. Technically a PUT would be more correct.)
Start by handling that part – where the browser sends a value to your application. To generate POST/PUT requests for testing purposes, use curl, or else build a static page and open it in your browser.
When you get that working, then worry about presenting a web page to the user.

Programmatically communicate with charles proxy server HTTP request and response

I am trying to develop an app which monitors data plan usage of other apps. As per the link
iPhone/iPad data usage tracking , I set up the proxy server Charles. Now I can see all the http request/responses of iPhone network traffic in charles. Now I need to write an app that can inspect the HTTP headers of these charles request/responses. How to do this programmatically in IOS(objective-C)? Please help!
I cannot add this as a comment (need 50 rep), and I understand that's it may not be exactly what you're looking for, but is the only way I have found to access sessions programatically.
You could write an app that utilises the Web Interface. I use it whilst running tests against my app to retrieve the session activity, then make assertions against the downloaded information retrospectively. Hope that helps.