I would like to create button that can navigate on system clean up screen which allow user to clear storage space. Similar to Google Play's button:
Any ideas about intent which I can fire? Or they are even different from device to device so it isn't worth effort?
you can try the following code:
void goStorageManage(){
Intent intent =new Intent(Settings.ACTION_INTERNAL_STORAGE_SETTINGS);
startActivity(intent);
}
I cant find any refrence to call the Intent screen "Choose screen lock".
Cant find anything?
Any idea?
You can call action DevicePolicyManager.SET_NEW_PASSWORD to send user to lock screen settings fragment (firstly he will have to type current password/pattern for secure lock types):
Intent intent = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD);
startActivity(intent);
There is none. You can view all possible Intents in android's source code: https://github.com/android/platform_packages_apps_settings/blob/master/AndroidManifest.xml
EDIT:
It turns out that this had been added in Version 2.2 of Android.
Please ee pleczko's answer below.
Before Android 2.2 there is no intent to do this.
I am using the intent with ACTION_CALL to make call in my app:
str="tel:0123456789";
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse(str));
startActivity(intent);
But it pops up the system dialing screen. I understand this is built into ROM and can not be customized. But Can I hide this screen and keep the user staying on my activity?
Did some googling and research here. But no clear answer so far.
It looks like you can't customize the dialing screen, but you can use a PhoneStateListener to get certain information about the phone call. See this link.
On many Android devices you can get into a secret settings menu from Phone app by typing in
*#*#4636#*#*
http://technology-headlines.com/2010/09/17/4636-android-secret-codes/
There are also some other codes.
Is it also possible to open this stuff programmatically?
I've tried this:
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:*#*#4636#*#*"));
startActivity(intent);
But it just tries to initiate a phone call and of course fails, hangs up and closes the Phone app.
EDIT: The phone *#*#4636#*#* gets saved to my Contact list as "Unknown" but the call just fails. In fact, the secret code only works when you type manually on buttons in Phone app without pressing Call in the end. Is it probably just a hidden feature of Phone app which has nothing to do with calling?
If so, one could open the Phone app programmatically and simulate typing on the buttons.
According to this post
Programmatically press a button in another appplication's activity
this should NOT be possible because if any app on non-rooted phone could just start other apps and press something there, it could take over control of the whole device and do bad things.
Here are some more details but I guess the post is a bit old and even if it worked it may have been changed in current Android versions:
http://mylifewithandroid.blogspot.de/2009/01/generating-keypresses-programmatically.html
So, no easier way to enter secret code?
Is it also possible to open this stuff programmatically?
Yes:
Intent in = new Intent(Intent.ACTION_MAIN);
in.setClassName("com.android.settings", "com.android.settings.TestingSettings");
startActivity(in);
You just need to watch logcat output to learn what this magic combination actually opens:
I/ActivityManager(31362): START {act=android.intent.action.MAIN
flg=0x10000000 cmp=com.android.settings/.TestingSettings} from pid
4257
Secret codes exist and work independent of the dialer application. The dialer application just provides a handy interface for these codes. It recognizes the special string and then calls a special intent to invoke the action. You shouldn't use the dialer to call these dialogs. Instead you can call the secret codes directly yourself like the dialer does internally:
Invoking built in secret codes:
What the dialer really does when you enter the code is extracting the number between *#*# and #*#* and then broadcasting the following intent:
sendBroadcast(new Intent("android.provider.Telephony.SECRET_CODE", Uri.parse("android_secret_code://4636")));
Register your own secret codes (if you like):
You can even register your own secret code actions using:
<action android:name="android.provider.Telephony.SECRET_CODE" />
<data android:scheme="android_secret_code" android:host="4636" />
Source: http://android.amberfog.com/?p=422
Edit: Fixed a bug in the original code (see comment)
try this
String ussdCode = "*" +Uri.encode ("#")+"*"+Uri.encode ("#")+ "4636" + Uri.encode ("#")+"*"+Uri.encode ("#")+"*";
startActivity (new Intent ("android.intent.action.CALL", Uri.parse ("tel:" + ussdCode)));
finally you must encode '#' using Uri.encode()
ACTION_DIAL sends the user to the dialer with the given code (it does not call). So that would be :
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:*#*#4636#*#*"));
startActivity(intent);
It would appear that codes are to be dialed, rather than to be called
looking for this
Intent intent = new Intent("android.intent.action.MAIN");
intent.setClassName("com.android.settings", "com.android.settings.Settings$TestingSettingsActivity");
startActivity(intent);
There are different activities for different phone, we can jump to the activity through typing in ##4636##.
And use
adb shell dumsys activity activities
to find the realActivity package and name.
e.g: Xiaomi 8
Intent intent = new Intent("android.intent.action.MAIN");
intent.setClassName("com.android.settings", "com.android.settings.Settings$TestingSettingsActivity");
startActivity(intent);
How to open Settings>About page programmaticlly in Android.
You can open it by simply using an Intent
Intent aboutPhone = new Intent(Settings.ACTION_DEVICE_INFO_SETTINGS);
startActivity(aboutPhone);
As in Android there are many Settings classes and here it would be :
android.provider.Settings
Looks like this is as close as you can get
Intent i = new Intent(Settings.ACTION_SETTINGS);
startActivity(i);
Takes you to the main settings page. There doesn't seem to be an option to go to the About Phone page.
Short answer you can't .
Long answer all you can do is create an activity and show all the info from about page in your activity by problematically polling out the info from the system