Java Code Examples for androidx.core.app.NotificationCompat#VISIBILITY_PRIVATE

The following examples show how to use androidx.core.app.NotificationCompat#VISIBILITY_PRIVATE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MockDatabase.java    From user-interface-samples with Apache License 2.0 5 votes vote down vote up
private BigPictureStyleSocialAppData() {
    // Standard Notification values:
    // Title/Content for API <16 (4.0 and below) devices.
    mContentTitle = "Bob's Post";
    mContentText = "[Picture] Like my shot of Earth?";
    mPriority = NotificationCompat.PRIORITY_HIGH;

    // Style notification values:
    mBigImage = R.drawable.earth;
    mBigContentTitle = "Bob's Post";
    mSummaryText = "Like my shot of Earth?";

    // This would be possible responses based on the contents of the post.
    mPossiblePostResponses = new CharSequence[] {"Yes", "No", "Maybe?"};

    mParticipants = new ArrayList<>();
    mParticipants.add("Bob Smith");

    // Notification channel values (for devices targeting 26 and above):
    mChannelId = "channel_social_1";
    // The user-visible name of the channel.
    mChannelName = "Sample Social";
    // The user-visible description of the channel.
    mChannelDescription = "Sample Social Notifications";
    mChannelImportance = NotificationManager.IMPORTANCE_HIGH;
    mChannelEnableVibrate = true;
    mChannelLockscreenVisibility = NotificationCompat.VISIBILITY_PRIVATE;
}
 
Example 2
Source File: MockDatabase.java    From user-interface-samples with Apache License 2.0 5 votes vote down vote up
private InboxStyleEmailAppData() {
    // Standard Notification values:
    // Title/Content for API <16 (4.0 and below) devices.
    mContentTitle = "5 new emails";
    mContentText = "from Jane, Jay, Alex +2 more";
    mNumberOfNewEmails = 5;
    mPriority = NotificationCompat.PRIORITY_DEFAULT;

    // Style notification values:
    mBigContentTitle = "5 new emails from Jane, Jay, Alex +2";
    mSummaryText = "New emails";

    // Add each summary line of the new emails, you can add up to 5.
    mIndividualEmailSummary = new ArrayList<>();
    mIndividualEmailSummary.add("Jane Faab  -   Launch Party is here...");
    mIndividualEmailSummary.add("Jay Walker -   There's a turtle on the server!");
    mIndividualEmailSummary.add("Alex Chang -   Check this out...");
    mIndividualEmailSummary.add("Jane Johns -   Check in code?");
    mIndividualEmailSummary.add("John Smith -   Movies later....");

    // If the phone is in "Do not disturb mode, the user will still be notified if
    // the user(s) is starred as a favorite.
    mParticipants = new ArrayList<>();
    mParticipants.add("Jane Faab");
    mParticipants.add("Jay Walker");
    mParticipants.add("Alex Chang");
    mParticipants.add("Jane Johns");
    mParticipants.add("John Smith");

    // Notification channel values (for devices targeting 26 and above):
    mChannelId = "channel_email_1";
    // The user-visible name of the channel.
    mChannelName = "Sample Email";
    // The user-visible description of the channel.
    mChannelDescription = "Sample Email Notifications";
    mChannelImportance = NotificationManager.IMPORTANCE_DEFAULT;
    mChannelEnableVibrate = true;
    mChannelLockscreenVisibility = NotificationCompat.VISIBILITY_PRIVATE;
}
 
Example 3
Source File: MockDatabase.java    From android-Notifications with Apache License 2.0 5 votes vote down vote up
private BigPictureStyleSocialAppData() {
    // Standard Notification values:
    // Title/Content for API <16 (4.0 and below) devices.
    mContentTitle = "Bob's Post";
    mContentText = "[Picture] Like my shot of Earth?";
    mPriority = NotificationCompat.PRIORITY_HIGH;

    // Style notification values:
    mBigImage = R.drawable.earth;
    mBigContentTitle = "Bob's Post";
    mSummaryText = "Like my shot of Earth?";

    // This would be possible responses based on the contents of the post.
    mPossiblePostResponses = new CharSequence[] {"Yes", "No", "Maybe?"};

    mParticipants = new ArrayList<>();
    mParticipants.add("Bob Smith");

    // Notification channel values (for devices targeting 26 and above):
    mChannelId = "channel_social_1";
    // The user-visible name of the channel.
    mChannelName = "Sample Social";
    // The user-visible description of the channel.
    mChannelDescription = "Sample Social Notifications";
    mChannelImportance = NotificationManager.IMPORTANCE_HIGH;
    mChannelEnableVibrate = true;
    mChannelLockscreenVisibility = NotificationCompat.VISIBILITY_PRIVATE;
}
 
Example 4
Source File: MockDatabase.java    From android-Notifications with Apache License 2.0 5 votes vote down vote up
private InboxStyleEmailAppData() {
    // Standard Notification values:
    // Title/Content for API <16 (4.0 and below) devices.
    mContentTitle = "5 new emails";
    mContentText = "from Jane, Jay, Alex +2 more";
    mNumberOfNewEmails = 5;
    mPriority = NotificationCompat.PRIORITY_DEFAULT;

    // Style notification values:
    mBigContentTitle = "5 new emails from Jane, Jay, Alex +2";
    mSummaryText = "New emails";

    // Add each summary line of the new emails, you can add up to 5.
    mIndividualEmailSummary = new ArrayList<>();
    mIndividualEmailSummary.add("Jane Faab  -   Launch Party is here...");
    mIndividualEmailSummary.add("Jay Walker -   There's a turtle on the server!");
    mIndividualEmailSummary.add("Alex Chang -   Check this out...");
    mIndividualEmailSummary.add("Jane Johns -   Check in code?");
    mIndividualEmailSummary.add("John Smith -   Movies later....");

    // If the phone is in "Do not disturb mode, the user will still be notified if
    // the user(s) is starred as a favorite.
    mParticipants = new ArrayList<>();
    mParticipants.add("Jane Faab");
    mParticipants.add("Jay Walker");
    mParticipants.add("Alex Chang");
    mParticipants.add("Jane Johns");
    mParticipants.add("John Smith");

    // Notification channel values (for devices targeting 26 and above):
    mChannelId = "channel_email_1";
    // The user-visible name of the channel.
    mChannelName = "Sample Email";
    // The user-visible description of the channel.
    mChannelDescription = "Sample Email Notifications";
    mChannelImportance = NotificationManager.IMPORTANCE_DEFAULT;
    mChannelEnableVibrate = true;
    mChannelLockscreenVisibility = NotificationCompat.VISIBILITY_PRIVATE;
}
 
Example 5
Source File: MockDatabase.java    From wear-os-samples with Apache License 2.0 4 votes vote down vote up
private MessagingStyleCommsAppData(Context context) {
    // Standard notification values:
    // Content for API <24 (M and below) devices.
    // Note: I am actually hardcoding these Strings based on info below. You would be
    // pulling these values from the same source in your database. I leave this up here, so
    // you can see the standard parts of a Notification first.
    mContentTitle = "3 Messages w/ Famous, Wendy";
    mContentText = "HEY, I see my house! :)";
    mPriority = NotificationCompat.PRIORITY_HIGH;

    // Create the users for the conversation.
    // Name preferred when replying to chat.
    mMe =
            new Person.Builder()
                    .setName("Me MacDonald")
                    .setKey("1234567890")
                    .setUri("tel:1234567890")
                    .setIcon(
                            IconCompat.createWithResource(context, R.drawable.me_macdonald))
                    .build();

    Person participant1 =
            new Person.Builder()
                    .setName("Famous Fryer")
                    .setKey("9876543210")
                    .setUri("tel:9876543210")
                    .setIcon(
                            IconCompat.createWithResource(context, R.drawable.famous_fryer))
                    .build();

    Person participant2 =
            new Person.Builder()
                    .setName("Wendy Wonda")
                    .setKey("2233221122")
                    .setUri("tel:2233221122")
                    .setIcon(IconCompat.createWithResource(context, R.drawable.wendy_wonda))
                    .build();

    // If the phone is in "Do not disturb mode, the user will still be notified if
    // the user(s) is starred as a favorite.
    // Note: You don't need to add yourself, aka 'me', as a participant.
    mParticipants = new ArrayList<>();
    mParticipants.add(participant1);
    mParticipants.add(participant2);

    mMessages = new ArrayList<>();

    // For each message, you need the timestamp. In this case, we are using arbitrary longs
    // representing time in milliseconds.
    mMessages.add(
            // When you are setting an image for a message, text does not display.
            new MessagingStyle.Message("", 1528490641998L, participant1)
                    .setData(
                            "image/png", resourceToUri(context, R.drawable.earth)));

    mMessages.add(
            new MessagingStyle.Message(
                    "Visiting the moon again? :P", 1528490643998L, mMe));

    mMessages.add(
            new MessagingStyle.Message(
                    "HEY, I see my house!", 1528490645998L, participant2));

    // String version of the mMessages above.
    mFullConversation =
            "Famous: [Picture of Moon]\n\n"
                    + "Me: Visiting the moon again? :P\n\n"
                    + "Wendy: HEY, I see my house! :)\n\n";

    // Responses based on the last messages of the conversation. You would use
    // Machine Learning to get these (https://developers.google.com/ml-kit/).
    mReplyChoicesBasedOnLastMessages =
            new CharSequence[] {"Me too!", "How's the weather?", "You have good eyesight."};

    // Notification channel values (for devices targeting 26 and above):
    mChannelId = "channel_messaging_1";
    // The user-visible name of the channel.
    mChannelName = "Sample Messaging";
    // The user-visible description of the channel.
    mChannelDescription = "Sample Messaging Notifications";
    mChannelImportance = NotificationManager.IMPORTANCE_MAX;
    mChannelEnableVibrate = true;
    mChannelLockscreenVisibility = NotificationCompat.VISIBILITY_PRIVATE;
}
 
Example 6
Source File: MockDatabase.java    From user-interface-samples with Apache License 2.0 4 votes vote down vote up
private MessagingStyleCommsAppData(Context context) {
    // Standard notification values:
    // Content for API <24 (M and below) devices.
    // Note: I am actually hardcoding these Strings based on info below. You would be
    // pulling these values from the same source in your database. I leave this up here, so
    // you can see the standard parts of a Notification first.
    mContentTitle = "3 Messages w/ Famous, Wendy";
    mContentText = "HEY, I see my house! :)";
    mPriority = NotificationCompat.PRIORITY_HIGH;

    // Create the users for the conversation.
    // Name preferred when replying to chat.
    mMe =
            new Person.Builder()
                    .setName("Me MacDonald")
                    .setKey("1234567890")
                    .setUri("tel:1234567890")
                    .setIcon(
                            IconCompat.createWithResource(context, R.drawable.me_macdonald))
                    .build();

    Person participant1 =
            new Person.Builder()
                    .setName("Famous Frank")
                    .setKey("9876543210")
                    .setUri("tel:9876543210")
                    .setIcon(
                            IconCompat.createWithResource(context, R.drawable.famous_fryer))
                    .build();

    Person participant2 =
            new Person.Builder()
                    .setName("Wendy Weather")
                    .setKey("2233221122")
                    .setUri("tel:2233221122")
                    .setIcon(IconCompat.createWithResource(context, R.drawable.wendy_wonda))
                    .build();

    // If the phone is in "Do not disturb mode, the user will still be notified if
    // the user(s) is starred as a favorite.
    // Note: You don't need to add yourself, aka 'me', as a participant.
    mParticipants = new ArrayList<>();
    mParticipants.add(participant1);
    mParticipants.add(participant2);

    mMessages = new ArrayList<>();

    // For each message, you need the timestamp. In this case, we are using arbitrary longs
    // representing time in milliseconds.
    mMessages.add(
            // When you are setting an image for a message, text does not display.
            new MessagingStyle.Message("", 1528490641998l, participant1)
                    .setData("image/png", resourceToUri(context, R.drawable.earth)));

    mMessages.add(
            new MessagingStyle.Message(
                    "Visiting the moon again? :P", 1528490643998l, mMe));

    mMessages.add(
            new MessagingStyle.Message("HEY, I see my house!", 1528490645998l, participant2));

    // String version of the mMessages above.
    mFullConversation =
            "Famous: [Picture of Moon]\n\n"
                    + "Me: Visiting the moon again? :P\n\n"
                    + "Wendy: HEY, I see my house! :)\n\n";

    // Responses based on the last messages of the conversation. You would use
    // Machine Learning to get these (https://developers.google.com/ml-kit/).
    mReplyChoicesBasedOnLastMessages =
            new CharSequence[] {"Me too!", "How's the weather?", "You have good eyesight."};

    // Notification channel values (for devices targeting 26 and above):
    mChannelId = "channel_messaging_1";
    // The user-visible name of the channel.
    mChannelName = "Sample Messaging";
    // The user-visible description of the channel.
    mChannelDescription = "Sample Messaging Notifications";
    mChannelImportance = NotificationManager.IMPORTANCE_MAX;
    mChannelEnableVibrate = true;
    mChannelLockscreenVisibility = NotificationCompat.VISIBILITY_PRIVATE;
}
 
Example 7
Source File: MockDatabase.java    From android-Notifications with Apache License 2.0 4 votes vote down vote up
private MessagingStyleCommsAppData(Context context) {
    // Standard notification values:
    // Content for API <24 (M and below) devices.
    // Note: I am actually hardcoding these Strings based on info below. You would be
    // pulling these values from the same source in your database. I leave this up here, so
    // you can see the standard parts of a Notification first.
    mContentTitle = "3 Messages w/ Famous, Wendy";
    mContentText = "HEY, I see my house! :)";
    mPriority = NotificationCompat.PRIORITY_HIGH;

    // Create the users for the conversation.
    // Name preferred when replying to chat.
    mMe =
            new Person.Builder()
                    .setName("Me MacDonald")
                    .setKey("1234567890")
                    .setUri("tel:1234567890")
                    .setIcon(
                            IconCompat.createWithResource(context, R.drawable.me_macdonald))
                    .build();

    Person participant1 =
            new Person.Builder()
                    .setName("Famous Fryer")
                    .setKey("9876543210")
                    .setUri("tel:9876543210")
                    .setIcon(
                            IconCompat.createWithResource(context, R.drawable.famous_fryer))
                    .build();

    Person participant2 =
            new Person.Builder()
                    .setName("Wendy Wonda")
                    .setKey("2233221122")
                    .setUri("tel:2233221122")
                    .setIcon(IconCompat.createWithResource(context, R.drawable.wendy_wonda))
                    .build();

    // If the phone is in "Do not disturb mode, the user will still be notified if
    // the user(s) is starred as a favorite.
    // Note: You don't need to add yourself, aka 'me', as a participant.
    mParticipants = new ArrayList<>();
    mParticipants.add(participant1);
    mParticipants.add(participant2);

    mMessages = new ArrayList<>();

    // For each message, you need the timestamp. In this case, we are using arbitrary longs
    // representing time in milliseconds.
    mMessages.add(
            // When you are setting an image for a message, text does not display.
            new MessagingStyle.Message("", 1528490641998l, participant1)
                    .setData("image/png", resourceToUri(context, R.drawable.earth)));

    mMessages.add(
            new MessagingStyle.Message(
                    "Visiting the moon again? :P", 1528490643998l, mMe));

    mMessages.add(
            new MessagingStyle.Message("HEY, I see my house!", 1528490645998l, participant2));

    // String version of the mMessages above.
    mFullConversation =
            "Famous: [Picture of Moon]\n\n"
                    + "Me: Visiting the moon again? :P\n\n"
                    + "Wendy: HEY, I see my house! :)\n\n";

    // Responses based on the last messages of the conversation. You would use
    // Machine Learning to get these (https://developers.google.com/ml-kit/).
    mReplyChoicesBasedOnLastMessages =
            new CharSequence[] {"Me too!", "How's the weather?", "You have good eyesight."};

    // Notification channel values (for devices targeting 26 and above):
    mChannelId = "channel_messaging_1";
    // The user-visible name of the channel.
    mChannelName = "Sample Messaging";
    // The user-visible description of the channel.
    mChannelDescription = "Sample Messaging Notifications";
    mChannelImportance = NotificationManager.IMPORTANCE_MAX;
    mChannelEnableVibrate = true;
    mChannelLockscreenVisibility = NotificationCompat.VISIBILITY_PRIVATE;
}