Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20490] Android: Apps should be able to open/resume and respond to intents

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-09-30T16:22:36.000+0000
Affected Version/sRelease 5.2.0, Release 5.2.1
Fix Version/sRelease 6.0.0, Release 6.1.0
ComponentsAndroid
Labelsn/a
ReporterFokke Zandbergen
AssigneeGary Mathews
Created2016-03-01T09:30:37.000+0000
Updated2017-01-06T23:29:47.000+0000

Description

Attachments

FileDateSize
com.alloy.zip2016-09-26T18:37:45.000+00001490484

Comments

  1. Fokke Zandbergen 2016-03-01

    /cc [~msamah] [~jasonkneen]
  2. Ajith Rohini 2016-08-19

    [~msamah], [~sliang] Is it okay if I send the above link to client to test it ?
  3. Ashraf Abu 2016-09-06

    For a classic app, with this Branch: https://github.com/ashcoding/titanium_mobile/tree/TIMOB-20490a 1) Build the app and run it 2) Go to the directory of the app, head to /build/android/AndroidManifest.xml 3) Get the XML for the activities in the application 4) Add the intent-filter to the xml
       			<intent-filter>
       				<action android:name="android.intent.action.SEND"/>
       				<category android:name="android.intent.category.DEFAULT"/>
       				<data android:mimeType="text/plain"/>
       			</intent-filter>
       
    The resulting XML will be this.
       	<application android:icon="@drawable/appicon" android:label="testapp" android:name="TestappApplication" android:debuggable="false" android:theme="@style/Theme.AppCompat">
       		<activity android:configChanges="keyboardHidden|orientation|screenSize" android:label="testa" android:name=".TestappActivity" android:theme="@style/Theme.Titanium">
       			<intent-filter>
       				<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>
       		<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"/>
       	</application>
       
    5) Take this and merge it into the tiapp.xml. 6) Add the following code to the top of app.js
       
       Ti.Android.currentActivity.addEventListener('onIntent', function(e) {
           // code here is run when the event is fired
           // properties of the event object 'e' describe the event and object that received it
           Ti.API.info('The '+e.intent+' event happened');
           var intentObj = e.intent;
           var stringItem = intentObj.getStringExtra("android.intent.extra.TEXT");
           if(stringItem){
               var win1 = Ti.UI.createWindow({
                    title:'Received',
                   backgroundColor:'#fff'
               });
                var label1 = Titanium.UI.createLabel({
                   color:'#999',
                   text: stringItem,
               });
               
               win1.add(label1);
               win1.open();
               Ti.API.info('Successfully received:'+stringItem);
           }
       });
       
    7) Run the app 8) Git clone https://github.com/ashcoding/AndroidIntentExample and change the packageName and activityName in Android Studio and run the app 9) Click the button in AndroidIntentExample app. It will open the Titanium App and pass the string data. For alloy, it's still being looked into.
  4. Gary Mathews 2016-09-26

    master: https://github.com/appcelerator/titanium_mobile/pull/8433
  5. Tim Poulsen (ACV) 2016-10-03

    will this be released in 6.1 like the other two tickets referenced in that PR? (ticket has no Fix Version/s)
  6. Christopher Williams 2016-10-03

    Hey [~acvauctions]! Yeah, this PR was merged to SDK master, which is the current 6.1.0 targeted branch. We have a handful of tickets around the same area, and I think they might be worth trying to get in 6.0.0 - I'll bug Kiat.
  7. Chee Kiat Ng 2016-10-03

    [~gmathews] please backport.
  8. Christopher Williams 2016-10-05

    cc [~acvauctions] These intent/activity related bug fixes have now beenbackported to 6_0_X, should should be on that branch and in the upcoming 6.0.0 release.
  9. Tim Poulsen (ACV) 2016-10-05

    Thank you! :D
  10. Samir Mohammed 2017-01-06

    Verified fixed, was able to follow the instructions mentioned in the following PR https://github.com/appcelerator/titanium_mobile/pull/8433 *Environment*
        Appcelerator Command-Line Interface, version 6.1.0
        Android 7.1 (Google Nexus 6P)
        Operating System Name: Mac OS X El Capitan
        Operating System Version: 10.11.6
        Node.js Version: 4.6.0
        npm: 4.2.8
        Titanium SDK Version: 6.1.0.v20170105103604
        Xcode: 8.0
        Appcelerator Studio: 4.8.1.201612050850
        

JSON Source