Fake incoming call - android

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.

Related

How can I provide a command line interface to my Android app?

I would like to be able to type commands on my development machine (macOS/zsh) and have them do things on my Android app. This will require custom code in my Android app. What I'm trying to do is something similar to automating certain settings, so that I don't have to navigate to the settings screen of my Android app manually. This is to help me save time while I'm developing my app.
How can I get started? I'd love to see some examples of this being done but have been having trouble finding them.
Are there any libraries that can help me with this?
Also, for bonus points, I'd love to be able to have some sort of autocomplete on my Mac command line. How might I build that?
There's a few ways to do this:
1)Just write a Linux app, move it to your device, set the executable bit, and run it from adb shell (adb shell opens up a shell on an attached device with debugging enabled).
2)If you really need to access the app while its running, you can send intents to your app via the shell via adb shell am <options> This allows you to send an intent to the system. Then just write a custom Activity, Service, or BroadcastReceiver to receive that Intent and act upon it.

Is it possible to run a bash ssh command via MIT App Inventor to a local Raspberry Pi?

TL;DR I want to create an Android app able to send a pause command to omxplayer running on a Raspberry Pi, via ssh.
I have been using RaspiCast (see Play store) for a Chromecast-like functionality on my sitting room TV, but since the Buster release of Raspbian I can cast youtube videos as usual but controls (pause, start) are non responsive any more and the progress bar is gone. Omxplayer connects to DBUS though, so it is possible to remotely send a commmand via send for various functions. For example running sshpass -f <(printf '%s\n' my_passwd) ssh pi#piTV_IP_address -p Port 'bash dbuscontrol.sh pause' on bash on another local linux machine can pause and unpause playback on my TV RPi where I cast. So I want to create the simplest of android apps: a single Pause/Play button that when touched will send that ssh command to the RPi on the local network. After that it will be trivial to populate the app with buttons offering what is available via omxplayer's dbuscontrol.sh script.
The ActivityStarter block (Connectivity category) seems like the first place one should look but I can't make heads or tails of it. Any suggestions?
you might want to try the Terminal / Shell Extension by Juan Antonio
there also is a SSH Client Extension by Andre Castro available, Github respositoryfor the App Inventor extensions diretory see here https://puravidaapps.com/extensions.php

Is it possible to run a function() within an android application with adb shell?

I've written an android application with an addNotification() function in the main activity.
I'm wondering if it's possible to call this function from my pc using adb shell commands whilst the application is running?
Simple answer: No.
But you can use intent extras, or make another class file for that function.
I think this is not impossible.
I know many helper apps on android just like 360 phone helper and wandoujia helper get this kind of features:After you install this helper apps on your phone,and connect your phone to computer,this apps will run autolly and give a message to user to notify them that their phone has been connected to computer.
In fact, your android device is an linux like system after you root it.If you're familiar with terminal in linux and OSX,there must be some apps that you cannot ignore.
Android Terminal Emulator

Retrieve adb logcat files from a client's device

I'm making an app for a client, and they are experiencing bugs that no one else can reproduce. They are not close to us, so I can't physically go to them and hook their device up to my laptop.
Is there a way that they can get hold of their logcat files without having to install adb on a machine first, i.e. can they email them straight from their device? I'm not sure how tech-savvy they are, and ideally I don't want to spend too much time telling them how to install adb if I can get the files some other way.
Obviously I'm looking to do it with their permission (and I'm expecting that installing adb is going to be the only way).
Edit: I should add that I'm using Corona SDK, so will not be able to access the logs from directly inside the app. Also, all devices are 4.1+ so the various log collector apps have not worked.
You can redirect the logcat to a file and send it by email using your app.
Check here how to save the logcat into a file.

How can I send messages back and forth between ADB shell and an Android app?

I've been looking for an answer or the past 3 days, and haven't yet found one that works. I'm trying to write an Android app that can be controlled from ADB with custom commands. Is there anyway I can send strings back an forth between an app and an ADB shell?
Thanks in advance, and sorry for my noob qustion.
Sure, there are several ways to do this.
You could use a unix domain socket, and open it from both the android app and from a command line executable you would build by abusing the ndk, push to a version-dependent location on the device (/data/local, /sqlite_stmt_journals, etc) and run. Edit: in more recent android versions there may not be such writable/executable directories. You may have to have the app itself write the executable out to its private directory and set global read and execute permissions on it. Further Edit: adb can forward unix sockets, too.
Same thing with an internet socket, only now you have the option of setting up an adb port forward (provided the android app is the 'server' end) so as to communicate from a process running on your development machine directly with the android app, without passing data through the adb shell. Unless declaring internet permission is objectionable (it should be less of a concern than letting your PC-side app "drive" adb) this is probably the method that would stick closest to "official" capabilities and have the least android version dependence. It also can be trivially adapted to communicating over wifi.
You could use a pair of fifos and write and read them with shell commands (for portability, create them in the app's private storage but make them world readable/writeable)
you may be able to play some games with a pty
you could I suppose use files as mailboxes
you can use the 'am' command to send Intents (useful at least to start up the android app, if a bit inefficient for the communication)

Categories

Resources