I have a Samsung device running Android 11 (API Version 30).
I would like to programmatically access the box to enable or disable mobile data.
The problem is that the dialog shows me all the items in mobile data usage, when I only want to see the box to turn mobile data on or off.
Here is the code I am using, do I need to add anything to my Intent?
Intent intent = new Intent(android.settings.DATA_USAGE_SETTINGS);
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK;
startActivity(intent);
Thanks in advance for your help.
Related
I am trying to get zebra data wedge to enable /disable sample ( https://github.com/darryncampbell/DataWedge-Quick-Suspend-Scanner ) working on zebra TC 75 scanner handset having android version 5.1.1
data wedge version on Zebra TC75 handset is 6.2.24 ( original data wedge version 5.0.17 upgraded to version 6.2.24 by using check system updates). create profile API does not work, so I manually created a profile named "DW Quick Suspend Profile" and enabled this profile. the app is added to associated apps, the barcode input option is checked intent output option is checked. Intent action is specified as com. Darren Campbell.datawedgequicksuspendscanner.action and intent category is specified as android.intent.category.DEFAULT. Broadcast intent is selected for the intended delivery spinner.
but zebra TC75 does send status updates or enable/disable data wedge does not work.
whether anyone got data wedge to enable/disable API or sample code at https://github.com/darryncampbell/DataWedge-Quick-Suspend-Scanner working on Zebra TC 75? if yes what configuration needs to be changed
App author here, the reason SUSPEND_PLUGIN and RESUME_PLUGIN are not working for you is that they are not supported in DataWedge 6.2. DW 6.2 documentation is here: https://techdocs.zebra.com/datawedge/6-2/guide/api/#scannerinputplugin and only shows ENABLE_PLUGIN and DISABLE_PLUGIN as supported.
By this code:
Intent i = new Intent();
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.setAction(android.provider.Settings.ACTION_DATA_ROAMING_SETTINGS);
context.startActivity(i);
I am able to open the data roaming setting activity successfully. Lets have a look at the screenshot:
When I click on the Data Connection it prompt me like this way:
because my phone is dual sim. Now I want to open the prompt window without clicking the data connection. Is it possible? Can I open the window(Second picture) directly?
Dual SIM support is part of AOSP since Android 5.1 (SKD22), so all previous versions feature vendors' extension, which means it is not standarized.
See: https://developer.android.com/about/versions/android-5.1.html
Android app which i am developing has some modes like:
Kiosk Mode
Normal Mode
Semi-Kiosk Mode
Now my question is while my app is running in a Kiosk mode it will blocks all the other apps to open/make himself on the top. So user is unable to go to the settings screen.
I want a way to provide a Wi-Fi settings within my app so that user can do:
Search for the Wi-Fi nearby
Select and provide the password
Can see which Wi-Fi node is connected
Any help will be appreciated.
I know this is a bit old, but just in case it saves someone a little bit of research in the future this is a solution that I came up with for a similar use case.
Just use the activity that Android provides for managing wifi (without the user seeing the rest of the settings) by manually assembling an intent like so:
Intent intent = new Intent("com.android.net.wifi.SETUP_WIFI_NETWORK");
intent.setComponent(ComponentName.unflattenFromString("com.android.settings/com.android.settings.wifi.WifiSetupActivity"));
intent.addCategory("android.intent.category.DEFAULT");
startActivity(intent);
What's Intent I can make my app open Settings for enabled and disabled Data Package?
I try ACTION_DATA_ROAMING_SETTINGS but I'm wrong, because don't make the that I want.
I need just enabled and disabled data package...
The mobile that I use is motorola defy, and the Intent that I find that make the that I want is: com.motorola.blur.datamanager.app.DataManagerAppPreferenceActivity. But I need of native Intent of Android, because my app will run in device others.
I am sending file using following code in my android application :
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setType("image/png");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file) );
startActivity(intent);
But it shows me list like email , bluetooth , and many other. I dont want this list and should be sent directly without user interaction to perticular paired device .
Is it possible in android ?
Thanks in advance.
Nope, current API's will not allow you to bypass user confirmation, but you can do this programmatically using the Bluetooth API's after the pairing stage. Establish a RFCOMM and then use InputStream/OutputStream to receive/send files. A great place to start is looking at the BluetoothChat example by google.