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.
Related
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
I have a simple piece of code:
ParseObject testobject = new ParseObject("Test");
testobject.put("customerName", "John");
testobject.saveInBackground();
If I run this on my emulator, it works, a Test class is made in my Parse project and the value John is added to the Row customername.
If I run this on my mobile phone the result is also succesful.
But if I run the exact same program on my Tablet, nothing happens.
(the callback = null, .getResult() and .getError() are also null)
Any idea where the problem lies?
Are you using Wi-fi on your phone or using mobile internet? Depending on where you are (Home, School/University) they may have blocked some ports which stop the service from running.
Something I saw is, you've got spaces between 'testobject .put' and 'testobject .saveInBackground();', that may be your issue?
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!
I am making an application and I want to retrieve the device phone number and send that on the server. But I am testing this application on android emulator. Can anybody please tell me how to set or get the phone number in emulator and actual device.
Thanks.
We can get the phone number in emulator if we use the Telephony manager
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String phone = tm.getLine1Number();
Toast toast = Toast.makeText(getApplicationContext(), phone, Toast.LENGTH_SHORT);
toast.show();
On making the toast of the phone number we get the phone number like..
15555215554
It also need the android.permission.READ_PHONE_STATE permission.
So Emulator is also having its own phone number.
In DDMS perspective You will see Emulator Control tab you can emulate the call from there.
If you don't see Emulator Control there . Use Window> Show /View > Emulator Control to make the tab appear.
To accesss device phone number in your code use telephonymanager.getLine1Number();
You need to set READ_PHONE_STATE permission in manifest file for that.
you cannot call the emulator from your device. But you can make calls to two emulators. For details on how to ? you can go to DDMS perspective then Emulator Control tab you can make the call from there to other emulator.
http://developer.android.com/tools/devices/emulator.html
I want to forward any calls received to another predefined phone number. I have searched forums and found some contradictory answers. so i m confused.
First I looked at this post https://stackoverflow.com/a/5735711 which suggests that it is not possible through android.
But another post has some solution. https://stackoverflow.com/a/8132536/1089856
I tried this code from second post, but i m getting the following error message: "Call Forwarding connection problem or Invalid MMI Code."
String callForwardString = "**21*5556#";
Intent intentCallForward = new Intent(Intent.ACTION_CALL);
Uri uri2 = Uri.fromParts("tel", callForwardString, "#");
intentCallForward.setData(uri2);
startActivity(intentCallForward);
Where 5556 is the number of emulator (for testing) where i want to forward call.
i think you need to try it on the device better than the emulator.
You are using DTMF codes, so i think you need network (on the actual device) rather than on the emulator.
Dial the same code "**21*5556#" on your emulator and check. It does not work either! Replace the 5556 with the phone number you want to forward the call to and then try it on phone.
Meaning, the DTMF codes would work only on mobiles not on emulators or tablets without SIM support.
EDIT:
you can find different call forwarding codes here.
Remove the "#" from Uri uri2 = Uri.fromParts("tel", callForwardString, "#");
if that do not work then try just *21*number#