Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24316] Android: Can't get the right URL if app resume by URL for the second time

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2017-04-21T22:35:45.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.0.4
ComponentsAndroid
Labelsn/a
ReporterShuo Liang
AssigneeGary Mathews
Created2017-01-17T01:13:57.000+0000
Updated2017-04-26T15:11:07.000+0000

Description

Reproduce:

1. Run the attached app, (Simple app to check the URL which resumed the app) 2. Close the app. 3. Start test with following steps 4 Start app from the link (banking.meridiancu.ca/test_login) (from URL in email in this test) 5. Navigate to next page 6. Pause the app 7. Resume app using different link (banking.meridiancu.ca/security_login) 8.. Observe app resumes successfully. But when you click Check URL button It shows link with which the app was initially started. (banking.meridiancu.ca/test_login)

Expect

The URL should be the exact one on resume or start the app.

Attachments

FileDateSize
openLinkTester 2.zip2017-01-17T01:13:48.000+00009800051
TIMOB-24316_fix.gif2017-03-21T16:00:35.000+00001465752
TIMOB-24316_issue.gif2017-03-21T14:20:16.000+00002924960

Comments

  1. Gary Mathews 2017-02-16

    This PR should resolve your issue: https://github.com/appcelerator/titanium_mobile/pull/8747 It is currently in review.
  2. Nikita Radaev 2017-02-22

    HI Gary, Great to hear this. Could you please compile an SDK with this PR so I can test as well? Thanks, Nikita.
  3. Lokesh Choudhary 2017-03-13

    [~nradaev], You can check if this fixes your issue with SDK 6.0.3.v20170310122139.
  4. Lokesh Choudhary 2017-03-13

    PR : https://github.com/appcelerator/titanium_mobile/pull/8747 & https://github.com/appcelerator/titanium_mobile/pull/8879 has passed FR & been merged. Closing this ticket.
  5. Nikita Radaev 2017-03-17

    Almost there. This fix only works when the app was originally launched using app icon. It does not work when the app was launched using URL. Here is the test case: 1. Start the app via URL: banking.meridiancu.ca/test_login 2. Pause the app 3. Resume the app via different URL : banking.meridiancu.ca/security_login 4. Pause the app 5. Resume the app using original URL: banking.meridiancu.ca/test_login Observe: no alert thrown, when "Check URL" is clicked banking.meridiancu.ca/security_login is being printed out. Not sure if that helps, but I am opening URL's via email (this is how we intend to use this feature). Thank you, Nikita.
  6. Nikita Radaev 2017-03-17

    Tested on S7 using SDK 6.1.0.v20170315005008
  7. Lokesh Choudhary 2017-03-20

    [~nradaev], The url's in your test can't be accessed. Can you provide other url's which we can access ? I tried with similar intent-filter"
       <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:scheme="http"/>
                               <data android:scheme="https"/>
                               <data android:host="www.android.com"/>
                               <data android:pathPattern="/.*phones"/>
                               <data android:pathPattern="/.*wear"/>
                           </intent-filter>
       
    Followed your steps in your most recent comment & I am opening the URL's from gmail. When I resume the app second time with the original URL, I do get the original URL. My app.js code:
       var win = Ti.UI.createWindow();
       
       var lbl = Ti.UI.createLabel({
       	text:'Check URL',
       	top: 60
       });
       
       lbl.addEventListener('click',function(){
       	Ti.API.info('************************************ URL :'+Ti.Android.currentActivity.intent.data);
       	alert(Ti.Android.currentActivity.intent.data);
       });
       
       win.add(lbl);
       win.open();
       
  8. Nikita Radaev 2017-03-20

    Hi Lokesh, I've tested your example and the reason it appears to be working for you is because 2nd URL never shows up! (OOPS...) If you look closer at my original example you will see that I utilize Alloy.Globals.lauch_url to see which URL is being opened/resumed with. This is because every time I resume/open the app It is being reloaded (except for my buggy case). I am fine with this behavior as long as it is consistent. Furthermore, you do not even need a working URL in order to test my example. Intent-filter intercepts intent request and is supposed to open/resume the app instead of opening URL with the browser. If you insist that this is a working fix, I will need a video demonstration as well as a working project code. Nikita.
  9. Lokesh Choudhary 2017-03-21

    Reopening to look further into this issue.
  10. Gary Mathews 2017-03-21

    master: https://github.com/appcelerator/titanium_mobile/pull/8897
  11. Gary Mathews 2017-03-21

    6_0_X: https://github.com/appcelerator/titanium_mobile/pull/8901
  12. Nikita Radaev 2017-03-22

    Hi Gary, Here is a short video to display behaviour I am experiencing. https://drive.google.com/file/d/0B_ilPkP8PASfeUpJZmVWaDFRa2s/view?usp=sharing Nikita.
  13. Eric Merriman 2017-03-22

    Due to the complexities with Kroll related to intents, we are unable to resolve this for 6.0.3. We tried several commits and test cycles and there were issues with each. So we will move this to a 6.0.4 release, in order to provide a well engineered and well-tested fix.
  14. Gary Mathews 2017-03-28

    6_0_X: https://github.com/appcelerator/titanium_mobile/pull/8910
  15. Lokesh Choudhary 2017-04-21

    FR Done. Merged 6.0.4 PR waiting for build from CI to close.
  16. Lokesh Choudhary 2017-04-21

    Verified the fix in 6.0.4.v20170421153428. Closing.
  17. Creative 2017-04-26

    I've just tried version 6.0.4.v20170425123820 and this solution seems sub-par. The app DOES consistently receive URL intents now, but the way it reloads the app every time seems very wrong. The way it restarts my app (as judged by the splash screen that i see occurring when clicking my custom URL scheme from the android browser) cant be correct. I'd very much like to see a how-to or a testcase in where both the tiapp.xml as the js-implementation is shown on how to properly catch such events. There is a possibility I have something wrong in my code but I really cant tell by looking at the existing guides. Also, the addition of custom tiapp.xml properties like "intent-filter-new-task" blurs the correct implementation even more.

JSON Source