Want to programmatically access user-entered Android Device Name - android

The Android SDK class Build.VERSION gives programmatic access to many (relatively) hard-wired values from the phone, as has been discussed in several other threads. But I am looking for a way to access the "Device name" value the user can enter/change from the About Phone dialog.
When I first went to About Phone on my Galaxy S4, the "Device name" value was SCH-1545, which is the same value as I get if I print out
android.os.Build.MODEL
The phone lets me enter a new value, say, "Foo bar" but, as I rather expected, that did not change the value of android.os.Build.MODEL, even after rebooting the phone. Nor did it change the value of
android.os.Build.USER
which seemed the only other field it might affect.
Is there a way to access the value that the user can change/see?

Actually, it turns out that this question is essentially a duplicate of another question which I was unable to find with my original search terms and I have since up-voted. The short answer is: yes, for some phones but not in the general case, AND you have to request bluetooth permission to use the call that can do it. IOW, ugh, no not really.
I'm leaving this question up in the hope that the terminology I use may help another searcher find the answer more quickly.

That is most probably the device name from Bluetooth.
Use BluetoothAdapter to access the name.

Related

Keyguard, isDeviceLocked or isDeviceSecured?

Im trying to develop an app which has a few security options, and for one of those options I need to able to know if the device is locked with any kind password(numbers,pattern,etc) so I started reading the android documentation and found two KeyguardManager methods, isDeivceLocked() and isDeviceSecured() however I don't really see much of a difference in the description, so what really is the difference between the two? thanks in advance
The official API states the difference, though it might be a bit confusing. The key difference is whether you want to know the general configuration of the device, or its current state.
So isDeviceLocked() returns true if the device is currently locked behind some kind of password or identification mechanism, which is required in order to unlock and use the device. It returns false in case that the device is currently open and in use, or that it just doesn't require any password/identification in order to open it. (reference and more details may be found here)
On the other hand, isDeviceSecure() returns true if the device has been configured to use any kind of password or identification mechanism - even if it's not currently required in order to use the device.
In case you wonder what scenario might cause isDeviceSecure to return true, while isDeviceLocked returns false: it might happen whenever the device in in use (after the lock password has already been entered). Another scenario might be when the device has Smart Unlock (or trusted devices) configured, so that currently it wouldn't ask for a password or any other kind of identification in order to open/unlock itself.

DDMS not showing the name of application

I am facing this problem intermittently, the DDMS in Android does not show the name of any application as shown in the image below
This becomes such a major problem given the number of log messages it becomes impossible to see the relevant messages without setting the filter for a particular application.
My Question
What changes are required in the DDMS settings so that it always show the name of application in messages?
you can filter by tag, it is just a workaround, you should probably update your plugin, this happens sometimes when you have two ddms' but happens very rarely in my case, and usually I selected device wrong or something similar. I recall resetting ADB did the trick for me
In Android Manifest, set the application Debuggeable = True
works after that

How to obtain Phone Number in Android?

This is an extension to the question here. Now I quote CommonsWare
There is no reliable way to retrieve mobile number of device programatically. The only option remaining and I can think of is getting user to input for the phone number.
My question is how to check if the phone number entered by the user is correct for these and any more possibilities which I cannot think now:
The number entered by the user is of the same device the app has been downloaded on.
User did not make any typographical error while entering the number
User did not enter any local calling code like leading 0
I have spend sufficient time on StackOverflow and web and this is not a duplicate question.
I will appreciate any help, clues or suggestions.
1.The number entered by the user is of the same device the app has been downloaded on.
Again this is something kind of impossible to test, else the Tricky way mentioned by #neteinstein
2.User did not make any typographical error while entering the number
3.User did not enter any local calling code like leading 0
I think you still not aware of this library by google,used for Parsing/formatting/validating phone numbers for all countries/regions of the world.
Using that you can achive your other 2 solutions.I think.
Link : http://code.google.com/p/libphonenumber/
If you are willing to possibly spend some user money you can send an SMS to yourself (number inputted by the user) and check if it arrives.
If it does, the number is correct. If not... either you have no network, or the number is incorrect.
I don't even think the phone has the number visibility, according to my experience with Mobile Operators, only on their side they have that visibility.
Though I do not know about nr1, I think you can solve problem nr 2 and 3 quite easily by analysing the number while its a String. That way you can easily check what characters it contains and what positions these characters are on.
I hope this helps.
Greets,
Wottah

android Outbound caller id - on/off

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.

Is there a way to to create a custom answering machine in android?

I'd like to create an app that allow you to filter incoming call to various answering message with :
"this number is not available" for black listed phone numbers
A formal message for strangers
A informative message about what your doing for friends
I don't know how you can get automatically a call, play a recorded message then wait for the answer and record it. Or maybe there is just a way to interact with the actual answering system so I just have to plugin.
Any clue strongly appreciated. A human sacrifice for any code snippet :-)
Access to the internal telephony is not possible or planned for future releases of Android:
http://groups.google.com/group/android-developers/browse_thread/thread/e8904c82a2c4a333
This would present a security risk as app developers could intercept and hijack sensitive calls (eg. telephone banking)
This is not possible on the tmobile G1 at this time. There is no way for an android SDK application to access the call input or output on this hardware/firmware combination.
http://groups.google.com/group/android-developers/browse_thread/thread/d04c307973345fef/a628e578900b3dce?lnk=gst&q=dave+sparks+play+audio#a628e578900b3dce
and
http://groups.google.com/group/android-developers/browse_thread/thread/185e33a3f420d1ac/e14e1dc84bb6dd24?lnk=gst&q=play+sound+call#e14e1dc84bb6dd24
I'm not sure this answers the question, but it is somewhat related I think.
You can install Ultimate Voice Recorder which can record your conversations (very useful when calling customer 'service'). Since it can record it, it must have some way to access the conversation.
Also, the capabilities you have to give the app are quite scary (translated from dutch: full internet access, intercept outgoing calls, change preferences, call phone numbers directly, record audio/take pictures, update contacts, auto startup). It seems to me there must be something in there that can help you?
However, I don't think it can inject audio into the stream. The symbian version had an option to insert beeps into the conversation, but I don't think the android version has it.
http://www.fingertip-access.com/
I have found out att for this use of your Phone Android or ISO, so far they ar decades behinde symbian and an inferior alternativ sadly, if you don't install a custom kernel/jailbreak it's not possible to record incoming calls and screen them. "Ultimate Voice Record ned you to use the phone in speaker mode."
it is possible to record voice calls with automatic answer. An update on this issue would be very helpful...
It is possible to have a resource that answers the calls. Enter a message and record the call. And together don't activate the microphone...
In short, an answering machine...

Categories

Resources