I want to make an application in which we show the list of all apps which is installed in my phone with checkbox. When user checked the any application then that apps should be show on Launcher. Otherwise apps should be hide from Launcher.
Unless you code a launcher app too, it's not possible. Other launcher's will simply look at the apps manifest (using package manager) if it declares launcher intent or not.
In the case where both launcher and settings are in same app, best solution will be to use a shared preferences file:
Set<String> blacklistedApps;
//--add package names--
blacklistedApps.put("com.useless.uselessapp");
//--save as a preference--
SharedPreferences.Editor.putStringSet("blacklisted",blacklistedApps).commit();
//--read preference--
blacklistedApps = SharedPreferences.getStringSet("blacklisted",new Set<String>());
Related
I have to get the package name of all the applications installed on the phone which has a launcher i.e. which appears in the app list of the phone.
I know pm list packages lists down all the package but it also includes the services and system applications. I want only the apps which show up on the app menu of the phone.
Also I don't want to use monkey runner, any other alternative would be great.
Any help?
Try calling getLaunchIntentForPackage() in PackageManager on each package installed. If it returns null, then it has no launcher. Although you may get a few false positives from apps with a MAIN activity but without a launcher.
I am trying to make a small application that can launch an application, not usually shown in the app drawer. This application is generated by the system and is carrier specific. It belongs to the package com.android.stk - for those of you who don`t know it is the SIM Toolkit application. The SIM Toolkit application itself can not be launched, but when I insert my sim card, it creates a carrier specific application - In my case: Dialog Services, which can be run to make changes to sim settings.
The problem is that the package name for the Dialog Services app is still com.andorid.stk . All I want to do is open up that app. Is there any way to do this... Possibly search for all apps within com.android.stk and selecting or launching that one...
I am relatively new to Android dev, so All help is appreciated.
You can launch any installed application whose package name is known:
Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("com.andorid.stk");
startActivity( LaunchIntent );
I want to install another applications from my App, likes Google Play. When applications installed, I want to remove their icon launcher (my application will manage them). Can I do it?
No, you cannot manage another APK's files from within yours, as it would be a security risk. If you wanted to manage the apps from your app however you could create intents to launch them from your application using where (just replace the String with the name of the launch activity defined by the applications android manifest):
Intent launch = ("otherApplicationActivity");
startActivity(launch);
you can make launcher icon for app in mainfest.xml
` <application
android:icon="#drawable/ic_launcher"
/>
`
How do I make my android app the default application to open a certain file type?
I tried to clear the defaults but the option is greyed out, does anyone know how to do this?
I want to make my app open with my something.whatever files in android.
You cannot force this, and you shouldn't be able to. What you can do is make known your app can open the filetype. The user gets the standard "what program do you wish to use" dialog, and the user can select something as default.
If the user has allready selected a default, he/she needs to undo that before the dialog appears (obviously, otherwise a 'default' wouldn't have a lot of effect, now would it?)
You can tell the world (aka: android) that you want to open a certain file type by adding an intent-filter. What you basically do is put in your manifest that an activity in your app knows how to handle the filetype (or website/protocol etc). That's quite easy to find, a random question here on SO about the same issue would be: Android intent filter for a particular file extension?
This subject has already been covered here: Register to be default app for custom file type
Add it to you intent-filter:
<intent-filter >
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/pdf" />
</intent-filter>
In Android, how to associate file with a different program.
I'm using a "Droid Maxx" with Android Version 4.4.4
How to make a something.html file open with a file editor instead of firefox after you've associated firefox to always be associated with *.html files.
You have to clear out the default setting for the app that has associated with a filetype.
Do this
Go to "Settings". It's in the app list.
Under Device, click "Apps".
Scroll down and click Firefox.
Under the "Launch by default" entry, click "Clear defaults".
Open your something.html file again.
Once again you are presented with a choice with what kind of program you want to open this file with.
If you want to associate and disassociate file types with apps indivdiaully:
There is a third party app called: Default App Manager Lite:
https://play.google.com/store/apps/details?id=com.appiator.defaultappmanager
Then you can run the program and manage your filetype -> default app associations individually.
I think in android every app/activity must have some intent actions and categories in its manifest file. In this intent settings only you have to make your app as default.
Even you write default in manifest, if any other apps found with same intent settings, android system will display all apps with same settings. user has to select one of them, there only it provide one check box to make one app as default for next time onwards. If user didn't check it the list will be displayed every time user opens the file.
I hope it may help you.
Try this
Intent i = new Intent();
i.setAction(android.content.Intent.ACTION_VIEW);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.setDataAndType(Uri.parse("file://"+path),
"application/vnd.android.package-archive");
startActivity(i);
The path variable is your path.
We know how to hide an app in app drawer (launcher) referring to hide one application in application menu of android , however, could we hide app itself within its code? I mean is it possible to remove activity's intent filter
<category android:name="android.intent.category.LAUNCHER" />
dynamically within its code.
No. The manifest is read by the Android package manager system when it is installed. Afterwards, these values are read from it's own datastore and not from the manifest so without modifying the PackageManager or installing a different version of the app, these settings cannot be changed.
AFAIK, this isn't possible. The manifest states what your application can or can't do.
Think about permissions : they are required for proper code execution, but you can't change them once your application is installed. That should be the same for intent filters.