Running Genymotion in the cloud - EC2 Instance - android

I am looking to test my application on an android device but also need to be able to install things like nodejs, mongo, ruby to name but a few. Basically my application sends data to an endpoint (mongo) and then i assert that they are there with some cucumber tests.
So i have come across Genymotion On Demand which looks like it could work but was wondering how i can use the app to send data to an endpoint on another EC2 instance and also control the app (say restart it via the command line), again in this separate instance
Has anyone done this or can point me in the right direction please ?
Thanks

You should have no problem contacting the server instance from the Genymotion on demand instance using its private IP address if it is in the same network, or its public IP address otherwise.
For the second part of the question: from your linux instance (with mongo nodejs & ruby), you can use adb to interact with the Genymotion instance. This will allow you to control the app, inside the instance, using 'am' command line tool. See https://developer.android.com/studio/command-line/adb.html#am on how to start your application by sending an intent. If you need a tutorial on how to start the adb server in the Genymotion on demand instance, please see https://www.genymotion.com/help/on-demand/tutorial/enable-disable-adb/.
On a side note, you can even dynamically spawn/shutdown Genymotion On Demand instances from your linux instance using the AWS SDK or cli.

Related

Would running an ethereum node of a private network in android drain battery?

I am building an android application where users can pay for items they buy with ether. Application will use a private ethereum network.
As I understood, I have to run an ethereum node in the android device as a separate process and my android app has to communicate with it using either sending commands or through JSON RPC.
Since android is very concerned about the power consumption, would android allow running a separate process continuously? Would android kill the process after some time?
Also, would running the node continuously in the device cause a huge battery drain?
Yes, it would. You have basicly two options, create a centralized server/client setup, where you android app does JSON RPC queries to a HttpProvider which you set up for your specific app, or you run a light client.
I think, the way to go is to run a light client (LES protocol) which only connects to a full node if required. The light clients are currently heavily developed and there is some beta testing going on already.
Check out the light client roadmap. In june the light client testing was opened to the public. You can test it by running a fork of the go-ethereum client.
git clone -b light-stable https://github.com/zsfelfoldi/go-ethereum.git
build it with Go 1.6 (won't compile with earlier versions)
add the --light flag for light client mode (run geth --light console for console mode)
you can also run it on the testnet by specifying the --testnet flag or the original unforked "classic" chain with the --oppose-dao-fork flag
you can run the light client with the same (default) data directory you use with the normal client, it uses a separate "lightchaindata" database directory instead of the standard "chaindata" so it won't interfere with your regular chain database (can't run the two simultaneously with the same datadir though).
initial syncing starts from a trusted checkpoint (later this will be implemented in a trustless way). Past headers are still accessible on-demand. Trusted checkpoints are hardcoded into the source both for the mainnet and testnet.
There is a dedicated gitter channel where you can ask questions.

Developing android application with a development web service

I'm currently building an Android Application and an accompanying Web Service. Right now I'm having some trouble figuring out the best way to configure the Android Application to know where the Web Service is. When I use the emulator and I'm running a local dev version of the web service, I manually tell the Android Application that the web service is hosted at "10.0.2.2". This works well for the emulator, but not for a physical device. I'm able to access it, via my phone, over the LAN using it's IP address, so actually accessing the web service is not the problem. It's just a pain to have to change the IP when I want to run it on my phone. Is there some configuration I could use to make this task easier?
I found out that you could do something similar to what I was asking using some gradle.
http://jeremie-martinez.com/2015/05/05/inject-host-gradle/
This post shows you how to add the ip address of the development computer to the code at compilation time.

Fake incoming call

I am looking for a way how to automate incoming calls for testing with MonkeyTalk. That means I can run some external scripts. In our Continuous Integration tool I need something capable of running in the headless mode.
WHAT I TRIED
DDMS
Telnet
ADB
DDMS from Eclipse is not the way to go as it supports only GUI.
Telnet seemed like a good choice but it's a pain in the ass to write some command line scripts for it. In Windows I didn't make it. There exists some ways in Linux though.
ADB offers only outgoing calls by using the famous
adb shell am start -a android.intent.action.CALL tel:1112223333
With ADB I also tried to invoke a broadcast with extra state ringing but NO...
QUESTION
How can I fake an incoming call to an emulator using a script? I need to set my own number, of course.
On google's android studio I think it gives you access to internet & google accounts. You could just log in, install "hangouts dialer" from the play store, then (on another phone, with a different google account) call the previously used google account. I haven't tested this though, and I don't know if the phone handles this as an actual call or just opens hangouts.
Alternatively, you could just set up two emulator instances and dial the console port number, in the window title "Android Emulator #####", as said in this question.

Getting data from android device and plot in browser

I am trying to get data from app running on android device and plot it in a browser running on PC.
I considered below methods
Method 1
Write data from android app to cirular files[ file1.txt -> file2.txt -> file3.txt -> file1.txt ] at regular intervals, in my case 1 sec.
Pull the files using adb in circular order.
Again use the same circular order in reading files in browser using XMLHttpRequest and plot using some javascript.
Here I am facing some error while reading the file using XMLHttpRequest, there may be a issue of synchronisation -> reading and writing of the files.
I think this is very naive approach.
Method 2
I considered one more option of using USB tethering to establish a TCP connection between device and PC and get data from the APP from client-socket running on PC. ( This method sounds better than writing data into files in the device and pulling files using adb ).
Still unable to find a way to send the data received from device to browser for plotting.
Constraints
I am not allowed to use any kind of webserver on the device side.
Any method I think of has some kind of ping-pong/circular approach somewhere in the process, which I think is not a good option.
I know this sounds like pretty simple problem to many of you.
It will be of great help, if anybody gives some elegant approach.
I could able to find answer in some form.
Open TCP/UDP connection from the app running on Device to PC to which it is connected (using USB) and send data.
a) If data has to be processed, process that data in another application and send the processed data to node.js running on PC
b) If there is no processing required directly send data from Device to node.js
Open websocket in node.js and send that data to browser running on another PC.

Android Emulator communication from different machines

I've referred the developer site and have implemented the following idea that works fine for two emulator instances running on same machine.
•A is you development machine
•B is your first emulator instance, running on A
•C is your second emulator instance, also running on A
and you want to run a server on B, to which C will connect, here is how you could set it up:
1.Set up the server on B, listening to 10.0.2.15:
2.On B's console, set up a redirection from A:localhost: to B:10.0.2.15:
3.On C, have the client connect to 10.0.2.2:
For example, if you wanted to run an HTTP server, you can select as 80 and as 8080:
•B listens on 10.0.2.15:80
•On B's console, issue redir add tcp:8080:80
•C connects to 10.0.2.2:8080
Now for two diffenrent machines I have to make C connect to A's ipaddress:8080. This doesn't work though. What Address should be given in place of 10.0.2.2 for this to work? The IPAddress alone is apparently not sufficient.
I've been stuck with this for abt a week. Any help would be appreciated.
Yes. It's possible. you need server between two emulator. it's not possible to connect two emulator without any intermediate. This role perform by Google App engine``.
Google App Engine is complete, scalable and affordable hosting solution. Using Google App Engine,you can do this. Check this.
App Engine With XMPP:
With the introduction of the XMPP service to App Engine, it's possible to write an App Engine app that communicates with users - or even other applications - over XMPP. XMPP is an instant-messaging protocol, used by Google Talk, Jabber, and other IM networks.
Here one good tutorial of XMPP.
One Example of App Engine..
Hope this will help you.
Update:
java.net.conectExcperion:Connection Rfused : Connect android
This exception occurs when no service listening on the port you are trying to connect.
You also need to understand Emulator Networking

Categories

Resources