Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ongoing status for Android TV apps? (What to use instead of notification bar on Android)

My own app, a VPN app, currently relay on the notification bar and Android own VPN status symbol to communicate its status to users.

On Android TV a user has no way to tell if he is connected to the VPN or not. This is also a slight security problem (for malicious VPN apps).

The only thing I found is the now playing behaviour for media apps.

My question is: Is there any way to change the own launcher icon dynamically or have some other way of presenting the current background status to the user without forcing the user to open the app?

like image 296
plaisthos Avatar asked Oct 30 '22 11:10

plaisthos


1 Answers

You can use a notification, although it is considered a recommendation in the Android TV system. Changing the launcher icon is not supported.

Here's a sample notification that works on Android TV.

Notification notification = new NotificationCompat.BigPictureStyle(
            new NotificationCompat.Builder(mContext)
                    .setContentTitle(video.getString("title"))
                    .setContentText(mDescription)
                    .setPriority(mPriority)
                    .setLocalOnly(true)
                    .setOngoing(true)
                    .setColor(mContext.getResources().getColor(android.R.color.holo_green_dark))
                    .setCategory(Notification.CATEGORY_RECOMMENDATION)
                    .setLargeIcon(thumbnail)
                    .setSmallIcon(R.drawable.ic_note)
                    .setContentIntent(launchApp(mContext))
                    .setExtras(null))
            .build();


    return notification;
like image 196
Nick Felker Avatar answered Nov 15 '22 07:11

Nick Felker