How do I send a command to a Mac via WiFi from an iPhone? - iphone

How would I send a command to a Mac (which has network sharing turned on) over the Wi-Fi network that both it and the iphone is connected to? In my case I want it to open an application.

By network sharing, I assume you are only sharing files. To launch an app, you'd either need to have Remote Login turned on (which would allow Richard's SSH suggestion) or have an application running on the Mac which is listening on a specific port. Your iPhone app would then communicate over this port. Some iPhone apps have a Mac app counterpart (cf. Reach My Files, Here File, File) for the purpose of communicating with the Mac.
How much work are you expecting the user to do when they install your app? Will you walk them through how to turn on Remote Login option in System Preferences under Sharing (in which case, the iPhone app will need to have the user credentials of a user allowed to login remotely), or have them just install an app? The latter is much more user-friendly, but more work on your part.
To actually launch the app, you can use the open command. Type man open for more details, but basically, to launch, for example, iTunes: open -a iTunes.app.

Related

Turn on/off local wifi device with bash script

I have a raspberry pi in my local wifi network. Also I bought smart socket which can be integrated with Alexa or Google Home Assistant. What is a best option to turn the socket on/off from my raspberry?
I thought about installing alexa or google home assistant on the raspberry and somehow use one of these to control my socket. However I don't want to do that by voice but simply a bash script.
It is possible to control the local wifi device with a bash script. You can use ifconfig to bring an interface up/down and configure it accordingly. But, it also depends on the integration of the smart socket with Alexa/Assistant, whether the manufacturer provides their own API endpoints for you to use or whether the user interacts through Assistant/Alexa. If you are using Google Assistant, you can leverage automations on Google Home App to control the device automatically.

Install a progressive web application (PWA) on the phone without a network

Is it possible (e.g. when developing) to send a pwa to the phone someway e..g. via usb cable without the network and serving it in https?
The use case is development, when maybe a wifi network is not available or unpractical to set up.
If your APP is fully PWA compliant, the app added to home will be an installed APK, which you can extract using file explorer(I used ES File explorer) and put it in other devices using USB connection and adb install myapp.apk for installation.
After you load the apk, it would anyways make calls to your web-server which I'm not sure how it make sense to achieve without network connection though. I couldn't think of any reason to develop a mobile application as PWA without network. You can even have a pass though internet(sharing your desktops internet via USB) by connecting via USB if wifi is not available. But developing PWA with absolute no network mode is not practical.
Update: While you can generate the APK and side load it via USB in the above mentioned way, transferring the cached assets(HTML/CSS/JS/images) might be tricky. You may have to wrap your app as a plain cordova application or Ionic kind of PWA app which uses Cordova to wrap and build with your assets. This way, your APK will be having everything it needs to run for calculator kind of use case.

How to get emulator to stop demanding certificates

I've managed to get the emulator in the WTK to run stand-alone, as a QwertyDevice, and to install apps (with the built-in Install Applications app) from the Apache server on my laptop. However, it's refusing to actually run the apps because it can't find a Certificate (or the Certificate is corrupted).
How do I turn that off? My actual phone, which I'm developing my apps for, warns me but lets me install and use unsigned apps. And I think I can trust my own apps since I'm writing them.
I found mention of a security Xdomain setting in the WTK user guide, and tried the default, trusted, untrusted, and minimum. No effect except a message in the Command Prompt window saying that it's running in the selected domain. It still refuses to run my apps. (Selecting -Xdomain:help in an attempt to get a list of valid domains resulted in "Running in the help domain"!)
How do I get the emulator to OBEY ME and run the apps?

View localhost site on iPhone on OSX

I am building a .NET website with MonoDevelop on OSX Lion that is targeted for mobile devices.
On my desktop's browser, I am able to access the site via http://127.0.0.1:8080, but I would like to view it on my physical iPhone (I don't want to use the XCode simulator).
My iPhone and Mac are on the same network and I have enabled Web Sharing. I can actually get to the default Apache index.html (http://192.168.1.104:80) page, but I am not able to get to my site (http://192.168.1.104:8080).
I'm newer to the Mac and even less familiar with network management, so I hope I'm missing something very simple.
You may as well turn off web-sharing because web-sharing only operates the built-in Apache web-server.
What is happening is that the web-server that MonoDevelop is hosting your pages on has been set up to only allow connections coming from localhost. If this is the problem, entering in the lan IP of the OS X machine on the OS X machine will likely also not work (if the IP filtering work like it does on Apache).
You need to find the config files for the MonoDevelop server and allow access from addresses other than 127.0.0.1

Can an iPhone/iPod Touch application open a port for remote communication without jailbreaking?

I'm researching remote control testing for an app that'll be installed on the new iPod Touch and can't tell for certain from everything that I've read whether or not an installed app can or can't open any ports for remote test instructions (that's a mouthful : ) We created something like this for the Android using adb port forwarding and telnet, and it worked really well. Is there any chance something similar could be done on an iPhone or iPod without jailbreaking??
Sure, you have access to the traditional Unix networking layer and a Cocoa layer built on top of that as well.