Android static App Shortcut is not showing - android

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.

Related

Android Studio How to run application but it should not have launcher

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.

No launcher icon but still able to be opened

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.

Modified AOSP app launcher asks complete action using?

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.

I have two app icons in Recent Applications , how to avoid?

I have two activities in "Recent Applications". For those that don't know, Recent Applications is when you long press the home button.
I know why this happens. I am starting my app from a BroadCastIntentReceiver. Then I start my app from the normal launcher icon.
When I press the first icon in Recent Applications, the app opens from the Main activity. However, when I press the second icon, the app opens from the place where the BroadCastIntentReceiver starts the app, this is called PictureActivity.
I have been looking into taskAffinity and am having trouble deciding the most simple way to solve this issue.
Thank you!
When your BroadCastIntentReceiver builds its intent to launch the PictureActivity, try setting this flag on the intent:
intent.addFlags( Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS );
Reference: Android dev site.

Launch Android Widget from Activity

Is there any way we can launch the android widget from our application immediately application installation or by showing button(eg:- 'Add Widget') within the application. So it like automatically add widget to our home screen using code.
Thanks
Prakhs
I'm not sure I understand the question fully, but I'll give it a try:
There is no way to start an application automatically after it was installed.
There is the ACTION_PACKAGE_ADDED Broadcast Intent, but the application being installed doesn't receive this.
Android applications can not add App Widgets to the home screen. Applications can define App Widgets, but user has to add them manually to the home screen.

Categories

Resources