Hello everyone,
What is supposed to happen: 1.) receive email with a custom file with extension ".custom" 2.) click on file and select "open with CustomApp" 3.) App reads file and stores the data somewhere 4.) Ideally the user could just continue to use the app normally
I have manged to setup custom filters:
<activity android:name=".CustomappActivity" android:label="@string/app_name" android:theme="@style/Theme.Titanium" android:configChanges="keyboardHidden|orientation|screenSize" android:screenOrientation="fullUser"> <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"/> <data android:scheme="content" android:pathPattern=".*\\.custom" android:mimeType="*/*"/> </intent-filter> </activity>What happens now when I open a .custom file in CustomApp? It seems to me as if regardless of whether the app is currently running in the background or not a new CustomappActivity gets launched. However both activities seem to share a namespace or something, because the newly launched one is not able to get the WebView UI up and running. So this seemed to be leading me nowhere.
What I have now done is implement a "check for intent" before I start my app properly. If it was started with an intent I just store the data of the .custom file in my App.Properties and then try to close the currently running instance of the app (via Ti.Android.currentActivity.finish()).
However the Activity (or something else) seems to still be running, because when I open the app back up (even if it was running while I did the other things, once I select it in the task manager it starts up from the beginning) only bad things happen:
Every call from the WebView to the app and vice versa gets made more than once (depending on how often the App has been started after the first opening of the .custom file). This obviously makes the app unusable because nothing works.
Even killing the app in the task manager does not always reset everything so that a call only gets made once.
Can anyone guess what's up here?
Or even better give me guidelines on how to implement the use case properly? While I do not fully understand the whole activity complex and how it interacts with appcelerator I'd reckon that this may not happen if I wouldn't call my main launcher activity with the intent but another custom activity that's only responsible for importing the data from the .custom file and nothing else. But how does one create a custom activity with titanium?
Thanks for any help or nudge in the right direction!