How can I open Running services settings?
Is it possible to open this page using Intent or Method invoke?
Running services
This only works on 5.1 and below.
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.android.settings", "com.android.settings.RunningServices"));
startActivity(intent);
Somehow on 6.0 this call opens the configure apps page showing title running services. May be there are some extra flags that need to be passed.
Related
I was starting activity from services till android P, but from android10 google has kept one restriction that activity cannot be started from background.
https://developer.android.com/guide/components/activities/background-starts
// below code stopped working
Intent intent = new Intent(this, MyActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
what should i do for android10 ?
You can use a notification using setFullScreenIntent, it's the best you can do or you can ask for SYSTEM_ALERT_WINDOW permission but it doesn't work with android go devices.
In fact, I want to be noticed when the program is downloaded without the user having to install their own apps (Install without show permissions activity).
Now I use the following code, and I want to change this code to answer my question.
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file),"application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
The following image is displayed after downloading the app from my server and i dont want to show
I want to list and launch the apps installed on my android device from my android application. Is this possible?
you should try this code
Intent intent = getPackageManager().getLaunchIntentForPackage("com.android.package");
startActivity(intent );
I have a program that I have made for Android 1.6 and up and I have been doing tests to ensure that the program works fine with the new Ice Cream Sandwich (Android 4).
Everything on the app works fine except that when a certain task has been performed by the user it is supposed to automatically launch the android browser. However for some reason it seems to load it up in the background and keeps my app shown which is not what I want it to do.
On every other version of android when I execute the code to launch the browser the browser comes to the top of the screen therefore causing my app to be in the background which is how I wanted it to work.
Below is the code that I have to launch the browser
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setData(Uri.parse(companyURL));
startActivity(intent);
The companyURL is a variable that I am using to parse the url to the browser.
Thanks for any help you can provide.
UPDATE
I have just discovered that if the browser is not currently running (i.e. not been loaded previously) when my app starts the browser it brings it to the front. However, once the browser has been previously loaded, when my app loads it up again, it loads it in the background.
Please try this it is working on ICS for me.
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(companyURL));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
Typically you don't need the CATEGORY_BROWSABLE category. Try the following instead:
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse(companyURL));
startActivity(intent);
In fact, the documentation seems to suggest CATEGORY_BROWSABLE is intended to be used in the opposite direction (browser to your app):
Activities that can be safely invoked from a browser must support this category. For example, if the user is viewing a web page or an e-mail and clicks on a link in the text, the Intent generated execute that link will require the BROWSABLE category, so that only activities supporting this category will be considered as possible actions.
http://developer.android.com/reference/android/content/Intent.html#CATEGORY_BROWSABLE
Try adding FLAG_ACTIVITY_BROUGHT_TO_FRONT flag to the intent.
I'm using following code and its working fine with me even when browser is already running in the background.
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
startActivity(intent);
we can launch android market application from:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData("market://details?id=packgename");
startActivity(intent);
My question is how to launch the third-party android applications I installed through Intent directly? Do you guys have any ideas?
In order to do that, you need to find the following info for the application you want to start:
Package
Startup Class
You can obtain this info if you start third-party app regularly, and in the LogCat inspect the trace.
Then, you just fill in following intent with the info you obtained:
Intent startupIntent = new Intent();
ComponentName distantActivity = new ComponentName("com.third.exampleapp", "com.third.exampleapp.StartupClass");
startupIntent.setComponent(distantActivity);
startupIntent.setAction(Intent.ACTION_MAIN);
startActivity(startupIntent);
Please note that it is very bad practice to start standard Android system Intents this way.