Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
New Developer
dev
Posts: 22
Registered: ‎08-17-2009
My Device: Not Specified

How to create add-in in device manager

I am trying to create a simple sync app to interface the syncdemo

 

Referring to this 

http://na.blackberry.com/eng/devjournals/resources/journals/jul_2005/vb_desktop_addin_pt_1.jsp#Figur...

 

Created a VB.NET class library project and added a class DataSync.v. In the project property compile option checked 'Register for com interop'

 

The desktop manager doesn't show the plugin.  Infact I don't see it the regeditor as decribed in the link above.

 

Could someone help me with this.

 

  • For creating a desktop sync app, do I must need to use the desktop manager
  • If yes, how do I make a MSI installer etc. that could register the plug-in the desktop manager. 
  • Do I need to create a seperate application to edit the data file (contact.xml), or can create an interface in the project etc
  • If the desktop manager is running and auto sync is on, If the contact.xml edited by a seperate app, will it straightaway update the connected BB  syncdemo data.
  • Would be great if someone could share a sync desktop app in .NET

 

Thanks in advance.

 

Here is the  DataSync code.

 

Imports DESKTOPAPILib

Class DataSync
    Implements IRimExtension

    Public Sub Configure(ByVal pRimUtility As DESKTOPAPILib.IRimUtility, ByVal hWnd As Integer) Implements IRimExtension.Configure
        '*** You can add code here if you want your user to display
        '*** a screen allowingusers to configure any parameters
    End Sub

    Sub GetErrorString(ByVal errorCode As Integer, ByRef errorMsg As String) Implements IRimExtension.GetErrorString
        MsgBox("Encountered a problem during synchronization", vbCritical, "SyncSample Data Synchronization")
    End Sub

    Sub GetExtensionInfo(ByRef extensionInfo As String) Implements IRimExtension.GetExtensionInfo
        extensionInfo = "<?xml version=""1.0"" encoding=""UTF-8"" ?><extensioninfo version=""1.0.0"">" & _
         vbCrLf & "<vendorname>Your company here</vendorname>" & _
    vbCrLf & "<vendorversion>1.0</vendorversion>" & _
    vbCrLf & "<path>G:\\SyncDemo\\SyncDemo\\SyncDemo\\bin\\Debug</path>" & _
    vbCrLf & "<description>Sample addin using VB 6.0" & _
    "</description><displayname>Sample addin using VB 6.0</displayname><clsid>{7BC5A21E-D252-4F36-9591-9656D3C76415}" & _
    "</clsid><access><database>Contacts</database></access></extensioninfo>"
    End Sub

    Sub Process(ByVal pRimUtility As DESKTOPAPILib.IRimUtility, ByVal pRimDeviceAccess As DESKTOPAPILib.IRimDatabaseAccess) Implements IRimExtension.Process

        Dim oTemp As Object
        Dim oProgress As DESKTOPAPILib.IRimProgress
        Dim oTables As DESKTOPAPILib.IRimTables
        Dim oTable As DESKTOPAPILib.IRimTable
        Dim oContact As DESKTOPAPILib.IRimTable
        Dim oRecords As DESKTOPAPILib.IRimRecords
        Dim oRecord As DESKTOPAPILib.IRimRecord
        Dim oFields As DESKTOPAPILib.IRimFields
        Dim oField As DESKTOPAPILib.IRimField
        Dim oXML As Xml.XmlDocument
        Dim oNodes As Xml.XmlNodeList
        Dim oNode As Xml.XmlNode
        Dim sPath As String
        Dim l As Long
        Dim lHigh As Long
        Const FIELDTAG_FIRSTNAME = 1
        Const FIELDTAG_LASTNAME = 2
        Const FIELDTAG_EMAIL = 3

        On Error GoTo ErrorHandler
        oXML = New Xml.XmlDocument

        oXML.Load(Application.StartupPath & "\ContactList.xml")

        oTemp = pRimUtility

        If TypeOf oTemp Is IRimProgress Then
            oProgress = oTemp
        End If

        oProgress.SetProgressDlgText(eRIM_ProgressText.RIM_ProgressText_Title, "Sample Data Syncronization")
        oProgress.SetProgressDlgText(eRIM_ProgressText.RIM_ProgressText_Msg, "Start of data syncronization...")

        If oXML.ChildNodes.Count > 0 Then
            '*** only do the sync if we got valid data
            oTables = pRimDeviceAccess.Tables

            '*** let's get the application table from the device
            For Each oTable In oTables
                If oTable.Name = "Contacts" Then
                    oContact = oTable
                    Exit For
                End If
            Next

            If oContact Is Nothing Then
                MsgBox("Could not find the Contact database in the device", vbCritical)
            Else
                '*** let's clear the device of existing data
                oContact.Clear()
                oContact.Update()

                '*** let's set it up for updating
                oRecords = oContact.LoadRecords(eRIM_Mode.RIM_Mode_ReadWrite)

                oNodes = oXML.SelectNodes("//contact")
                lHigh = oNodes.Count - 1

                If lHigh >= 0 Then
                    l = 0
                    oProgress.Notify(eRIM_Progress.RIM_Progress_Count, lHigh, 1)

                    For Each oNode In oNodes
                        oRecord = oRecords.AddRecord
                        oFields = oRecord.fields

                        If Not oFields Is Nothing Then
                            addField(oFields, FIELDTAG_FIRSTNAME, oNode.ChildNodes(0).InnerText)
                            addField(oFields, FIELDTAG_LASTNAME, oNode.ChildNodes(1).InnerText)
                            addField(oFields, FIELDTAG_EMAIL, oNode.ChildNodes(2).InnerText)
                        End If

                        oRecord.Update()
                        oField = Nothing
                        oRecord = Nothing
                        l = l + 1
                        oProgress.SetProgressDlgText(eRIM_ProgressText.RIM_ProgressText_Msg, "Uploading " & l & " of " & lHigh)
                        oProgress.Notify(eRIM_Progress.RIM_Progress_Pos, l, 0)
                    Next

                    oProgress.SetProgressDlgText(eRIM_ProgressText.RIM_ProgressText_Msg, "please wait to wrap up the syncronization...")
                End If
            End If
        End If
        Exit Sub

ErrorHandler:
        MsgBox("Encountered an error during synchronization:" & Err.Number & " " & Err.Description, vbCritical, "Sample Data Synchronization")
        Stop
        Resume
    End Sub

    Private Sub addField(ByVal oFields As DESKTOPAPILib.IRimFields, ByVal iFieldId As Integer, ByVal sData As String)
        Dim oField As DESKTOPAPILib.IRimField
        Dim ayWork() As Byte

        sData = sData & Chr(0)
        oField = oFields.AddField
        oField.Id = iFieldId
        ayWork = System.Text.UnicodeEncoding.ASCII.GetBytes(StrConv(sData, VbStrConv.None))
        oField.value = ayWork
    End Sub
End Class

 

 

 

 

Please use plain text.
New Developer
New Developer
dev
Posts: 22
Registered: ‎08-17-2009
My Device: Not Specified

Re: How to create add-in in device manager

:smileyhappy: Victory. I could see the plug in desktop manager. It seems applicatons in the download folder are not 'installed applications' for BB device emulator.
Please use plain text.
New Developer
futurebeam
Posts: 1
Registered: ‎11-30-2009
My Device: Not Specified

Re: How to create add-in in device manager

Hi,

 

I'm working on a .NET Desktop Manager plugin as well. Do you have some example code you could share? Or a short description of what you did to make DM aware of it? I followed the instructions you linked to, but did not archieve success so far :smileysad:

Please use plain text.