Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

intent for opening url creates new instance

$
0
0

Hey guys,

I'm developing an android application and I am having some problems handling intents for opening an url on a sms. I added an intent-filter on the androidmanifest, like this:

<activity android:name=".TestActivity"
    android:label="Test" android:theme="@style/Theme.Titanium"
    android:configChanges="keyboardHidden|orientation"
    android:screenOrientation="portrait"
    android:launchMode="singleTop" >
    <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.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="http" android:host="test.com" />
    </intent-filter>                
</activity>
Then, on my app.js I need to get the text of the url clicked to grab some parameters, so I do:
intent = Ti.Android.currentActivity.getIntent();
var data = intent.getData();
This works almost fine if I set launchMode="singleTop". The problem is that it opens a new instance of the application. How can I avoid that? I have tried with launchMode="singleTask" and "singleInstance"; in that case no new instance is created but I can't get the data of the intent as it's always null.

Please, I need some help with this. I have been trying to solve it for many days but nothing worked. Thanks!!


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>