#Region Project Attributes
#ApplicationLabel: deezer Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim deeze As Deezer
Dim lis As ListView
Private ids As List
Dim p As AlbumPlayer
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")Me,.AsView
ids.Initialize
lis.Initialize("list")
Activity.AddView(lis,0,0,-1,-1)
deeze.Initialize("deez", "yourapplicationidhere")
If deeze.restoreSessionStore Then
Log("Restored")
StartActivity(Me )
getAlbums
Else
Log("Not restored")
deeze.authorize(Array As String(deeze.PERMISSION_BASIC_ACCESS,deeze.PERMISSION_MANAGE_LIBRARY,deeze.PERMISSION_LISTENING_HISTORY))
End If
End Sub
Sub list_itemclick(position As Int,value As Object)
p.playAlbum(ids.Get(position))
End Sub
Sub getAlbums
deeze.requestAsync(11472,"myRequest")
End Sub
Sub deez_onresult(albums As List)
For a = 0 To albums.Size-1
Dim al As Album = albums.Get(a)
lis.AddTwoLines(al.Title,al.Label)
ids.Add(al.Id)
Next
p.Initialize("p",deeze.deezerConnect,True)
p.addOnPlayerStateChangeListener
End Sub
Sub p_onplayerstatechange(state As String,timePosition As Long)
Log("Playerstate: "&state& " time: "&timePosition)
End Sub
Sub deez_oncomplete(accesstoken As String , expires As String)
Log(accesstoken&" expires : "&expires)
deeze.saveSessionStore
getAlbums
End Sub
Sub deez_oncancel
Log("deez_oncancel")
End Sub
Sub deez_onexception(err As String)
Log(err)
End Sub
Sub Activity_Resume
deeze.restoreSessionStore
End Sub
Sub Activity_Pause (UserClosed As Boolean)
If UserClosed Then
p.stop
p.release
End If
End Sub