Android Question some concerns about this new app....

ivanomonti

Expert
Licensed User
Longtime User
some concerns about this new app, which use simple library B4A is some third party such as Net, Facebook

a device IEE P8000 (Chinese) Android 5.2 with a LG, NGM, Neo Samsung, Asus and 5 am somewhat unpleasant problems, all with Android 5.xxx

1) library phoneid not return phone number on LG, Neo, NGM, everything ok with IEE and Asus
2) library ContentChooser works differently on IEE and ASUS, compared to LG, NGM, Neo
3) Facebook library, still can not say much, but on the IEE, Asus all right and on the usual LG, NGM and neo crash

I wonder if it's me that I write bad or there are other problems, caisco that Android and fragmented so absurd but to make software that works on all devices such libraries should work on all devices, or not work, because some crashes are not reported.

Not only that, the other day I used the canvas to create a visual effect of writing that had different inclinations, just for a look and feel, obviously everything was dynamic, the records that were generavo a hundred, again crash without reporting anything, then for various attempts can not find the deception.

List code in order to figure out where I'm wrong and where it's mistake lies elsewhere.


I have to use massive use of try

B4X:
Sub chooser_Result (Success As Boolean, Dir As String, FileName As String)
    Try  
        If Success Then
           
            If Dir = "ContentDir" Then
               ' code for LG, NGM, Neo <<<------------------------------------------------
                If File.Exists(File.DirRootExternal,"DCIM/COSTOLA") = False Then
                    File.MakeDir(File.DirRootExternal,"DCIM/COSTOLA")
                End If
   
                Dim in As InputStream = File.OpenInput(Dir, FileName)
                Dim out As OutputStream
               
                Try
                    If File.Exists(File.DirRootExternal,"DCIM/COSTOLA/image.jpg") Then
                        File.Delete(File.DirRootExternal,"DCIM/COSTOLA/image.jpg")
                    End If
                Catch
                   
                End Try
               
                out=File.OpenOutput(File.DirRootExternal,"DCIM/COSTOLA/image.jpg",False)
                File.Copy2(in,out)
               
                Dir2 = File.Combine(File.DirRootExternal,"DCIM/COSTOLA")
                FileName2 = "image.jpg"
               
                Try
                    Dim bmp As Bitmap
                    bmp.Initialize(Dir2,FileName2)
                      CenterBitmap(imv,bmp)
                Catch
                    Dir2 = File.Combine(File.DirRootExternal,"DCIM/COSTOLA")
                    FileName2 = "image.jpg"
                    File.Copy(Dir,FileName,Dir2,FileName2)
                    If File.Exists(Dir2,FileName2) Then
                        Dim bmp As Bitmap
                        bmp.Initialize(Dir2,FileName2)
                            CenterBitmap(imv,bmp)
                    End If
                End Try
                       
            Else
               ' code for EIE, Asus <<<------------------------------------------------
                Dir2 = File.Combine(File.DirRootExternal,"DCIM/COSTOLA")
                FileName2 = "image.jpg"
                File.Copy(Dir,FileName,Dir2,FileName2)
                If File.Exists(Dir2,FileName2) Then
                    Dim bmp As Bitmap
                    bmp.Initialize(Dir2,FileName2)
                        CenterBitmap(imv,bmp)
                End If
            End If
        Else
            ToastMessageShow("No image selected", True)
        End If
    Catch
        ToastMessageShow("Errore di caricamento immagine", True)
    End Try
End Sub

code for phoneid

B4X:
Sub setphone
    Try
        Dim p As PhoneId
        phone = p.GetLine1Number ' ok for EIE, Asus
        If phone.Length <= 0 Then
            phone = p.GetDeviceId '<--------- FOR LG, NGM, NEO
        End If
    Catch
        phone = 0
    End Try
End Sub

code Facebook

B4X:
#region facebook

Sub LoginFacebook
    fb.LoginWithPermissions(Array As String(fb.PERMISSION_PUBLISH_ACTIONS))
End Sub

Sub PostToTimelineFacebook(message As String, link As String)
    If fblog = True Then
        ProgressDialogShow2("Stiamo inserendo il tuo post nel tuo diario",False)
        fb.PostToTimeline("me", message, link)
    Else
        Dim i As Int = Msgbox2("il modulo facebook non è stato attivato","Facebook","Attiva","Non ora","",Null)
        If i = -1 Then
            LoginFacebook
        Else
            Return
        End If
    End If
End Sub

Sub myFB_Login_Response(Success As Boolean)
    If Success = True Then 
        fblog = Success
    Else
        fblog = Success
    End If
End Sub

Sub myFB_Facebook_ErrorMessages(Message As String)
    ToastMessageShow(Message,True)
End Sub

Sub myFB_MyProfile_Response(Profile As Map)

    Dim Temp As String

    For I = 0 To Profile.Size - 1
        Temp = Temp & Profile.GetKeyAt(I) & ": " & Profile.GetValueAt(I) & CRLF
    Next

    ToastMessageShow(Temp,True)               
   
End Sub

Sub myFB_PostToTimeline_Response(MessageID As String)
    ProgressDialogHide
    ToastMessageShow("il tuo post è stato aggiunto nel tuo diario",True)
    ' memorizzare id ultimo messaggio per eliminazione in tempo reale
    ' PostToDeleteID = MessageID
End Sub

#End Region

THANK
 
Top