Need assistance with the Android Manifest XML File within my Launcher App - android

Hoping someone can point out my failure here. Ive developed a custom launcher app which I want to replace the home screen. I also want the activity accessible via a custom URL "myapp://launcher.android.com."
I'd love to explain why, but to cut a long story short, the Android Gods demanded that I consolidate two activities (each working fine) into a single Activity.
Can someone check over my manifest file to point out any errors or fields I need to fix? Or even a superior alternative?
<activity
android:name=".KioskLauncher"
android:label="#string/app_name"
android:theme="#android:style/Theme.DeviceDefault.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
<intent-filter>
<data android:scheme="myapp" android:host="kiosk.androiddev.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>

You need an extra attribute to be added to the activity tag.
Try adding this to the activity tag:
android:launchMode="singleTask"

Related

Why is my app not showing in the grid of icons (not the launcher) after installation

I recently started testing my react-native android application and noticed that it doesn't create an app icon on installation. When I debug - it seems to install and run fine, but when I look for it in the app icon to launch - it does not show up. Looking at the list of installed apps, it's there. How can I debug this? Do I need to change the launch mode from singleTop to something else? I tried changing it to singleInstance and it still had the same issue. If I remove some of the intent filters it seems to work - so maybe I messed up the branch.io installation instructions? Do I need to create a seperate intent filter xml node for the other intents? https://dev.branch.io/getting-started/sdk-integration-guide/guide/react/#android-configure-manifest
AndroidManifest.xml
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:launchMode="singleTop"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<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="www.foo.com"
android:pathPrefix="/event" />
<!-- note that the leading "/" is required for pathPrefix-->
<data android:scheme="fooapp" android:host="open" />
</intent-filter>
<intent-filter>
<action android:name="fcm.ACTION.EVENT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Update
Splitting up the intent-filters seems to have fixed it - but a bit unclear if that is the correct thing to do. In the branch.io instructions - did they mean for me to create a new intent-filter and not add to the existing main one?
<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="www.foo.com"
android:pathPrefix="/event" />
<!-- note that the leading "/" is required for pathPrefix-->
<data android:scheme="fooapp" android:host="open" />
</intent-filter>
The launcher is typically specific software developed by the individual hardware manufacturers. On all of the devices i have, an app does not get installed on the homescreen when it is not installed from the play store, but it does show up in the list of apps. However, that behaviour will be specific to the launcher you are using i think.
You should not need to go to settings->apps though just to see it. Is that the problem you are having?
Perhaps a screenshot as well as a description of your test device (s) would make the question clearer.
Update....
Typically the startup activity has one intent filter with only MAIN and LAUNCHER. I would just try to remove the other things from that intent filter and see if that resolves the problem. Then one by one, add the rest of the things you have listed until you identify the problem child.
Looking at this again, I am not sure that you can define 2 actions in a single event filter. So it seems you need to remove VIEW.

Open Android App with custom URL scheme

this questions has been asked in a similar way like a hundred times, though I still cannot find a proper answer to get my app to work the way I want. Maybe this is not possible which would be a valid answer of course.
I have an activity defined as follows in my app:
<activity
android:name="MyActivity"
android:label="MyActivityLabel"
android:launchMode="singleTask" >
<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="MyActivityCustomUrlScheme" />
</intent-filter>
</activity>
When I start my App in the emulator and then open the browser and type a URL like:
MyActivityCustomUrlScheme://mycustomHost.com?someOptions
the only thing happening is that chrome tries googling for it, which is not what I want. If I send myself an SMS with this scheme, the scheme inside is not recognised as such and not clickable :(
I want to do that, because I already have an iOS App in the store, which uses the scheme MyActivityCustomUrlScheme://mycustomHost.com?someOptions and it would be a lot of hazel to change it everywhere, as users get this url send by email or SMS. I'd be really thankful if someone can help me out on this problem.
Try to use definition of host :
<activity android:name="MyActivity"
android:label="MyActivityLabel"
android:launchMode="singleTask">
<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="MyActivityCustomUrlScheme" android:host="mycustomHost.com" />
</intent-filter>
</activity>

Background call android

I need to do background calls. I mean, I don't want to show the android call interface when the program makes a call I want to show my own interface, is there any way to do it?
Thank you!
It's not possible at the moment. For phone calls, it will always show the dialer screen.
Though it is not recommended to do, you can achieve that by linking an Activity with the call.
<activity
android:name=".activities.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- open activity when establishing a call -->
<intent-filter>
<action android:name="android.intent.action.CALL_PRIVILEGED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="tel" />
</intent-filter>
</activity>

Android Intent-Filter for Multi Screen

I want to launch my application from web browser in Android using Intent-Filter based on scheme, host in the DATA tag like this.
<activity android:name=".activity.LogoActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activity.phone.MainActivityPhone" android:configChanges="orientation|keyboard"
android:launchMode="singleTask">
<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="my" android:host="mystore" />
</intent-filter>
</activity>
<activity android:name=".activity.tablet.MainActivityTablet" android:configChanges="orientation|keyboard"
android:launchMode="singleTask">
<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="my" android:host="mystore" />
</intent-filter>
</activity>
As you see, There are two Main Activities for phone and tablet, and in LogoActivity determine which Main Activity will be opened by screen size. But the problem is when user clicks my://mystore link in web browser, there are two choices to launch that MainActivtyPhone and MainActivityTablet.
What I want is there is only one proper intent-filter works for uri my://mystore .
Any help? Thanks.
On the first run of your application, use PackageManager to disable the activity you do not want to use.
Please do not invent custom schemes. Please use HTTP URLs instead:
<data android:scheme="http" android:host="yourdomain.com" android:path="/something/or/another" />
That way, you can actually put a real Web page at http://yourdomain.com/something/or/another, so if somebody gets your link but does not have your app installed, they will see your Web page, instead of getting an error.
Also, please remove android:configChanges, or handle all configuration changes.

Could not launch application by calling a URL from Android Browser

There are many answers in stackoverflow showing how to lauch app from a web browser ,but I am not sure what went wrong with my code, that never seems to be doing the intended.
I am trying to launch my app by a URL from any other app like web browser,initially
my manifest file looks like this
<activity android:name=".Main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="http" android:host="ebay.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
And When I typed http://ebay.com in the browser that never started my app.Obviously,how does the browser know about my app?,then i tried the other way around and added another Activity called MyActivity and altered the manifest file as
<activity android:name=".Main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MyActivity">
<intent-filter>
<data android:scheme="http" android:host="ebay.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
and tried in my Main Activity
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("http://mycityway.com")));
Thus producing the intended result.I can also start another application Activity using this method.
But most of the answers here says that the later is possible.What is the mistake i am doing,I couldn't launch my app from browser.Please guide me.
And When I typed http://ebay.com in the browser that never started my
app.
It gets started when a matching link is clicked not when you type the url in the browser.
Try it by sending yourself an email containing http://ebay.com and click the link in the email application.

Categories

Resources