How to open data roaming setting in dual sim android? - android

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

Related

Set the focus on the activating/deactivating mobile data choice programmatically

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.

Intent.ACTION_CALL - "Mobile network not available"

When I test my application with the emulator I get the following message: "Mobile network not available". Ofcourse I don't expect it to actually call from the emulator, but I want some sort of confirmation that it works.
In my application I use an intent like:
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:" + Uri.encode(input.getText().toString())));
context.startActivity(intent);
I also implement this <uses-permission android:name="android.permission.CALL_PHONE"/> in the manifest-file.
Why is this?
EDIT: Seems like this only was a problem when I used GenyMotion. With the regular simulator, the call simulation worked.
You have to check and update if it works. This is my assumption which may work since I have not tried it by myself.
Open another emulator and note down its port number and use something like this
callIntent.setData(Uri.parse("tel:5554")); // assuming the second emulator port number is 5554
I am assuming this because, there is no sim card inserted in the emulator so you cannot call any real life phone number. But it is actually possible to dial one emulator from another using its port number using built in dialer app.

On Android 4.0, 4.1, 4.2, how to open android Ap progmatically or Go to Settings->More...->Portable Wi-Fi hotspot by code?

The only possible solution is :
Intent intent = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
//Is there any value for entering hotsopt?
mContext.startActivity(intent);
Have you tried:
startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS));
Please note (ACTION_WIRELESS_SETTINGS docs):
Activity Action: Show settings to allow configuration of wireless
controls such as Wi-Fi, Bluetooth and Mobile networks.
In some cases, a matching Activity may not exist, so ensure you
safeguard against this.

ANDROID Share information between my own app via intent

I'd like to share information between my own app running on 2 different phones via a bluetooth intent.
Lets say i have some data on phone a, then i will tap synch and it will start the same app at phone b (if it's not already open) with a bundle containing that "data".
My app on phone b acts acordingly.
Is that possible?
I am not really sure if this is what you're looking for.
Intent i = new Intent(Intent.ACTION_SEND); i.setType("image/jpeg");
i.putExtra(Intent.EXTRA_STREAM, Uri.parse(fileLocation));
startActivity(Intent.createChooser(i, "Send Image"));
This intent shows all available options for file send such as Email and Bluetooth. Choose Bluetooth and the device initiates bluetooth discovery.
Thanks!
From my understanding, it is not possible.
Use BluetoothSocket and BluetoothServerSocket instead
I recently saw this interesting video about NFC, and i know you are talking about bluetooth.
but watch this video http://www.youtube.com/watch?feature=player_detailpage&v=49L7z3rxz4Q#t=768s
Timestamp added, starts at: 12:48.
What they did is starting the app trough nfc but probably they send the data trough bluetooth. Its really user-friendly.
In this way you do not need to push the button sync but just bump eachother phones together!
I hope this helps you maybe further,
Daniel
I think you must make use of BluetoothServerSocket to accept incoming connections. Exchange data with server once connected. To get started check out this doc.
Start-up
You could find the source code in your SDK. Download samples from Android SDK manager. Select 'Samples for SDK' from the required SDK version.
Go to
<location of android-sdk>/samples/<version>/
Open 'Bluetooth Chat' application. It has almost everything you need.
Thanks!
By the way, don't forget to accept the answer!

sending file using built in bluetooth application in android

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.

Categories

Resources