Redirect to Mobile app from facebook and twitter app

My Android app can share links via Twitter or Facebook.

If someone clicks on a link that was shared and they already have the app installed, how can I make the app launch directly?

Updated - Simple Issue Fixed from here - Make a link in the Android browser start up my app?

Answers


You need to add <Intent-filter> under <activity> tag in manifest.xml file like

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

When another application tries to share any of these things by constructing an intent and passing it to startActivity(), your application will be listed as an option in the intent chooser.

If the user selects your application, the corresponding activity (.ui.MyActivity in the example above) will be started. It is then up to you to handle the content appropriately within your code and UI.

And go to this for better understanding: http://developer.android.com/training/sharing/receive.html


Facebbok/twitter

facebook

After facebbok login  OnComplete() is called. So, fire your intent in this method.
 public void onComplete(Bundle values) 
 {
    # fire desired intent      
  }

twitter

 put this code into your manifest file with activity name and on which activity 
  want to redirect put the below line so link is created and you will redirect
  <activity
        android:name="com.example.mainactivity"
        android:screenOrientation="portrait" >

          <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data
                android:host="home"
                android:scheme="oauth" />
        </intent-filter>

    </activity>

*********************************************************************
<h6>put this into your mainactivty</h6>
static final String TWITTER_CALLBACK_URL = "oauth://home";
static final String TWITTER_CALLBACK_URL = "oauth://home";

Need Your Help

Loop through array of objects and return sum of each total values by object element id

javascript jquery arrays loops object

I'm calculating taxes for a very complicate invoicing approach. I can't explain the whole process but if you have questions I will answer as best as I can.

Filtering object properties based on value

javascript underscore.js lodash

Is there some elegant way of filtering out falsey properties from this object with lodash/underscore? Similar to how _.compact(array) removes falsey elements from arrays