How to Link Custom Android App to a Static IP PC - android-studio

I am working on a prototype android app that will draw data from a remote server.
I have a number of sensors connected to my PC that are constantly updating cells in an Excel file. I am trying to build an Android app that will remotely connect to my PC and display these values on users' cell phones.
Umm... I don't really know here to start with it.
The actual result is that users with connection to the internet will be able to open the app and see the values taken from the Excel file on my computer.

i recommend you use StringRequest to connect an Apache server with PHP, u can use XAMPP, then u can send a Request Method POST, take the request and return the data that u want to show in android, after this u can use a recycler view to inflate the data.

Related

Nodejs server randomly requires user input on console line to run

So I'm working on a web server to host a website to talk to a teradata database, but every now and then when I send a request from the website back to the server, it will do nothing until I focus the console and press any key. Does anyone know why this is and how I can fix it?
I'm using XMLHttpRequests on the website and using the default Nodejs http package on the server side. Let me know if you need more information about it that I haven't included here.
As it turns out this was an issue with CMD/Powershell select mode.

How to simulate BT and WiFi connection during UI automation test with fastlane?

I am beginner of iOS testing and I really need help. Thank you in advance.
I've tried to implement a simple test with fastlane to create screenshots and evaluate if all needed elements exist (fastlane snapshot, I follow most common tutorials and up to now everything works fine). App which is tested needs a WiFi and Bluetooth connection to open some tabs. I have no idea how to manage it. When app is redirected to view where connection is checked and test wait (methods such as sleep(30) or waitForExists(app.otherElements["snapshotReady"], waitSeconds: 60) but nothing happens and app cannot be loaded to the next view (generally, when app works on device context is switched to the next view).
I could not find any programatically method anywhere to manage it.
The best way to do this to look for the FASTLANE_SNAPSHOT key in the UserDefaults that is inserted automatically by snapshot.
if UserDefaults.standard.bool(forKey: "FASTLANE_SNAPSHOT") {
// runtime check that we are in snapshot mode
}
You can use logic like this to simulate any user interfaces that you may need.
More info can be found at - https://docs.fastlane.tools/actions/snapshot/#launch-arguments

Raspberry Pi IFTTT DO Button

I recently put together a Raspberry Pi garage door opener and it seems to be working well at this point. I used this as a reference and used his scripts and webpage with slight fixes/modifications. I can now log into the site I'm hosting from the pi with Apache2 and open and close my door and view my webcam stream. I am using DuckDNS and port forwarding port 80 to my pi currently.
What I would like to do next is set up IFTTT Maker Channel integration with the goal of using a DO Button to control the door from my Android Wear watch. The problem is I don't know how to set up the pi to receive an HTTP request from IFTTT.
Essentially what I need to learn how to do is have the pi listen for this request and run a script (setting GPIO pin 17 to high for a half second). Presumably once I figure this out I would also be able to use Tasker/AutoVoice for Google Now integration.
Thanks in advance for any help.
So I figured it out and want to post my limited knowledge answer for anyone looking to do the same, it was actually easier than I was making it.
I had a couple of problems from the start
My whole html root folder requires a password
I didn't understand what a GET request was doing in this instance
My script files weren't working properly
Here's how I was able to correct these issues and get it working
Send the username/password in the GET request, not extremely secure, but oh well:http://user:password#address.org/file.php
With the basic GET request it appears to just basically "load" the URL given as if you typed it in a browser address bar and hit enter, this means that if my script file is working correctly it should run the script
I corrected my script files

Getting chromecast sample code to run

I have found no joy in getting any of the sample programs for Chrome to connect to my Chromecasts.
The Chromecasts have been registered and I am able to browse to their IP address port 9222 successfully.
Both the Chrome browser and Beta extension are up to date.
I have tried the CastHelloVideo-Chrome, CastMedia-Chrome and Cast-Tictactoe-Chrome and all fail to connect. The developer console shows a pair of errors:
GET chrome-extension://boadgeojelhgndaghljhdicfkmllpafd/cast_sender.js net::ERR_FAILED
and
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('file://') does not match the recipient window's origin ('null').
When testing our own code we get an error when calling requestSession but the message returned by Chrome.cast.Error is useless since the function and variable names have been obscured.
I also have a difficult time testing the examples for Chrome. I decided to use Chrome to test because debugging JavaScript is so much quicker than going directly to Android. I spent hours trying to figure out why I keep getting the error message GET chrome-extension://boadgeojelhgndaghljhdicfkmllpafd/cast_sender.js net::ERR_FAILED and Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('file://') does not match the recipient window's origin ('null') if I run it from my PC but not when I run it from an example website at http://www.videws.com/eureka/helloVideos/ provided by one of the Cast developers at Google. I keep reading/trying different combinations from his readme note in the example until it dawned on me what he meant by "Put all files on your own server" instead of "computer".
I created a public weblink on my Google Drive, make the folder public and copied all the files there. When go to Google drive on the web, preview the example (index.html), the example runs beautifully. I tried tic-tac-toe. It also runs.
So the answer is you need to run it off a website -- not from a local file in your computer (ctrl-O in Chrome)
I hope this will help you going with Cast.
Danh
I was finally able to get connected, but from Android. Many steps will be the same though.
I tested this: https://github.com/googlecast/CastHelloText-android It let's you speak into the phone, and what you say appears on the TV/Chromecast. I didn't install the formal sender app, but I was able to load the TicTac Toe from the receiver as well. So i have seen them both on my CC.
I couldn't connect until I properly setup the RECEIVER APPLICATION. You didn't mention it.
What I did from where I think you are at.. I just double checked my receiver app settings.
File copy the receiver.hml file provided in the sample sender app. Place it in a public dropbox folder. copy that public link to my clipboard.
Go back to where you registered your Chromecast device(s). https://cast.google.com/publish -Add An Application. I called mine : ReceiverSimple
Edit the app you just created, and for the URL field: paste in that public link. For you, set the platform to Chrome. It did not seem to matter whether or not i included the package name, so try leaving it blank.
Save It. Now COPY to clipboard the ApplicationID for the receiver you just created.
Open the provided sender app source code, and find where it's using APP_ID (hopefully R.Strings or equivalent in chrome ) Paste that App ID in. That will tell your client to use your receiver app, (and therefore, load that receiver.html file into the chrome cast screen).
also try a chrome cast reboot as another means of sanity checking.
I think you're close.

Using Chromecast Android API to push a URL to the "ChromeCast" App

So far I've been able to write a webpage that pushes a url to the (what I'm calling) native app in the chromecast device. Through this API I can open a "video_playback" app that sends the URL and some other info, just like in this webpage http://googlecast.github.io/cast-chrome/ to my device and my video plays just fine...
Now I want to do that with the Android API, but it treats that receiver "app" as if it doesn't exist. With some more poking around I found that the actual name of the app is ChromeCast, but all I've been able to do is get a blank screen or a 404 to show up. Is this not supported on the Android app? (ie I'm forced to write my own receiver) or am I doing something wrong?
I perfectly able to open a YouTube app through the Android API and load a video, so most of my code is fine. It seems I just need to figure out what application name and arguments to use in the ApplicationSession.startSession() function.
Any help would be appreciated.-
How are you starting your session (which version of startSession() are you using?)
It sounds like you are starting your session ok but then you need to send the url of the video via the MediaProtocolMessageStream.loadMedia().
https://developers.google.com/cast/reference/android/javadoc/reference/com/google/cast/MediaProtocolMessageStream#loadMedia(java.lang.String, com.google.cast.ContentMetadata, boolean)

Resources