Currently, I have a requirement in which an audio focus request needs to be added. The scenario is I am having App1 and App2. First App1 gets launched and then from App1, App2 is launched using the package name. Now in App2, long speech is generated using tts. I want to make a speech from App1 during the speech of App2 is ongoing. For that, I am trying to implement an audio-focus request mechanism. But the thing is, is it required to add code of audio focus gain/loss in both apps?
Related
I have got all call states through this refrence
but now i want to add my custom voice from my app in user active call with user voice.
can android gives me such a permission to do so ?
if android OS gives permission then how can i embed my voice (can be mp3 or something) with user voice.
Please help me in this scenerio.
Is it possible to run an application from inside another application? What I want to do is write an app which allows you to chose an app to start, and then displays the activities of this app inside a view.
So in landscape mode, it should look something like this:
The idea behind this is:
I want to be able to start and run a third party activity next to my own activity, and I want to be able to create individual makros with my activity that are controlling the third party activity.
Basically, something like this:
Start third party activity from inside my app
Start makro recording
Do something in third party activity
Stop makro recording
Use makro whenever you wish
So how can I start and control another activity from inside my own activity?
Unrooted:
Sadly, what you want to achieve does not seem to be possible without rooting the phone, because you can only interact with other apps via intents. Since developers decide how their apps react on specific intents, creating macros this way is nearly impossible.
With rooted phones:
You may want to create a list of all installed apps, you can use
getPackageManager().getInstalledApplications(PackageManager.GET_META_DATA);
to retrieve a list of all installed apps.
If the user now selects an app, launch it via an intent and create a system overlay to get all touch/key events (and let the user stop the macro). You can find a way to do this here. Store the x/y-values of the touch-events.
You can recreate the events using MotionEvent#obtain.
Now comes the part where you need a rooted phone (the permission INJECT_EVENTS). Launch the app and inject the events so your macro gets executed. Samplecode:
Instrumentation m_Instrumentation = new Instrumentation();
m_Instrumentation.sendPointerSync(motionEvent);
You can find more information about injecting (also keyevents) here.
If you need help to compile your app, these 2 links will help you: How to compile Android Application with system permissions, Android INJECT_EVENTS permission
It's not possible to start an application in a View, but you can launch an app from within your app:
Intent i = getPackageManager().getLaunchIntentForPackage("com.package.ofapp");
startActivity(i);
//EDIT to your updated question:
After starting the activity from the above code, one way you could start/stop the macro at any time in the new app would be to create a small view overlay on top of the screen.
This overlay would be on top of ALL activities.
Check out the following link: Creating a system overlay window (always on top)
You could write code to start the macro when the View is pressed, and then if the button was pressed once and the user presses it again, stop the macro. This would be in the onTouchEvent() method.
Yes, I think it's possible as a app named floating apps does that (WITHOUT ROOT)
Only using some adb commands
https://play.google.com/store/apps/details?id=com.lwi.android.flapps
Yes its possible if you use Intents. They allow you to move between screens and to launch another different functionality inside the same app. visit coursera for more tutorials on intents
When I use google voice search, I can say "Send Text" and google will launch my SMS program.
I can say "Listen to" and google will start my default music app.
Is it possible for my app to register it's own "special phrase" such as: "MyApp DoSomething" and then have google launch MyApp with the "DoSomething" as a type of parameter I can capture and do something with?
To be a little bit more clear - I'm aware that the user can launch MyApp, then I can provide an action that starts the Voice Input, but I'd like the google voice search app to be able to start my application when certain key phrases are spoken.
As I understand you want Google Voice Search application to launch your application when you say a special key phrase. I think that at the present moment there is no possibility to add your functionality in the Google Voice Search application (there is no API for this).
However, you can implement your own Voice Search application in the following way:
You can create an AppWidget and put it on the desktop.
When a user click on this AppWidget you can call your service and
from this service launch voice recognition activity.
This activity will return the result of the recognition
(http://developer.android.com/resources/articles/speech-input.html)
which can be processed in the service. During this you can compare a
result of the recognition with yours predefined strings for
application launching and if there is a match then you can simply
call needed application.
I'm working with a partner who has an app (App A) that wishes to call my app (App B). Once called App A will then wait for App B to finish what it's doing and collect some data.
In the exact scenario I'm working in, App A collects user info (name, phone) and then needs to pass it to App B. App B will do some stuff with that info and when finished, needs to notify App A that it succeeded (or didn't succeed) to perform operations for user name_phone.
What do our apps need to know about each other for this to work?
I'm looking at startActivityForResult but I'm getting the impression that's something one would use within ones own application and not something App A can use to launch App B.
TIA
startActivityForResult() works fine between applications. You should take a look at Barcode Scanner by ZXing to see how they use startActivityForResult() for this very purpose.
App B will need to have an Activity with an <intent-filter> that will be stable, such as one using a custom action string. App B will also need to document what the Intent should look like (e.g., required action, required Uri if any, extras), and what will be returned via onActivityResult().
The author of App B could create a JAR file that provides a cleaner API for App A to use. ZXing did that with Barcode Scanner.
I want to create an app or background service that just listens for the launch of a 'default' app, say Contacts or the built-in Gmail app. If the contact app is clicked, I want to transfer control to my app temporarily (e.g. present a Yes/No popup to the user or increment an internal counter of my app ) and then redirect the user back to the app that was clicked. I want to do this only for a couple of 'well-known' built-in default apps, not any third party apps.
Is this possible? May be using some special intents?
Have you tried registering broadcast receivers for the intents that would launch those built-in apps? This might not work since that might confuse Android into thinking your app is a potential target for those intents (e.g. that it should be used to actually write and send the email in the case of a 'compose an email' intent), but it should be a good place to start.