Android Question Phone Number Blacklisting

Discussion in 'Android Questions' started by johnaaronrose, Jun 10, 2015.

  1. johnaaronrose

    johnaaronrose Active Member Licensed User

    I want to write a simple app for phone number blacklisting as the ones on Google Play Store are much too complex. I simply want to be able to reject anonymous calls & calls from a numbers on a user maintained blacklist. I haven't been able to find any tutorials on this type of phone use. Can anybody direct me to the appropriate documentation?
     
  2. mangojack

    mangojack Well-Known Member Licensed User

    A while back I created a small app to kill off the telemarketers .. it worked OK on my old galaxy fit.
    It would error on incoming private numbers (-1 , -2 ??). never got around to fixing it and have no need of it anymore.

    it basically uses a service and Phone events(Core) to monitor the phone state.
    on "Ringing" if the number was in the barred list the below library would answer the call .. and after short interval hang up.

    I offer the app as a start to your project.
    It would be a good idea to read thru the thread before grabbing the lib.
    specially the last post .. something about it don't work anymore under Lolipop... !:(

    Answer Call library ..

    also include reflection lib ..
     

    Attached Files:

    koaunglay likes this.
  3. johnaaronrose

    johnaaronrose Active Member Licensed User

    Thanks for that. Erel suggested in thread http://www.b4x.com/android/forum/threads/end-call-incoming.19714/ to use the Reflection library (without the AnswerCall library) as follows:
    In PhoneEvents:
    Sub KillCall
    Dim r AsReflector
    r.Target = r.GetContextDim TelephonyManager, TelephonyInterface As Object
    TelephonyManager = r.RunMethod2("getSystemService", "phone", "java.lang.String")
    r.Target = TelephonyManager
    TelephonyInterface = r.RunMethod("getITelephony")
    r.Target = TelephonyInterface
    r.RunMethod("endCall")
    End Sub
    Add this permission with the manifest editor:
    Code:
    AddPermission("android.permission.CALL_PHONE")

    I think that I'll try this method first as it looks simpler as well as the AnswerCall method not always working (i.e. not with various devices & Lollipop). Did you mean "incoming private numbers (-1 , -2 ??)." as just meaning UK 01.. & 02.. phone numbers? What phone number would an anonymous call be (e.g. 0) taken as? I also understand that call centres now use international numbers: is there any way to recognize these?
     
  4. mangojack

    mangojack Well-Known Member Licensed User

    call logs listed incoming calls from "private numbers" as -1 or -2 (Australia) ..
    as mentioned above .. I never got around to investigating it further and have no plans to do so ..

    I have no Idea..

    I have no Idea ..

    Sorry I cant help any further .. ;)
     
  5. jchal

    jchal Active Member Licensed User

    hi there i tryed to run the sample code and i got the following error
     
  6. mangojack

    mangojack Well-Known Member Licensed User

    The Sub signature should be ... Sub Service_Start (StartingIntent As Intent)

    This is a very old thread .. please start a new thread for any further questions.
     
Loading...