Last active
August 29, 2015 14:17
-
-
Save cauboy/c2985da8ab7fb5320713 to your computer and use it in GitHub Desktop.
The goal is to receive a share intent (e.g. a website url by Chrome) and open a specific activity (save.js) based on that intent (not the default one).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- That's the created AndroidManifest.xml when running titanium build --platform android --> | |
<?xml version="1.0" encoding="UTF-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.refind.app" android:versionCode="1" android:versionName="1.0"> | |
<application android:icon="@drawable/appicon" android:label="MyOwn" android:name="MyOwnApplication" android:debuggable="false" android:theme="@style/Theme.AppCompat"> | |
<activity android:name=".MyOwnActivity" android:label="@string/app_name" android:theme="@style/Theme.Titanium" android:configChanges="keyboardHidden|orientation|screenSize"> | |
<intent-filter> | |
<action android:name="android.intent.action.MAIN"/> | |
<category android:name="android.intent.category.LAUNCHER"/> | |
</intent-filter> | |
</activity> | |
<activity android:name="org.appcelerator.titanium.TiActivity" android:configChanges="keyboardHidden|orientation|screenSize"/> | |
<activity android:name="org.appcelerator.titanium.TiTranslucentActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@style/Theme.AppCompat.Translucent"/> | |
<activity android:name="ti.modules.titanium.ui.android.TiPreferencesActivity" android:configChanges="screenSize"/> | |
<activity android:name="com.myown.app.SaveActivity" android:configChanges="keyboardHidden|orientation|screenSize"/> | |
</application> | |
<uses-permission android:name="android.permission.INTERNET"/> | |
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> | |
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> | |
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> | |
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Just for Testing | |
Ti.API.info('save.js'); | |
var activity = Ti.Android.currentActivity; | |
var intentData = activity.getIntent().getData(); | |
Ti.API.info('intentData', JSON.stringify(intentData)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- … --> | |
<android xmlns:android="http://schemas.android.com/apk/res/android"> | |
<activities> | |
<activity url="save.js" | |
android:label="@string/app_name" | |
android:theme="@style/Theme.Titanium" | |
android:configChanges="keyboardHidden|orientation|screenSize"> | |
<intent-filter android:label="Save This to MyOwn App"> | |
<action android:name="android.intent.action.SEND"/> | |
<category android:name="android.intent.category.DEFAULT"/> | |
<data android:mimeType="*/*"/> | |
</intent-filter> | |
</activity> | |
</activities> | |
</android> | |
<!-- … --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I also tried to put everything within the
<application>
tag. But it doesn't work either, probably because no url attribute is allowed…But the second registered activity is just ignored.