Create shortcut in home screen on publishing android app in mobile - android

I am developing one android app its almost developed and I am able to successfully publish it in my mobile and its working fine, but its not creating a shortcut in home screen after install, can somebody please help me how to create shortcut after install.

This is the best answer I found (https://stackoverflow.com/a/23893035/2507782) because in this we are checking if shortcut already exist and along with this some modifications in manifest files are.
<activity android:name=".ShortCutActivity" android:label="#string/shortcut_label">
<intent-filter>
<action android:naenter code hereme="android.intent.action.CREATE_SHORTCUT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
and
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />

Related

How to stop Android activity opening from USB device being attached if activity is already open?

I am using the Android USB host and an intent to open an app when a device is connected to the phone. However, if the app is open, I do not want it to open again.
Below is the relevant code from the manifest file:
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="#xml/device_filter" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
I have Java code that can detect the device if the app is already open, so no need for the app to open again. In practice, this is just an annoyance. The app is open, and another "copy" opens on top of it.
Sounds like you need to set a flag in the activity's manifest entry.
Either singleTask or singleInstance, depending on your needs. See the documentation for what each means:
Hope that helps!

Put my app in the Google Now Phone search list (Android Global Search)

I want to make my app searchable in the Google Now quick search box. I followed some examples but it still doesn't work. The official doc isn't clear at all about how to make this case work.
Now after checking these stackoverflow issues, I start wondering if this feature is still available to the developer?
Is global search in android still available for developer?
How do I get my app to appear in Google Now's Phone Search list?
I do see a few apps still make into the "Phone search" list in the quick search box settings. If so, anyone can shed some light for me? My searchable config xml is as follows
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="#string/app_name"
android:hint="#string/search_hint"
android:searchSuggestAuthority="#string/search_authority"
android:searchSuggestIntentAction="android.intent.action.VIEW"
android:searchSuggestIntentData="content://some_search_authority"
android:includeInGlobalSearch="true">
</searchable>
In this AndroidManifest.xml file, I do have meta-data specified for the SearchableActivity e.g.
<activity ...>
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="#xml/searchable" />
</activity>
It's not possible (at least, yet).
Google Music has a Google Now card and to have something similar, you need to create your own.
Unfortunately, it has no public API yet: Google Now integrations
Now cards from apps are currently under development and are not available to all apps. We'll let you know when we are able to onboard more partners.
What you can do is to add your app into the list of suggestion for command "Play (Band name) (Song name)":
To make this happen, you have to add intent-fiters to your Activity, which should be opened to AndroidManifest:
<activity
android:name=".MusicActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
You can check out list of Google Now voice commands here: A list of all the Google Now voice commands
I hope, it helps

Running Google Glass sample app on Android Virtual Device(emulator)

I am trying to run the Timer sample google glass app, but when I run the project, it gets installed and then says DONE, however, I don't see anything on the emulator. I know there is no Launcher and so I tried the RUN CONFIGURATION but I don't see any activity in the dropdown when I chose the Launch option. Any thoughts or guides on to do this ?
First of all there is no avd/emulator available for Glass.But if still you are interested converting your mobile phone into glass.Check these link i.e 1,2,3.But no one works completely treating your phone as Glass.
As you have mentioned above that you try to install an app on emulator.The main reason why it is not showing up is that:
Move to AndroidManifest.xml
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
This is the normal code for the main launcher activity of android.This is the main activity which is launched in the emulator/avd
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
While in Glass code you find something like this.There is no launcher in Glass but still you can add.Here you only found out the voice trigger which open your app
<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="#xml/voicetrigger" />
</activity>

uninstall Application Password Protected

How to start an Activity or an IntentService before an application will be uninstalled by the user who has earlier installed the app on there device?
One way to achieve what you want would include the following steps:
(temporarily) rooting the device
converting the app in question into a system app (e.g. using Titanium Backup ★ root, but there are also other apps helping you with this step)
unroot the device again
As the app now resides in read-only space (/system), the user cannot delete it without either rooting the device or flashing a ROM -- which of course could be done, but it's a higher inhibition threshold at least.
There is no such thing as impossible with computers. There is only difficult and highly improbable to happen anytime soon. This is a fact not an opinion. Often someone says "impossible" and there is someone interrupting them saying "Just did it.".
You cannot prefend an user removing an application.
The DELETE intent will be send when the user requests to uninstall.
The PackageManager will receive this intent and start uninstalling the application.
So, without any Android modifications, you cannot add an password.
You have to use Intent filter called "android.intent.action.DELETE" in the AndroidManifest.xml
Like below
<activity
android:name=".Activity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.DELETE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="package" />
</intent-filter>
</activity>
This will call the activity.

Can't find my installed application

Greets,
Made some app on android. I for the life of me can't get it to install on the phone as a stand alone application. It runs fine when I deploy from eclipse but never remains on the device. any idea whats happening?
I put the apk file on a web server, went to the address downloaded and installed but still it wasn't to be found.
I'm lost!
Make sure your application manifest defines an activtity with a category of LAUNCHER. For example:
<activity android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Otherwise, the Android apps screen won't pick it up.

Categories

Resources