French L'appli Radio les Floralies

hub73

Active Member
Licensed User
Longtime User
Bonjour à tous.
J'ai réalisé une application android pour écouter notre nouvelle webradio associative "Radio Les Floralies".
L'appli est disponible en apk sur le site de la radio http://www.lesfloralies.info
Le code source est en pièce jointe.

C'est une première version, j'aurai besoin de vos retours :
- L'application s'affiche t-elle correctement depuis votre smartphone ou tablette ?
- Pouvez vous écouter le flux sonore ou pas (il y a un pb de sécurité sur certains smartphones).
- Pouvez vous regarder le code de l'application et me conseiller pour assurer son bon fonctionnement. (Je ne souhaite pas ajouter de nouvelles fonctionnalités)

Merci à vous !
 

Attachments

  • RadioLesFloraliesPlayer.zip
    42.7 KB · Views: 191

Marc DANIEL

Well-Known Member
Licensed User
Screenshot_20210410-125521.PNG







Capture d'écran sur mon SONY XPERIA XZ1 G8341 pas tout neuf avec Android 9
 
Last edited:

Marc DANIEL

Well-Known Member
Licensed User
Peut-être serait-il utile de paramétrer la touche «Back» du Smartphone pour ajouter une option de fermeture de l'application.
Cordialement. Marc DANIEL

par exemple >>>

ExtraitCode.PNG





 
Last edited:

Marc DANIEL

Well-Known Member
Licensed User
Screenshot_20210410-132933.png

Capture d'écran sur tablette ZONKO K108-EAA 10,1 pouces - Android 9
Rien à signaler d'anormal sur la tablette ...
 

hub73

Active Member
Licensed User
Longtime User
Merci beaucoup pour le retour Daniel. J'ai simplifié la présentation avec un seul webview. Pour afficher le programme il faut désormais passer par le menu. J'ai également revu les couleurs pour correspondre à ma charte graphique. J'ai ajouté le code pour quitter l'application avec la touche 'back'.
 

Attachments

  • RadioLesFloraliesPlayer1.2.zip
    43 KB · Views: 177
Last edited:

hub73

Active Member
Licensed User
Longtime User
Par contre, mon système de notification (bouton play, stop et quitter) ne fonctionne pas. Il doit manquer qqchose ! La notification s'affiche mais lorsque je touche une icone, play, stop ou quitter ca ne fait rien.

B4X:
#Region  Service Attributes
    #StartAtBoot: False
    #ExcludeFromLibrary: 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.
   
    Private nid As Int = 1
    Private lock As PhoneWakeState
   
    Private Radio As Bitmap
    Private Icone1 As Bitmap
    Private Icone2 As Bitmap
    Private Icone3 As Bitmap

End Sub

Sub Service_Create
    'This is the program entry point.
    'This is a good place to load resources that are not specific to a single activity.
    lock.PartialLock
   
    Radio =  LoadBitmapResize(File.DirAssets, "radio.png", 24dip, 24dip, False)
    Icone1 = LoadBitmapResize(File.DirAssets, "play.png", 24dip, 24dip, False)
    Icone2 = LoadBitmapResize(File.DirAssets, "stop.png", 24dip, 24dip, False)
    Icone3 = LoadBitmapResize(File.DirAssets, "exit.png", 24dip, 24dip, False)
    'Play
    Service.StartForeground(nid, MediaStyle_Notification )
       
End Sub

Public Sub Jouer
    Service.StopForeground(nid)
    CallSub(Main,"Jouer")
End Sub

Public Sub Stop
    Service.StopForeground(nid)
    CallSub(Main,"Stop")
End Sub

Public Sub Quitter
    Service.StopForeground(nid)
    CallSub(Main,"Quitter")
End Sub


Sub Service_Start (StartingIntent As Intent)
   
    Service.StopAutomaticForeground 'Starter service can start in the foreground state in some edge cases.
   
    If StartingIntent.IsInitialized Then
        Dim cs As CSBuilder
        cs.Initialize.Bold.Size(20).Append($"Action: ${StartingIntent.Action}"$).PopAll
        Log(cs)
        If StartingIntent.Action="Jouer" Then Jouer
        If StartingIntent.Action="Stop" Then Stop
        If StartingIntent.Action="Quitter" Then Quitter
    End If
    'Service.StopAutomaticForeground
   
End Sub

Sub MediaStyle_Notification As Notification
    Dim n As NB6
    n.Initialize("default", Application.LabelName, "LOW").SmallIcon (Radio)
    n.AddButtonAction(Icone1, "Action 1", Me, "Jouer") 'use different bitmaps...
    n.AddButtonAction(Icone2, "Action 2",Me, "Stop")
    n.AddButtonAction(Icone3, "Action 3", Me, "Quitter")
    n.MediaStyle
    Return n.Build("", "", "tag", Me)
End Sub

Sub Service_TaskRemoved
    'This event will be raised when the user removes the app from the recent apps list.
End Sub

'Return true to allow the OS default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

Sub Service_Destroy
    CallSub(Main,"Quitter")
    lock.ReleasePartialLock
End Sub
 

Marc DANIEL

Well-Known Member
Licensed User
Screenshot_avecToucheBack.PNG

Voilà ce que ça donne sur mon Smartphone SONY
Cordialement,
Marc
 

Attachments

  • RadioLesFloralies.zip
    43 KB · Views: 190

Marc DANIEL

Well-Known Member
Licensed User
J'ai testé ton nouveau programme "RadioLesFloraliesPlayer1" mais je ne remarque rien d'anormal avec Play, Stop et Quitter
Cordialement,
Marc
 
Top