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"
/>
`
Related
Does the Android Manifest check for the available components to be used before an application starts running, or does the system check for the Android Manifest every time a new component is being instantiated? By components I mean activities, services, etc...
What is the process involved?
Also, can an application still go back and forth to check on the android manifest even after it is running to check on xml activity attributes such as the android:name, android:label, or even intent filters, for different purposes such as to see whether a component to be used has already been defined?
Well to say it in a simple way-
Manifest contains permission like- "SD card read/write permission". So, while installing an app if you don't have a SD card than your won't get installed.
Again manifest contains "minimum SDK version"- which checks what OS version you have in your mobile, if your mobile OS version is less than the minimum version defined in manifest than the app won't install in your mobile.
In the manifest you have a list of all the activities and services too. So, without adding these in the manifest- your activities/services wont work.
So, these sort of checking and permissions are in manifest - the information the system must have before it can run any of the app's code.
Hope i have been able to keep it short and simple :-D
The manifest is a part of the app - it gets packaged with the app in its installation APK.
The manifest tells the system what APIs the application will use. When the app is installed, the system tells the user what sets of potentially sensitive APIs the application will use (as listed int he manifest) and if the user allows the app to be installed the system then assumes that the use of those APIs is permitted.
The OS will not permit the app to use other sensitive APIs that the app did not declare in the manifest.
Android Manifest file contains important information like the Java package name of the application, permissions, descriptions about activities,services... The system must have these information before running the app code.By this reason, the system doesn´t check the Android Manifest in runtime.
More here:
Android Manifest - Android Developer
if I have a Service or an Activity that I want to be started only by another Activity in my app, do I need to declare it in the manifest? I.e., I always launch a secondary activity from the primary activity of my app that directly points the secondary activity's class (no intent filter resolution), is still necessary to declare the secondary activity in the manifest?
And what if I don't want anyone outside my app to be able to launch my secondary activity?
1.YES
2.YES
3.set exported false in the manifest.
Read here for more information
What is Manifest?
Manifest file for an android application is a resource file which contains all the details needed by the android system about the application. It is a key file that works as a bridge between the android developer and the android platform. It helps the developer to pass on functionality and requirements of our application to Android. This is an xml file which must be named as AndroidManifest.xml and placed at application root. Every Android app must have AndroidManifest.xml file. AndroidManifest.xml allows us to define,
The packages, API, libraries needed for the application.
Basic building blocks of application like activities, services and etc.
Details about permissions.
Set of classes needed before launch.
Do I need to declare it in the manifest?
Yes
Is still necessary to declare the secondary activity in the manifest?
Yes
What if I don't want anyone outside my app to be able to launch my secondary activity?
android:exported="false"
We must declare in AndroidManifresh according to https://developer.android.com/guide/topics/manifest/activity-element.html
Declares an activity (an Activity subclass) that implements part of
the application's visual user interface. All activities must be
represented by elements in the manifest file. Any that are
not declared there will not be seen by the system and will never be
run.
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>());
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.