android-package-managers

black screen appears when come back from an external application

﹥>﹥吖頭↗ 提交于 2019-12-06 16:09:07
问题 I have an application that open an external application to read PDF files. here is the code to open the external app. if(file!=null){ PackageManager packageManager = getPackageManager(); Intent testIntent = new Intent(Intent.ACTION_VIEW); testIntent.setType("application/pdf"); List list = packageManager.queryIntentActivities(testIntent, PackageManager.MATCH_DEFAULT_ONLY); if (list.size() > 0 && file.isFile()) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); Uri uri = Uri

How to get list of ALL apps (including System Apps)?

烈酒焚心 提交于 2019-12-06 11:43:33
问题 I am doing the following to get the list of apps and I am only getting apps that were installed but not ALL apps, including system apps. I have tried the following: packageList1 = getPackageManager().getInstalledPackages(PackageManager.GET_META_DATA); and this: packageList1 = getPackageManager().getInstalledPackages(0); For both cases, I am getting the same list of apps that I have installed on the phone. 回答1: You are already getting a list of all installed applications including the system

How do I create an intent to launch any e-mail app?

旧时模样 提交于 2019-12-06 06:29:20
问题 I have found various topics here and elsewhere on creating an intent for sending e-mail and that seems to be pretty straightforward. I'm looking for an intent to just launch any e-mail client the user might have. Here is the code I've seen for sending an e-mail ( posted just for reference, this doesn't serve my needs as I don't want to send a new message ): Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_EMAIL , new String[]{"recipient@example.com"}

Why is no Activity found to handle Intent?

十年热恋 提交于 2019-12-06 05:46:34
问题 Instead of going the regular getPackageManager().getLaunchIntentForPackage("com.example.app") way, I want to create the launch intent by myself. Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.setPackage("com.example.app"); startActivity(intent); Why does Android not find the Activity, if the com.example.app is installed, enabled and has a correct manifest? (It works perfectly with getLaunchIntentForPackage .) 回答1: I understand that you are

Call broadcast receiver at time of uninstalling application in android [duplicate]

◇◆丶佛笑我妖孽 提交于 2019-12-06 00:36:50
问题 This question already has answers here : Receiving package install and uninstall events (4 answers) Closed 5 years ago . I want to clean up the junk created by my application at time on UnInstalling the Application. Using ManiFest File:- Added in Manifest File: <receiver android:name="com.netdoers.com.ui.CleanReceiver" > <intent-filter> <action android:name="android.intent.action.PACKAGE_REMOVED" > </action> <data android:scheme="package"/> </intent-filter> </receiver> Created Receiver to

hasSystemFeature(PackageManager.FEATURE_CAMERA) returns true for device with no camera

余生颓废 提交于 2019-12-05 12:32:36
问题 I have a application which uses camera functionality in it but part of its functionality can also run without camera feature. SO I have put this in my manifest. <uses-permission android:name="android.permission.CAMERA" /> <uses-feature android:name="android.hardware.camera" android:required="false"/> and in my code I check whether the device has camera or not using this final boolean deviceHasCameraFlag = pm.hasSystemFeature(PackageManager.FEATURE_CAMERA); Now I am testing my code on a tablet

How to change theme from another app resource in android?

╄→尐↘猪︶ㄣ 提交于 2019-12-05 03:23:41
I know there is a way to set themes by defining in styles.xml and use it like that setTheme(android.R.style.MyTheme); However, I want to get themes from another app which I developed as well. I know the resources names and actually I am able to get theme id with this code block; Resources res = getPackageManager().getResourcesForApplication("com.example.theme"); int resThemeId = res.getIdentifier("my_theme","style","com.example.theme"); When I debug, I see that resThemeId is not zero. Then, I need the final command to set this theme. Before super.onCreate() function, I try to implement this

List of default apps showing wrong in Android L

谁都会走 提交于 2019-12-05 00:43:05
I want to get all default apps in Android L. I used bellow code but they give me a wrong solution. Let see my code first private void getMyAppLauncherDefault() { final IntentFilter filter = new IntentFilter(Intent.ACTION_MAIN); filter.addCategory(Intent.CATEGORY_HOME); List<IntentFilter> filters = new ArrayList<IntentFilter>(); filters.add(filter); List<ComponentName> activities = new ArrayList<ComponentName>(); final PackageManager packageManager = (PackageManager) getPackageManager(); packageManager.getPreferredActivities(filters, activities, null); for (ComponentName activity : activities)

black screen appears when come back from an external application

十年热恋 提交于 2019-12-04 22:48:47
I have an application that open an external application to read PDF files. here is the code to open the external app. if(file!=null){ PackageManager packageManager = getPackageManager(); Intent testIntent = new Intent(Intent.ACTION_VIEW); testIntent.setType("application/pdf"); List list = packageManager.queryIntentActivities(testIntent, PackageManager.MATCH_DEFAULT_ONLY); if (list.size() > 0 && file.isFile()) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); Uri uri = Uri.fromFile(file); intent.setDataAndType(uri, "application/pdf"); startActivity(intent); }else{ Toast

How to get list of ALL apps (including System Apps)?

只愿长相守 提交于 2019-12-04 17:22:17
I am doing the following to get the list of apps and I am only getting apps that were installed but not ALL apps, including system apps. I have tried the following: packageList1 = getPackageManager().getInstalledPackages(PackageManager.GET_META_DATA); and this: packageList1 = getPackageManager().getInstalledPackages(0); For both cases, I am getting the same list of apps that I have installed on the phone. You are already getting a list of all installed applications including the system apps by calling this: List<ApplicationInfo> apps = getPackageManager().getInstalledPackages(0); Those with