Android - Swiping the app from recent apps doesn't kill the application - android

I try to kill the app by swiping from the recent apps but the application is still alive. There is a singleton object that keeps the session information in the Application class. When I restart the app after swiping, this singleton is still kept. So there is still a valid session.
This happens sometimes and not reproducible for each try. It probably(I'm not sure) happens after starting an activity with a Uri
val intent = Intent(Intent.ACTION_VIEW)
intent.data = Uri.parse("myapp://someactivity")
startActivity(intent)
Target activity in AndroidManifest.xml:
<activity
android:name="TargetActivity"
android:label="#string/app_name">
<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="myapp" />
<data android:scheme="myapp2" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="#string/url_host"
android:pathPrefix="#string/url1"
android:scheme="https" />
<data
android:host="#string/url_host"
android:pathPrefix="#string/url_2"
android:scheme="https" />
</intent-filter>
</activity>
I faced the problem on various Android versions (6, 7, 8).

Related

Android 6 - cannot open app url from chrome

I had setup intent filter in manifest.xml, such as follows:
<activity
android:name="indexgifto.android.ui.viewcontrollers.SplashScreenActivity"
android:label="#string/application_name"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustNothing"
android:theme="#android:style/Theme.Translucent.NoTitleBar"
android:screenOrientation="portrait" >
<intent-filter>
<data android:scheme="gifto"/>
<data android:scheme="http" />
<data android:host="www.gifto.net"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
When I execute 'am start http://www.gifto.net/go.php?c=xlh201' application successfully opens with required data. But, when same URL opened via Chrome, just server page opens. In the android 4 in both cases my app was able to start from this url. What I must fix in android 6?
Chrome for Android, versions 25 and later, you should implement a user gesture to launch the app via a custom scheme, or use the “intent:” syntax described in this article.
https://developer.chrome.com/multidevice/android/intents
this worked for me you to try once if worked for u.
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:host="www.youtube.com" android:scheme="http" android:pathPrefix="http"></data>
</intent-filter>

Android intent-filter not filtering pathPrefix

We have lots of activities, but two were designed to start optionally from a URL using intent-filter. These two activities have the same scheme and host, but they have different pathPrefix. When we used a URL that matched one of these, it would just show our app once along with any browsers. Now, it is showing our app for any URL that matches the scheme. What we most care about is that its showing our app twice in our supported testing scenarios.
Does anyone have a workaround or know that this is a bug since we used to get the desired behavior? Does someone know what we changed that broke this (we have switched API level, build tools version, etc).
<activity
android:name="com.ConfigurationLoadingActivity"
android:label="#string/title_activity_configuration_loading" android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:noHistory="true" >
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="#string/app_intent_filter_host" android:pathPrefix="/mobilecloud/configuration" />
</intent-filter>
</activity>
<activity
android:name="com.SchoolSelectionActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:label="#string/title_activity_school_selection"
android:noHistory="true" >
<intent-filter android:label="#string/configuration_list">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="#string/app_intent_filter_host" android:pathPrefix="/mobilecloud/cloud" />
</intent-filter>
</activity>

Listening to YouTube links using intent filter

I am trying to make my app listen for YouTube links much like how how YouTube app does. I have an activity with the following intent filter:
<activity android:name=".YoutubeLinkActivity" android:label="#string/app_name">
<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="youtube.com"/>
</intent-filter>
</activity>
However, the app that opens up is the default YouTube app rather than mine. I tried the same intent filter for other host, too. In that case, the browser just goes to the next page rather than firing up my app.
What needs to change here?
I faced similar issue and interestingly it was working fine in Android 2.3.7.
To make it run on JB and above, I added android:pathPrefix="" to my <data> tag. So my <intent-filter> looked like:
<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:host="android.app.myWeb.pk"
android:pathPrefix=""
android:scheme="http"/>
<data
android:host="android.app.myWeb.pk"
android:pathPrefix=""
android:scheme="https"/>
</intent-filter>

Link from Android browser to my application not working

I want from the android browser be able to launch my application if it's installed, or launch my website in the other case.
So in order to make it work, I put :
<activity android:name=".MMLogin" android:label="MeetMe" android:theme="#android:style/Theme.NoTitleBar" android:screenOrientation="portrait">
<intent-filter>
<data android:scheme="http" android:host="meet-me.com" android:path="/signin" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
in the Manifest, and I created a dummy link to test; and it's not working.
I've tried with and without: BROWSABLE and DEFAULT
I've tried with meetme://datas and change the scheme; nothing worked.
I used threads on stackoverflow like :
Launch custom android application from android browser
What am I doing wrong, or is there a special thing to do to make it work ?
My application suppports from API 7.
Cheers
I used :
Intent Filter to Launch My Activity when custom URI is clicked, I think what was missing is this block :
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/myapp" />
</intent-filter>

Intent filter for browsing XML (specifically rss) in android

I have an activity that I want to run every time the user goes to an xml (specifically rss) page in the browser (at least assuming the user get's it from the list of apps that can support it).
I currently already have the current intent filter:
<activity android:name=".activities.EpisodesListActivity"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<category android:name="android.intent.category.BROWSABLE"></category>
<category android:name="android.intent.category.DEFAULT"></category>
<action android:name="android.intent.action.VIEW"></action>
<data android:scheme="http"></data>
</intent-filter>
</activity>
Now as you can guess, this is an evil intent, as it wants to open whenever a page is requested via http. However, when I ad the line:
<data android:mimeType="application/rss+xml"></data>
to make it:
<activity android:name=".activities.EpisodesListActivity"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<category android:name="android.intent.category.BROWSABLE"></category>
<category android:name="android.intent.category.DEFAULT"></category>
<action android:name="android.intent.action.VIEW"></action>
<data android:scheme="http"></data>
<data android:mimeType="application/rss+xml"></data>
</intent-filter>
</activity>
The application no longer claims to be able to run rss files.
Also, if I change the line to:
<data android:mimeType="application/xml"></data>
It also won't work (for generic xml file even).
So what intent filter do I need to make in order to claim that the activity supports rss.
(Also, bonus points if you can tell me how I know what URL it was the user opened. So far, I've always sent that information from one activity to the other using extras).
Thank you for your help
try this as your intent-filter
<intent-filter android:label="#string/app_name">
<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:mimeType="application/rss+xml" />
<data android:mimeType="application/atom+xml" />
<data android:mimeType="application/xml" />
<data android:mimeType="text/xml" />
</intent-filter>

Categories

Resources