For a test, I've modified the AOSP "Music" app a little. In the manifest, I've made the following changes:
Change package name from "com.android.music" to "com.android.mymusic"
Change android:label from "Music" to "MyMusic" (for ease of identification)
On other apps, I've also had to make sure all class names in the manifest were fully qualified, but in "Music" they already were. This is enough that I can build, install, and get an icon in the app drawer. However, when I try to launch my customized music program (with either an intent, or by touching the launcher icon), I always get the "complete action using" dialogue. This is a problem because I need to launch it from another app, using an intent, and I can't allow user interaction. It seems especially strange to me that the launcher icon wouldn't just launch my customized app directly.
Why am I getting the "complete action using" dialogue, and how do I bypass it?
Try taking
android.intent.action.MUSIC_PLAYER"
out of your intent-filter for com.android.music.MusicBrowserActivity.
Related
I created app shortcut as specified in https://developer.android.com/preview/shortcuts.html. Despite running on API 25 and Pixel launcher, app shortcut is not showing on launcher screen. What might be the cause?
Using reference (#string) as shortcutId results in app shortcut silently not showing up.
Check this
Only main activities—activities that handle the Intent.ACTION_MAIN action and the Intent.CATEGORY_LAUNCHER category—can have shortcuts. If an app has multiple main activities, you need to define the set of shortcuts for each activity.
I have an application which I simply want to run but it should not have launcher Icon.
I have deleted this tag
category android:name="android.intent.category.LAUNCHER" />
But then Android studio starts to give error that
Could not identify launch activity: Default Activity not found
Error while Launching activity
then I switched the run configuration as the following :
What I want :
I just want that My application start running once I run it from the android studio , but it must not have launcher icon . SO that user should not be able to launch it by himself.
Note:
I do know that it is not legal we should have activity so that user can se it , use it and change something if he wants. But that is not the case in my app as the user want himself to hide its launcher so that no body knows about app. So do not worry about such case. :)
I have an application which I simply want to run but it should not have launcher Icon.
Then your app will never run.
running service or broadcast receiver
Your app, once installed, is in a stopped state. None of your code will run until something uses an explicit Intent to start one of your components. Normally, that is the launcher icon. Other possibilities include if the user sets up an app widget, or if your app is a plugin for some other app (and that other app uses an explicit Intent to start one of your components). Outside of those scenarios, your app will never run. This is to help prevent malware.
the user want himself to hide its launcher so that no body knows about app
You will still need a launcher icon. However, when the user runs your app, you can use PackageManager and setComponentEnabledSetting() to disable that activity, so it will no longer show up in the launcher.
I have got an app that is using "plugin apps" (apps without launcher icon that get started via intent by the main application) and i want to have the Play Store "Open"-Button for this application to just open the main application.
Is there a way of not having the launcher icon but defining an entry point in order to launch the main application after play store install (by intent or launching a dummy activity which will launch the other applications activity immediatly).
I thought about removing the launcher category "android.intent.category.LAUNCHER" and still setting the main action "android.intent.action.MAIN". But this seems not to work at least via apk install the "Open" button is not active.
Thanks
You could try android.intent.category.INFO.
According to the documentation, this is for the case where you want to provide an entry activity for your app, but don't want your app to be shown in the app list.
Once my Home Screen app 'ABC' is installed on the device & when the user presses the Home Button, he is prompted with the Default Action Android dialog to choose between the Default Home & my ABC app.
My use case is to keep on prompting the user - a bit infrequently though, with this Default Action dialog till he selects my App as default.
How we can default action in android ?
Before ICS (and maybe Honeycomb), you could set the preferred activity using the PackageManager#addPreferredActivity method.
But as stated in the documentation :
This is a protected API that should not have been available to third party applications. It is the platform's responsibility for assigning preferred activities and this can not be directly modified.
This indeed could be used by Malware to change what applications the launcher icons start. I would really advise you not to use it and instead let your users the choice to make themselves your launcher their default launcher.
call the below intent when you need to see the 'launcher' selection dialog, unless one of the launcher apps is set as default
Intent homeIntent = new Intent("android.intent.action.MAIN");
homeIntent.addCategory("android.intent.category.HOME");
startActivity(homeIntent);
When downloading my app from Market, when I tap on the Open button to try to run it, a toaster message says: "The requested item could not be found on this device and so could not be launched." But in fact, it's downloaded alright and its icon shows in app screen, if I tap on the icon, it runs fine. But this message is really annoying and is a turn off for many users.
Does anybody have any idea? Thanks in advance!
EDIT: In this app, I have two launcher icons, launching two different activities. Could this be the cause? I mean, when the user clicks the Open button from Market program, which activity would be launch? The first one???
Turned out it's this:
In my app's manifest file, there used to be two launcher activities. That is, two activities with a category like this:
<category android:name="android.intent.category.LAUNCHER" />
This is not a mistake, it was intentional. Two activities launch different functionality of the app. I then changed one of them. I remove its LAUNCHER attribute and use CREATE_SHORTCUT instead:
<action android:name="android.intent.action.CREATE_SHORTCUT" />
Of course there is more to just the above, but the point is: Don't use more than one Launcher activities, or when the user clicks the Open button from Market app, it doesn't know which activity to launch. User Android's Shortcuts facility. (That is, long-press on any empty spot on Home screen, select Shortcuts from the pop-up menu. That's the Shortcuts I meant.)