Just how good is Android's ContactsContract.PhoneLookup class? - android

Phone numbers can be expressed lots of different ways:
555-555-5555
1-555-555-5555
+1-555-555-5555
Are all the same number, just expressed differently. Android's ContactsContract.PhoneLookup class Is designed to solve this problem. I'm about to run this through some tests and post the results, but I figured it would be worth making a question to see if anyone else had some experience with this and knows the answer. I could save a ton of headaches by not needing to filter out the +1 and other extraneous symbols before the number if I can count on this PhoneLookup class to do its job for the users. Can anyone testify in support of it?
Thanks. If I don't hear back from anyone I will run some tests and let you know how it goes.

Wrote a quick application to test this, found that the class can account for every variation of a phone number:
+15555555
15555555
5555555
Including hyphens (-) as well. Hope this save someone time in the future.

Related

How many numbers can be added to BlockedNumbers in Android? (guesses welcome)

I've been experimenting today with trying to build a call-blocking app for Android to prevent receiving unwanted robocalls from telemarketers and scammers. After a little tinkering I was able to whip up a very crude proof of concept using a fork of the stock Android Phone application. The crude proof of concept simply allows me to enter a number into an EditText and then add the number to the block list-- nothing special but it's a start.
I estimate that there are likely 500,000 spammer/scammer/telemarketing phone numbers that would need to be added to the BlockedNumbers list in Android to make this work. At first I thought this wouldn't be possible, but after a little back of the envelope math, it looks like 500,000 phone numbers only comes to around 5 megabytes worth of data.
So does anyone have any idea how many phone numbers can be added to BlockedNumbers in Android? Any guesses would be appreciated! And yes I know that I could develop an experiment to test this myself, and I might just do that eventually.
P.S. If anyone happens to stumble upon this in the future trying to build the same thing, here is a link to the modified and "hackable" version of the stock Android Phone application:
https://github.com/dangleon/customdialer
NOTE: The Android application responsible for receiving phone calls doesn't seem to be something you can "hack on." The fork posted above is simply a dialer application, and doesn't handle incoming calls.
Okay, so it's been 12 days now since I asked my question here on StackOverflow and I didn't receive any answers. However, I'm proud to say that I built an application last night to test how many phone numbers can be added to the BlockedNumbers list in Android. Running my test application I was able to add 500,000 numbers to the BlockedNumbers list, no problem. I'm not sure what the exact upper limit is on how many numbers can be added to this list, but I know for sure that you can add at least 500,000 numbers to BlockedNumbers on a Moto G4 running Android 7.0. I'm not sure if anyone is ever going to stumble upon this post, but if someone does, I hope you've found my post helpful! And if everything goes as planned, maybe you will have heard of the app I'm building: PhreakPhone-- A Crowdsourced Telemarketing Call-Blocker for Android
P.S., This is the first answer I've ever posted on StackOverflow, feels great to have finally contributed to such an awesome site.

Comparing whistles on android

Hi I am hoping to make an android application that can listen to different whistles of a person (long whistle long whistle short whistle for example) and compare it with a prerecorded whistle of the same type by a different person and determine if they whistled the same way.
I was hoping to use the library musicg for this but I'm unsure whether it would be possible before I even tried? Unfortunately I'm also having trouble getting the demo to work which seems to be an issue in the issue log of the site, but I haven't found any answers yet.
Cheers for any help, apologies for the vague question.
So I ended up just diving into musicg and seeing how it go's. Turns out you can compare the foot print of two sound files quite easily, and it even outputs a float value in terms of how likely to be similar it is.
As someone has said above its quite slow, especially on a phone, but works great for what I need it for. Thanks guys for your help.

How to narrow down a time(r)-based bug

I have a module here that has the job to smooth some UI output. It is fed by data that is timestamped. The module itself has a timer that, along with lots of code, makes sure that on the other end there is a nice visual result.
But sometimes, the whole thing gets stuck. Its extremely hard to reproduce and so far i could narrow down some things.
1) the input is still working and fine
2) the device is still responsive
So somehow the logic of the smoothing has a bug that under certain conditions hangs the thing up. I logged all "returns" because its still drawing stuff, but the values dont seem to change, so the chain has to be cut off somewhere.
Every return statement in the code makes sense and they are called every once in a while for legitimate reasons and they dont break the code. But there has to be a combination of events/things/values that break it.
The code itself is poorly written (by some intern, who now has no clue what he did back in the day), almost no documentation and i have a HARD time understanding the code and im not a dummie.
The module "works" and we dont know if the bug has been there always or if it was introduced one day by some other changes. Time is pressing, unit testing is nonexistant.
I know it should be different, but thats just real life.
Now there's always the rewrite... But how could i first try to narrow down on the bug and maybe save myself a lot of trouble and just FIX it with some quick-n-dirty ?! (maybe its not even dirty at all and i just fix the missing 1% to 100% working)
I have no experience with unit testing and i dont really know what kind of time we are talking about to set up a test in this case. I am far beyond the ideal conditions, its more like Schwarzenegger in the movie Predator.
Any help is welcome.
In my experience, sometimes it takes much more time understanding and reverse engineering someone else's code, than writing your own version from scratch. In the past I've decided to rewrite complete programs myself, reducing the code sometimes by 80% and resulting in much more elegant and readable code. This might be impossible if we're talking about a huge project.
Some important things to have in mind though are:
- do you know the algorithm, or would you first have to reverse engineer it
- is rewriting the code doable with your skills in a reasonable time
- do you need to maintain the code often
Also, if the code was written by an inexperienced programmer, chances are that you'll find more bugs in the future.
It is impossible to give you precise advice, with the little information you give us. Use your best judgement, rewrite parts of the code if possible, split the code in different classes, modularize, rename variables, clean it up... and the bug will probably become much more evident.

how to generate a document for a receipt printer using android

Ok, here we go, I have to develop an application, which has to allow electricty and water bill payment, and naturally it's supposed to generate at the end of the transaction a receipt, I particullary need to know how to transfer data and determine what would be displayed on the reciept.
I'v gone through this forum and i've found out some StarIO android sdk, knowing that I have a weak english, and it's a bit hard for me to figure out what's going on in the starIO's documentation, i would like to know if StarIO's packages' are what I need for this application or I just misunderstood the objective behind it.
Thanks in advance.
Well, if you have to work with a Star printer, then yes, their SDK is the way to go. If not, though, we'd need a lot more details to answer your question fully.

How to create/setup exchange account via code

I search for days now, and only specific answer i got in one thread is that its not possible (here).
But, I found some apps that can do it so i guess it is possible, probebly with some kind of a workaround.
The problem is that i'm in the dark, i dont have any idea where to start from. I'll be happy for any points, leads, anything to get me started...
Thanks,
Eitan.

Categories

Resources