Hello,
I'm writing an app, which will require registration and email confirmation. In the confirmation email, there will be a link, which will open up the app again and fill out some forms.
In order to achieve this, I have to have two intent filters like this:
<intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="http" android:host="my.special.link"/> </intent-filter>Now with this configuration, everything is fine when I START the app using
my.special.link.
I will be able to get the URL from intent within current activity, that I get using Ti.Android.currentActivity.
However, If I have the app running, suspend it using Home button and then click on my.special.link, app will start a new activity.
The app is not resumed. It's kind of funny, because if I suspend the app started by clicking my.special.link, and will resume the app again I will get back to the one started with MAIN action.
This means, that when the app is started with MAIN action, user will fill out some forms, will suspend the app and "resume" it using link, all of the forms are blank. Then, if user suspends the app and resumes it again, all of the forms are filled again.
This is issue number one, however that's not all.
When the app is suspended and then "resumed" using my.special.link, I am not able to get the URL from intent. That's because Ti.Android.currentActivity does not point to the current activity, which was created using intent with the VIEW action [I probably confuse how this works, I am new to the whole intent/action/categories stuff].
Anyway, Ti.Android.currentActivity points to the activity app was started with, thus I can't get the URL.
It's easy to confirm what I wrote by adding some listeners to the currentActivity. I've added pause/resume listeners and none of them are fired. However if I suspend the app again [this means the app was started from launcher, suspended using home button, my.special.link was clicked and again it was again suspended using home button] and then resume it, my event listeners are triggered.
This looks like a bug to me. Or two bugs. Or just my lack of understanding how it works. Anyway, I would like to ask, how to implement this scenario:
- User launches the app from launcher, fills out some forms.
- User suspends the app and clicks on a special.link, which opens the app again
- The link used to resume the app is parsed and form is updated with some new data.
Thanks, Krystian
Your Answer
Think you can help? Login to answer this question!