i'm trying to port my android application to windows. in android, there is a way to start an activity with the ACTION_SEND flag i.e.
Intent intent = new Intent(android.content.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(android.content.Intent.EXTRA_TEXT, "....");
startActivity(Intent.createChooser(intent, "Subject"))
when you do this, a list of applications (i.e. facebook, text messaging, twitter, evernote, etc...) that can receive the passed in information is presented. the user selects one and information can be shared thus.
is there something analogous in windows phone 7?
Yes, Windows Phone 7 does have something similar. Take a look at Launchers and Choosers.
With launchers, you can launch another application but you do not get any information back from the newly launched application after it ends. This is similar to startActivity in Android. With choosers, you can receive information back, similar to startActivityForResults. There are a bunch of launchers and choosers available.
Windows Phone 7 currenlty includes no publicly available direct equivalent to Androids Intents.
To access system data and to perform certain actions that are built into the core of the OS and require user interaction, it uses Launchers and Choosers which can seem similar. It is not possible to create your own ones though.
If you want to add functionality like sharing to Twitter, etc. you'll need to add this functionality to your application.
Related
I am new to android development. I came to know that Intent and Intent filters can be used to share data among applications but I wonder if it is possible to design an android application which can extract some specific information from other applications while running in the background. For example, if the user is using whatsapp it may get know the call drop rate or if a video is being played at user terminal in YouTube, Facebook or Netflix, it will get buffer playtime, video bitrate etc. I will be very grateful if answer to this question is provided with an example.
No, mostly no.
However, as wrote Tim Castelijns, if the 'target' app allows it, like via a content provider, its possible.
On a rooted device, after long hours of reverse engineering the targeted apps, it MAY also be possible to get some info. Only from rooted devices too.
Other case is you write several app and design that they can communicate together, like via intents, content providers.
There is also possible to get the list of running apps (user must permit it)
In Android, each application is running on its own "sandbox" that is supposed to be isolated from the rest of the applications running on the device.
In order for an application to communicate with other applications, the Android framework supplies several mechanisms to send/receive data to/from other applications: Intents, IPC (AIDL), Content Providers etc...
Each application that wants to expose its data to other applications on the device needs to implement an interface using one or more of the mechanisms described above.
That means that if an application doesn't implement an interface to expose its data or inner workings, it won't be possible for another application to access this information.
Keep in mind that some applications choose to save some of their data on publicly available disk spaces (i.e. a camera that takes pictures might save them on the SDcard that is accessible by all applications). In that case, if you know what to look for, you can tell certain things about certain applications.
In addition, the Android operation system exposes the states of several global settings such as: Device's connectivity state, Battery state, currently opened Bluetooth interfaces, running applications, last executed apps etc...
This configurations might give you an overall idea of what is happening on the device.
As indicated in other answers, you're mostly limited to what apps will explicitly make available to you; in fact, well-engineered apps will generally try to prevent "information leakage" beyond what they actually want to make available.
Some other people mentioned Content Providers but the one other construct to look into is Broadcasts. If an app broadcasts an intent locally (i.e. is using the Local Broadcast Manager) you won't be able to see it but if they're using a "system-wide" broadcast or receiving another "system-wide" broadcast you can receive the same event.
I'm currently working on a productivity app. One of the features includes obtaining an information about apps that are started by the user
For example I would like to obtain information that the user has started the Youtube app or listen for a specific Intent being sent without registrating a BroadcastReceiver
Is this even possible?
You cannot intercept intents sent to other apps by extending the BroadcastReceiver abstract class for obvious security reasons. So, basically, this is not allowed using conventional features (or APIs) of the Android SDK. There might be some hacks out there that could work, but they're all hacks at the end of the day which are not guaranteed to work, for example there are some articles proposing to read the system's log, it used to work in older api levels but not anymore...see some references below and make sure you read the comments as well...
Android, Detect when other apps are launched
Detect when user launches a new application on an Android device
In simple words, you can't do that. Note, that having root is a complete different story
I'm making an app that will work with Android Wear,
And I wanted to implement a command into Google's "Ok Google" option.
I saw this page:
http://developer.android.com/training/wearables/apps/voice.html
But it's related only to apps that include Activities in the Android Wear.
I wanted to ask:
Can I add custom commands? I mean, those who does not start with the word "Start"?
Can I add commands that will do another thing than just opening the app? Like running a method?
If it's not the place to ask this, can you give me an email/link to Google Developers help/support? thanks.
For apps that run on the Android Wear Device:
No, the list of system-provided voice actions is fixed (and listed here). You can set your application to be able to respond to them (for example, to take a note), but you cannot add new ones.
Yes. When already inside your app, you you can use startActivityForResult() using the ACTION_RECOGNIZE_SPEECH to get voice input. You could then use the returned string to execute whatever you want.
Meanwhile, if you're just displaying notifications from an Android app running in a handheld, then you cannot presently have voice actions at all (at least in a literal sense). What you may have, though, is a notification action that requests voice input. That input will then be passed as an extra in the Intent that is delivered to the app in the handheld.
I have a requirement where I would want to initiate and manage GSM calls (Like the ones we make via Phone)
I will be connecting to a GSM Module/DTMF Module (context: robotics) via this method and would be sending instructions via DTMF tones.
I don't want to open up the phone dialer via an Intent with tel: data, would rather want to manage the telephony myself.
First thought that the system might not allow a third-party app, without a signature matching system's signature, to do telephony stuff, but then I wondered how some of the apps available in the market are doing it. (I'll attach links as soon as I find suitable ones)
EDIT: The apps that I had seen, were launchers and call manager apps, and once installed, had replaced my default phone apps (and thus were making calls instead of the default phone app doing it)
EDIT: I have found this question asking something similar, and also has an answer: Android Dialer application. I'll try this out and post back if I get any success.
Any pointers will be greatly appreciated.
We have an app that starts an activity for SENDTO with the intention of letting the user send an email. the choice of all the various email apps is fine, but we'd like to give the user of bypassing that step in the future ... e.g., add a "remember this decision" button at the bottom of the chooser. from then on, we'd launch that specific activity instead of getting the chooser.
I'm wondering if we can interact with the built-in create chooser functionality at a lower level to affect this. If not, could someone point / post some code snippets for this? I suppose the trick is understanding how to get a list of activities that can handle the intent.
I've seen a lot of questions about modifying the app chooser, and they all seem to state that no, you cannot change the built-in app chooser, but you can create a custom app chooser using queryIntentActivities() in the PackageManager class.