Forum Xamarin.Android

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

How to prevent showing on OS toolbar and disable buttons on App Info on Lollipop

pingpong.6106pingpong.6106 USMember ✭✭
edited August 2018 in Xamarin.Android

Hi,

I have a Xamarin app via .NET running on custom restricted Lollipop.

I want to know if it is disable the scenarios below

1 Make it not appear on OS toolbar (the bar that slides down from the top when users swipe down)
2 disable display of App info for the app
3 disable all buttons on App Info page.

Toolbar: Make it not appear on OS toolbar below
Toolbar

App Info
2 disable display of App Info for the app
3 disable all buttons on App Info page.
App info

Tagged:

Best Answers

Answers

  • BillyLiuBillyLiu Member, Xamarin Team Xamurai

    @pingpong.6106

    1 Make it not appear on OS toolbar (the bar that slides down from the top when users swipe down)

    Do you call StartForeground() in your app? It will display the notification.

    2 disable display of App info for the app
    3 disable all buttons on App Info page.

    I'm afraid it is impossible. These are managed by system.

  • pingpong.6106pingpong.6106 USMember ✭✭

    Hi @BillyLiu

    I was told it is possible to redirect users to the app whenever the icon on Navigation is clicked?

    I wonder if you have info and sample code on this?

    Thanks in advance.

  • pingpong.6106pingpong.6106 USMember ✭✭

    Hi,

    I meant the OS toolbar at the top of the screen on my previous post.

  • pingpong.6106pingpong.6106 USMember ✭✭
    edited September 2018

    Hi @BillyLiu,

    I follow the code below, it works. But my question is that how can I redirect users to the last Activity rather than the hard-code activity? For example, the last Activity might be different when users navigate to different activity.

    var intent = new Intent(this, typeof(MainActivity));
    intent.AddFlags(ActivityFlags.ClearTop);
    var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.OneShot);

        var notificationBuilder = new Notification.Builder(this)
            .SetSmallIcon(Resource.Drawable.ic_stat_ic_notification)
            .SetContentTitle("Message")
            .SetAutoCancel(true)
            .SetContentIntent(pendingIntent);
    
        var notificationManager = NotificationManager.FromContext(this);
        notificationManager.Notify(0, notificationBuilder.Build());
    
Sign In or Register to comment.