For example, I only have one "body" but have a description like:
I can understand that a non-BLE device will not respond to the BLE Client device (Android) using StartDiscovery but should respond to a Scan request. I believe that the AdaFruit is responding to a discovery event because I am getting discovery responses to devices within range with the Android device app in the Settings/Connections/Bluetooth display. This includes the Adafruit BLE device. Again, I believe this means that the problem is on the Android side. I have searched everything I can find but most of the information I get is years old. I have focused in on something called LeScanCallback and/or LeDeviceListAdapter as the potential problem. I can't even tell is my callback is being triggered. Any help would be GREATLY appreciated!
but when I try to insert a code block this system won't let me post the question. I have seen many other questions where the poster actually has different input blocks for the manifest, xms, and main Java script, but I don't see anything like that.
I didn't realize I had the formatting wrong. I needed to manually insert 4 spaces in front of every line, and use the "Code here". That will teach me for reading the instructions too fast! Thanks for the comment from Morrison Chang that put me in the right direction.
New to Android development and I’d like to very quickly check if the user is in a call AND get the phone number of the person the user is in a call with. In reviewing https://developer.android.com/reference/android/telephony/package-summary, it appears quickly grabbing this phone number is not possible. It appears the only time the number is available is with a PhoneStateListener and onCallStateChanged during an actual “state change” or using a BroadcastReceiver with state changes and grabbing EXTRA_INCOMING_NUMBER or related when a change occurs. Am I missing anything?
Thank you.
you're not missing anything, that's the way to do it.
I am working on one network app, i have problem with tracking those red
marks check box. means that if "Data Enable" is check than
pro-grammatically i know in my App this Data Enable is check or
UN-check.
so like that all Data roaming and Use only 2G networks Also track.
i was lots of try to maintain track this but i can't success, i
really want help.
Thanking you.
There are several ways for this...
You have ConnectivityManager class in android. Did you try using that?
http://developer.android.com/reference/android/net/ConnectivityManager.html
This is available to let you know about the network state of your device.
What you can do?
And you can receive automatic notification of when the connection state changes via the CONNECTIVITY_ACTION broadcast
You can setup your Broadcast receiver and register your application to broadcast an Action
Alernatively you can also work with services depends upto Architecture of your application
I guess any internet connection should be fine for you if you only worried about Internet
Then start your process as you want to. :)
I wan to hide/show my caller id from my activity programmatically. I tried to find it in the android documentation but without the luck. Maybe you have any ideas?
I posted a question asking this on the Android Google group and got absolutely no answers at all. I've also seen a couple of other question on SO which also had no answers (or none that work).
I came to the conclusion that it simply isn't possible. My reasoning is this...
If I go to Settings -> Call -> Additional settings, I see an AlertDialog which has a HeaderTitle of 'Call settings' and I see a circular progress indicator and a message saying 'Reading settings...'.
It occurs to me that my phone is, at that point, accessing my phone/network provider. The resulting 'chooser' dialog gives me options for 'Network default', 'Hide number' and 'Show number' and when I make a selection (or even if I just 'Cancel' the dialog), I get another AlertDialog with circular progress indicator with the message 'Updating settings...'.
In short, it seems the Caller ID setting is not entirely 'local' to the phone settings and relies on interaction with the provider and, for whatever reason, as a result of this the Android APIs don't allow this to be manipulated programatically.
I'm not sure if this is something on the 'To Do' list for future versions of Android or if there are legal/security implications in allowing it to be done or some other reason. Whatever the case may be, I haven't found anybody so far who is able to explain why there isn't a method for TelephonyManager (for example) to simply switch this.
EDIT: No luck on getting the Additional Settings AlertDialog with the standard APIs either.
The reason I say that is that it is possible to pull up various parts of the device's 'Settings', e.g., in one of my apps I use android.provider.Settings.ACTION_WIRELESS_SETTINGS in the constructor of an Intent passed to startActivity(). This brings up the Settings page for enabling/disabling wi-fi, mobile internet and bluetooth.
android.provider.Settings has other similar ACTIONs for other Settings pages but there isn't even one for 'Call' never mind Call -> Additional Settings and nothing for the AlertDialog to allow you to choose to Hide/Show the outgoing Caller ID.
If this can be done then it would have to be an undocumented API unless I completely missed it (I spent a long time looking). I suspect examining the Android source-code may be the only way to find an answer and I haven't attempted that yet.
I have managed to get Additional call settings dialog. Explanation below:
Although it looks like it is part of the Settings, in fact it is part of the Native PhoneApp. If you take a look at the AndroidManifest.xml of the PhoneApp you will see that Activity GsmUmtsAdditionalCallOptions has defined IntentFilter for the android.intent.action.MAIN.
So, the code that I checked to work correctly on several phones:
Intent additionalCallSettingsIntent = new Intent("android.intent.action.MAIN");
ComponentName distantActivity = new ComponentName("com.android.phone", "com.android.phone.GsmUmtsAdditionalCallOptions");
additionalCallSettingsIntent.setComponent(distantActivity);
startActivity(additionalCallSettingsIntent);
If the #31# trick works for your needs for a single call then you could add a broadcast receiver that listens for the outgoing call notification and modifies the number to include #31# at the start before it gets dialled. Android allows the number to be changed on the way through like that.
Only works if your default is to enable caller ID and your network support #31# and you want to toggle it off using a widget, say.
The Caller ID is network specific not something that the phone controls. In fact in certain mobile network configurations the phone doesn't even 'know' its own phone number.
Some networks support sending an activate/deactivate caller ID network command. In GSM this is normally #31#. It can be permanent or on a per call basis.
Permanent requests the network to hide the caller ID for all calls.
Per call requests the network to hide the caller ID only for that call. The latter is achieved by prefixing the number being called by #31#, so for example calling #31#85432786426 would call 85432786426 hiding the caller.
Some networks support both, some only support one of them, and some do not enable it. Try your luck and try prefixing the dialed number with #31# and see if it works.
http://www.gsm-security.net/faq/gsm-caller-id-clip-clir.shtml
If you want a shortcut to the additional call settings, you can use App Cut and select GSM settings. It will place a shortcut on your home screen.
i want to show a Toast in an Activity when a missed call happened. How can i do it?
Thanks in advance.
I suppose you have content providers to access call logs.
http://www.anddev.org/video-tut_-_querying_and_displaying_the_calllog-t169.html
http://www.devx.com/wireless/Article/41133
If this code works you just need to run this query at the right time. I mean check some samples that can notify you when you get a call in your device
http://groups.google.com/group/android-developers/browse_thread/thread/d97a759a3708cbe3
Once you get this notification put a timer or use some built in Intents to find that the phone is back to normal state and access the call logs...
There was a similar question recently, the answer should work for you as well:
broadcast receiver for missed call in android
showing the toast afterwards should be the easy part :)