Skip to content

Instantly share code, notes, and snippets.

@jbasinger
Created August 12, 2015 00:26
Show Gist options
  • Select an option

  • Save jbasinger/ea0d47fb82a47485e1ce to your computer and use it in GitHub Desktop.

Select an option

Save jbasinger/ea0d47fb82a47485e1ce to your computer and use it in GitHub Desktop.
Capturing Android Intents
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="com.sciencevikinglabs.bestintentions" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</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>
</activity>
</application>
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="22" />
</manifest>
angular.module('starter', ['ionic', 'starter.controllers'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if (window.plugins){
window.plugins.webintent.hasExtra(window.plugins.webintent.EXTRA_TEXT,
function(hasIt){
if (hasIt) {
window.plugins.webintent.getExtra(window.plugins.webintent.EXTRA_TEXT,
function(textData){
console.log(textData);
}, function(err){
console.log(err);
});
}
},function(err){
console.log(err);
});
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment