Open my apps accessibility settings Page android - android

I want to open my apps accessibility settings on a press of a button Desired Page to Open(myApp)
Was only able to open accessibility settings accessibility Page
Tried adding data to Intent but got this error
"No Activity found to handle Intent
{act-android.settings.ACCESSIBILITY_SETTINGS dat=package:com.testapp4 fig=0x10000000 )"
Code:-
Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
Uri uri=Uri.fromParts("package",getReactApplicationContext().getPackageName(),null);
intent.setData(uri);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getReactApplicationContext().startActivity(intent);

Related

How to send email intent without message?

I'm trying to open an email application from my app, without sending any message. I just want to open the app, but when I'm using
val intent = Intent(Intent.ACTION_MAIN)
intent.addCategory(Intent.CATEGORY_APP_EMAIL)
startActivity(intent)
I can't go back to my application. When Gmail app opens, and I press back button, the my application isn't even on the app list.
Is there any posibility to open the email app as another application?
If you want to open Email app of sepreate stack
val intent = Intent(Intent.ACTION_MAIN)
intent.addCategory(Intent.CATEGORY_APP_EMAIL)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent)
this intent will open the Main mail app make sure there is no draft in the mail app and it should work with you
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_APP_EMAIL);
getActivity().startActivity(intent);

How to startActivity to accessibility settings page of my app in Android

This question is quite similar to other.
However there is still no solution.
I am using the below code to jump to the accessibility settings page.
Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
startActivityForResult(intent, REQUEST_USAGE_SETTING);
Instead of jump to main accessibility settings page, i would like to take the user to the settings page of my app.
for open setting page of your app you need to pass package name of your application as below,
try this it will redirect you to setting page of your application
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", getPackageName(), null);
intent.setData(uri);
startActivityForResult(intent, 1);

How To Open Homescreen Activity for Selecting Launcher in OPPO or Other Phones

Hello Friend I'm working on Launcher Application. for select my launcher as Home app a popup is showing in samsung. by using this code.
private void launchAppChooser() {
PackageManager packageManager = getPackageManager();
// get dummyActivity
ComponentName componentName = new ComponentName(context, DummyActivity.class);
// enable dummyActivity (it starts disabled in the manifest.xml)
packageManager.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
// create a new (implicit) intent with MAIN action
Intent intent = new Intent(Intent.ACTION_MAIN);
// add HOME category to it
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// launch intent
startActivity(intent);
// disable dummyActivity once again
packageManager.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
}
but this code is not working on OPPO and HUAWEI. I'm using following line for showing same popup to select home launcher
startActivity(Intent.createChooser(intent,"Select Launcher App"));
This code is showing popup with launcher Apps but when i clicked on any app its not set as default.
Can i open homescreen Activity from setting in OPPO for choosing default launcher like this(please open image). because CM Launcher app is opening this activity
Clicke here to open image
Now i Want To Open This Activity Programetically. and Need Yours help for doing this.
For checking in oppo devices, you have to check if the current default home app package name contains "oppo.launcher".
After that, use this code using it. You can open the default home apps settings in "oppo devices"
Intent intent = new Intent();
intent.setAction(Settings.ACTION_HOME_SETTINGS);
startActivity(intent);
This is an alternative solution for changing the current home app to your launcher app. This intent redirect user to default launcher app list in oppo devices.

Open a Url with option of Installed App and Browser in Android

I have a String url. The requirement : On Click of a Button, the default chooser should open if the deeplinked App is installed with the User else opens the browser.
I am doing this onClick of the Button:
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url);
startActivity(i);
The onClick opens the browser only, evenif the deeplinked App is installed. What should be the approach?
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url);
startActivity(i);
The above code worked in case of deep-linked URL. The default chooser gave option for the App.

Android intent chooser does not display list if earlier intent is not finished

With the code below I share some text from my app via an intent chooser. My problem is that if I for example choose to share the text as a message and when in the message app I just hit the home button and bring my app back to front. Then when I try to start a new intent chooser it immediately sends me back to the unfinished message app. I would rather that it forgot all about that and presented me with the list of choices again.
Is there a way to make it forget the old choice?
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, text);
startActivity(Intent.createChooser(intent, "Share text as..."));
Add the following
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);

Categories

Resources