top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Android: How to accept data from other apps

+2 votes
294 views

I am developing an android application and I want my app to be able to receive data from other apps. How can I do that?

posted Aug 29, 2016 by Akshay

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

To accept the data through intent you have to first set intent-filter,

<activity android:name=".ui.MyActivity" >
    <intent-filter>
        <action android:name="android.intent.action.SEND" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="text/plain" />
    </intent-filter>
</activity>

And in java you can handle the intent with below code - apply the below code in onCreate

if (Intent.ACTION_SEND.equals(action) && type != null) {
    if ("text/plain".equals(type)) {
        // Handle text being sent
    }
}

Hope this helps!

answer Aug 31, 2016 by Vinod Kumar K V
Similar Questions
0 votes

I need to show a dialog (more like a horizontal bar) on press of a custom Key (on my custom device powered by Android). This dialog should appear on top of any other application(say "A") that might be running when the Key is pressed.
The app "A" should keep on running and its UI should be visible (i.e the app "A: should not go to "_onPause_()"). It should work something similar to_ SystemUI_'s volume change dialog when Volume Hard Keys are pressed. I want to make minimum changes in framework.
My understanding is that I need to make changes in _PhoneWindowManager.java_ to handle the press of custom Key, which will then call my app residing in application layer, which will just inflate the dialog.
Would this work? If so, is there a better way to implement it? If not, how can I implement this?

+1 vote

There are some apps out there for android that can improve mobile/tablet performance by killing the applications that run in background. How to do that?

+2 votes

I want to open another application from my application. I know I should use Intent for that, but I am not sure how to use that.

...