Had some data stored in registry for my App to during launch. But somehow one of the data got wrong. So wanted to delete the app and installed again so that i can start fresh. But looks like even after deleting the app, the data resides in registry which is picked up again by the installed app.
This is happening with the private channel I have created which we test before submitting for publishing.
“RokuJoel” wrote:
Solution is delete the channel, then reboot
Joel
It is not working on the private channel.
Steps applied:
Removed the channel from Roku.
Rebooted the box.
Visited my Roku account and added the private channel again.
System update in Roku to install the app.
Launch the app and it reads the credential from registry(which means registry was not cleared).
Deleting the channel will only clear the registry if you have no other channels installed that were signed with the same key.
Good point. If you have 10 channels signed with the same dev id the registry won’t clear until you delete them all. A faster way to test your channels is to create an app that just deletes all the reg keys, run that and no reboot needed.
“ratish” wrote:
“Deleting the channel will only clear the registry if you have no other channels installed that were signed with the same key.”
With Key do you mean the Dev ID we use to package the zip(channel)?
Yes. Registry hives are on per-DevID basis, meaning all channels signed with the same ID share the same registry (and kinda-sorta can share data between themselves that way). A registry will be deleted for realz only after the lastest channel of a DevID is flushed from the device - and TIL (Today I Learn) that a bonus reboot might be required. (re)see also http://sdkdocs.roku.com/display/sdkdoc/roRegistry
“RokuJoel” wrote:
A faster way to test your channels is to create an app that just deletes all the reg keys, run that and no reboot needed.
For anyone looking for such a channel, here is some code I wrote that does just that.
You can dump the entire registry contents on an roTextScreen, wipe the entire registry clean, or delete individual registry sections.
Tested on firmware 3.1 and 6.1.
Sub Main ()
displayMainUI ()
End Sub
'
' UI component for the top-level menu
'
Function displayMainUI () As Void
contentList = [
{ShortDescriptionLine1: "Dump the whole registry"},
{ShortDescriptionLine1: "Wipe the whole registry"},
{ShortDescriptionLine1: "Delete an individual section"},
]
port = CreateObject ("roMessagePort")
ui = CreateObject ("roPosterScreen")
ui.SetMessagePort (port)
ui.SetListStyle ("flat-category")
ui.SetContentList (contentList)
ui.Show ()
While True
msg = Wait (0, port)
If Type (msg) = "roPosterScreenEvent"
If msg.IsScreenClosed ()
Exit While
Else If msg.IsListItemSelected ()
index = msg.GetIndex ()
If index = 0
dumpRegistryUI ()
Else If index = 1
wipeRegistryUI ()
Else If index = 2
deleteSectionUI ()
EndIf
EndIf
EndIf
End While
End Function
'
' UI component for dumping the entire registry
'
Function dumpRegistryUI () As Void
regText = getRegText ()
If regText = ""
displayMessage ("Registry is empty")
Else
port = CreateObject ("roMessagePort")
ui = CreateObject ("roTextScreen")
ui.SetMessagePort (port)
ui.SetText (fixup (regText)) ' Use fw3.1 bug workaround
ui.AddButton (0, "Quit")
ui.Show ()
While True
msg = Wait (0, port)
If Type (msg) = "roTextScreenEvent"
If msg.IsScreenClosed ()
Exit While
Else If msg.IsButtonPressed ()
ui.Close ()
EndIf
EndIf
End While
EndIf
End Function
'
' UI component for deleting the entire registry
'
Function wipeRegistryUI () As Void
If confirmUI ("Wipe Registry", "Select 'Wipe Registry' to delete the entire registry")
deleteReg ("") ' Delete all sections
EndIf
End Function
'
' UI component for deleting an individual registry section
'
Function deleteSectionUI () As Void
regSectionList = getRegSectionList ()
If regSectionList.Count () = 0
displayMessage ("Registry is empty")
Else
contentList = []
For Each section In regSectionList
If section.keyCount = 0
keyCountStr = "No keys in section"
Else If section.keyCount = 1
keyCountStr = "1 key in section"
Else
keyCountStr = section.keyCount.ToStr () + " keys in section"
EndIf
contentList.Push ({Title: section.name, ShortDescriptionLine1: keyCountStr})
End For
port = CreateObject ("roMessagePort")
ui = CreateObject ("roListScreen")
ui.SetMessagePort (port)
ui.SetupBehaviorAtTopRow ("exit") ' Give fw3.1 users a way back
ui.SetHeader ("Press 'OK' to delete section")
ui.SetContent (contentList)
ui.Show ()
While True
msg = Wait (0, port)
If Type (msg) = "roListScreenEvent"
If msg.IsScreenClosed ()
Exit While
Else If msg.IsListItemSelected ()
section = contentList [msg.GetIndex ()].Title
If confirmUI ("Delete Section", "Select 'Delete Section' to delete the " + section + " section")
deleteReg (section)
ui.Close ()
EndIf
EndIf
EndIf
End While
EndIf
End Function
'
' Return a list of all registry sections and the number of keys in each section
'
Function getRegSectionList () As Object
regSectionList = []
r = CreateObject ("roRegistry")
For Each section In r.GetSectionList ()
rs = CreateObject ("roRegistrySection", section)
regSectionList.Push ({name: section, keyCount: rs.GetKeyList ().Count ()})
End For
Return regSectionList
End Function
'
' Get the contents of a registry section as a text string
'
Function getRegTextSection (sectionName = "" As String) As String
regText = "Registry Section: " + sectionName + LF ()
rs = CreateObject ("roRegistrySection", sectionName)
For Each key In rs.GetKeyList ()
regText = regText + " " + key + ": " + rs.Read (key) + LF ()
End For
Return regText
End Function
'
' Get the contents of a registry or registry section as a text string
'
Function getRegText (sectionName = "" As String) As String
regText = ""
If sectionName = ""
r = CreateObject ("roRegistry")
For Each section In r.GetSectionList ()
regText = regText + getRegTextSection (section) + LF ()
End For
Else
regText = regText + getRegTextSection (sectionName)
Endif
Return regText
End Function
'
' Roku 3.1 firmware roTextScreen bug workaround (buttons don't work unless enough text to scroll)
'
Function fixup (regText As String) As String
fixedText = regText
lfCount = 0
' Count the number of line-ending characters
For i = 1 To Len (regText)
If Mid (regText, i, 1) = LF () Then lfCount = lfCount + 1
End For
' Ensure there are at least 18 lines to guarantee a scroll bar appears
If lfCount < 18 Then fixedText = fixedText + String (18 - lfCount, LF ())
Return fixedText
End Function
'
' Delete the entire registry or an individual registry section
'
Function deleteReg (section = "" As String) As Void
r = CreateObject ("roRegistry")
If section = ""
For Each regSection In r.GetSectionList ()
r.Delete (regSection)
End For
Else
r.Delete (section)
Endif
r.Flush ()
End Function
'
' Display a confirmation before an irreversible action
'
Function confirmUI (buttonText As String, buttonDesc As String) As Boolean
confirm = False
port = CreateObject ("roMessagePort")
ui = CreateObject ("roMessageDialog")
ui.SetMessagePort (port)
ui.SetTitle ("DANGER -- This Action Cannot Be Undone")
ui.SetText ("Select 'Cancel' to go back")
ui.SetText (buttonDesc)
ui.AddButton (0, "Cancel")
ui.AddButton (1, buttonText)
ui.Show ()
While True
msg = Wait (0, port)
If Type (msg) = "roMessageDialogEvent"
If msg.IsScreenClosed ()
Exit While
Else If msg.IsButtonPressed ()
If msg.GetIndex () = 1
confirm = True
EndIf
ui.Close ()
EndIf
EndIf
End While
Return confirm
End Function
'
' Display an informational message
'
Function displayMessage (text As String) As Void
port = CreateObject ("roMessagePort")
ui = CreateObject ("roMessageDialog")
ui.SetMessagePort (port)
ui.SetTitle (text)
ui.AddButton (0, "OK")
ui.Show ()
While True
msg = Wait (0, port)
If Type (msg) = "roMessageDialogEvent"
If msg.IsScreenClosed ()
Exit While
Else If msg.IsButtonPressed ()
ui.Close ()
EndIf
EndIf
End While
End Function
'
' Line-ending character to use in a text string
'
Function LF () As String : Return Chr (10) : End Function
“RokuJoel” wrote:
A faster way to test your channels is to create an app that just deletes all the reg keys, run that and no reboot needed.
For anyone looking for such a channel, here is some code I wrote that does just that.
You can dump the entire registry contents on an roTextScreen, wipe the entire registry clean, or delete individual registry sections.
This prints only the registry from the space where you side loaded your app with the same device ID with which you pushed this Test Code.
It doesn’t seem to print all registry values of all applications in the box.
“RokuJoel” wrote:
A faster way to test your channels is to create an app that just deletes all the reg keys, run that and no reboot needed.
For anyone looking for such a channel, here is some code I wrote that does just that.
You can dump the entire registry contents on an roTextScreen, wipe the entire registry clean, or delete individual registry sections.
This prints only the registry from the space where you side loaded your app with the same device ID with which you pushed this Test Code.
It doesn’t seem to print all registry values of all applications in the box.
There is no way to do that. That would be a huge security hole if you could, as many channels store authentication information in the registry.
“Separation of church and state”, separation of concerns.
Each app gets its own sandbox to play in. Other apps data belongs to them (see “Nunya Business Inc” ).
iOS and Android are even more restrictive (1 app ↔ 1 data), where on Roku one can have “constellation” of apps signed by the same dev-key so they can share data, if one so pleases.
I even tried doing a factory reset, and it seems this data has still persisted. I am using the new Roku SG framework, and I am trying to programmatically delete data in my app when a user logs out, with the deleteRegistry sub Function in generalUtilities (it uses Delete(key)).
Does anyone know why even after a factory reset it still appears as if I am logged in?!?
“lisakb140” wrote:
I even tried doing a factory reset, and it seems this data has still persisted.
That’s not really possible with channel-created data, unless the channel itself is creating it on its initial launch.