I tried finding current mobile no of my app user but in my country the mobile no is not present in SIM so the current API returns null.
As a work around i thought i would just access the outbox of the user to get both senders and receivers no but unfortunately i am getting only receivers no.
Say for example I am user X and I send an SMS to user Y, through telephony API i am only able to get phone no of user Y to whom i am sending the SMS but not of user X.
Can any one suggest any other way i can access the current mobile no of any user??
Thanks
Pranay
Do you think this is what you are looking for? TelephonyManager::getLine1Number
(please, notice you are going to need the "android.permission.READ_PHONE_STATE" permission set in your app manifest.)
Related
I have written an app which sends a message to a number if the sim card of the phone is changed in other words if the phone number of the phone is changed. The code is working fine on android emulator but when I run this app on my phone, getLine1Number() of TelephonyManager class is returning null string.
Is there any other way to check if the sim card of the phone is changed?
Regards
You can use getSimOperatorName() concat to getSimSerialNumber() or getSimSerialNumber() only as phone number alternative.
Is more ease to detect sim changes in this way.
Hi i am little bit confusion about Device Token so can any one guide me. I am using following code for getting DeviceToken.
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)dt
{
}
The above code is working fine and it is showing DeviceToken data ,that is 64 length data.
My doubt is Device Token is different from one device to another device.
If once we got DeviceToken using one device that same DeviceToken can use for another Device.
Of course the device token is different for each device. It identifies a unique device. It's like a phone number (actually it's even more unique than a phone number, since multiple phones can have the same phone number). If it was the same, how would the Apple Push Notifications server know to which device to send your notification?
I am currently developing an Android anti-theft application and I am new in Android development. My apps is able to remotely lock the lost phone, so during configuration, user needs to enter a valid phone number, but how I determine whether the phone number entered is valid? Thanks
-Option one : read(get) the phone number from the sim card (if available, not all operators enable this)
-Option two : If sim card changed(sim serial number) lock the phone and send sms to an other phone number (since the thief will throw away the sim card )
-Option three : use what WHatApp android application uses to identify a person (sending an sms to a specified phone number and detect the incoming sms)
Option 3 seems a bit complicated since you will need a sever side with an sms gateway.
Well here's what comes to my mind .Good luck.
If you connect a data base so, compare to the phone number with to enter a phone number in field. I hope help you. :)
I did a project for a client where a same scenario was raised. Here is what we came to conclusion.
Send an SMS to the Number input and ask the number to send an sms code in reply.
eg. CONFIRM
If the number is valid and known to the user he will call them up
and ask them to SMS back.
If the number is valid and in use the message will get deliverd.
The client agreed the above scenario. Unless you have a really big Database of working numbers (updated so often), it will be a bypass solution.
I believe it is impossible to verify whether a phone number exists unless you call it. You could create a procedure where the app would call the entered phone number, and timed its connection. If the connections last longer than X amount of seconds, it is a valid phone number.
I'm making a widget who, among other things, displays the quantity of unread emails the user has in a given inbox.
Specifically, I'm asking how to:
-Obtain the list of email accounts on the device
-Make a call to one of the accounts such as
int newMailCount = accountInstance.getMailCount()
Any ideas?
Thanks
Obtain the list of email accounts on the device
This is not possible. You can use AccountManager to try to get at account information, but there is no "email" type that I am aware of, and email programs do not have to use AccountManager.
Make a call to one of the accounts
There is nothing in the Android SDK for email. There are dozens, perhaps hundreds, of email programs out there. None are part of the operating system. Email programs are welcome to create their own app widgets.
I have a group that needs to send out announcements and current events via phone text message. I want to have a central phone number that when it receives a text message, it rebroadcasts that message to a growing list of subscribers. I'm hoping to use a Google Voice number to avoid buying an actual phone number.
Any ideas? I've thought about some type of Java/HTMLunit that continually parses the GVoice html inbox, but I just have that computer-gut feeling that there is a more intuitive way. I haven't been able to find a GVoice API, as I imagine that would be the trick.
Thanks
I've used a different approach. There's a number of E-mail to SMS services out there. So you send an e-mail (using standard JavaMail) to a specific address that is then associated with mobile phone numbers. I use TextMagic, but there are also other similar services out there. They also have API support, if thats what you'd prefer.