Android Question For Call BlackList

koaunglay

Member
Licensed User
Hi all friends in b4a! I'm looking for some code for Blacklist apk. I see end call incoming and answer call. But I can not create apk with this. By the first I create sqlite db file and insert some number in db. And then I want to block or answer numbers in db. But I don't know how should I go on.
So somebody help for that. Thanks all.
 

Cableguy

Expert
Licensed User
First of all, start your project... Follow a logic of workflow... And then, only then, if or when you encounter a problem, ask for help about the specific problem that you encounter...

For your kind of app, a few suggestions...
Copy all contacts to whitelist dB.
Give the user the possibility to set white/black list for each contact.

This should keep you busy for a while...
 
Upvote 0

koaunglay

Member
Licensed User
First of all, start your project... Follow a logic of workflow... And then, only then, if or when you encounter a problem, ask for help about the specific problem that you encounter...

For your kind of app, a few suggestions...
Copy all contacts to whitelist dB.
Give the user the possibility to set white/black list for each contact.

This should keep you busy for a while...
Thanks For your reply! Now I am staring my apk. But I can't go on because it works only the first row number in db. So I don't know how should I get all numbers in db.
This is some code in my service module....


B4X:
Sub pe_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
#Region ' block numbers in db
    ' ------------------ Whit DB
    c1 = sq1.ExecQuery("SELECT * FROM Black_table")
    If c1.RowCount > 0 Then
        For i = 0 To c1.RowCount - 1
            c1.Position = i
            Log("White Numbers:==="&c1.GetString("Number"))
    '        numbers = Array As String(c1.GetString("Number"))
    '                    For x = 0 To c1.GetString("Number").Length -1    'numbers(i).Length
    '                        If numbers(x).Trim.Contains(IncomingNumber) Then
                            If c1.GetString("Number").Contains(IncomingNumber) = False Then
                                ac.disableSpeakerphone
                                Kill_Call    ' = False ျဖစ္လွ်င္ db မွာ မပါတဲ့နံပါတ္မ၀င္ရ     ==========
    '''''''                            ToastMessageShow(IncomingNumber, True)
    '''''''                            Log("Incoming is:==="&IncomingNumber)
    '''''''                                ac.LetPhoneRing(3000)
    '''''''                                If ac.isRinging == True Then
    '''''''                                    ac.AnswerPhone
    '''''''                                End If
    '''''''                                ac.enableSpeakerphone
    '        Exit
    '                    Else  If c1.GetString("Number").Contains(IncomingNumber) = True Then 
    ''                        Exit
    '                            ac.disableSpeakerphone
    '                            Kill_Call
    ''                            ToastMessageShow(IncomingNumber, True)
    ''                                ac.LetPhoneRing(3000)
    ''                                If ac.isRinging == True Then
    ''                                    ac.AnswerPhone
    ''                                End If
    ''                                ac.enableSpeakerphone                  
                            End If
    '                    Next  
        Next
    Else
        ToastMessageShow("============", False)
    End If
    c1.Close
    '    =========================
#End Region

End Sub

The first number from db is ok. But I want to get all numbers from db. please see my code and give me some advice and some code... Thanks!!!!
 
Upvote 0
Top