Pro Android with Kotlin


Download 5.42 Mb.
Pdf ko'rish
bet132/223
Sana04.11.2023
Hajmi5.42 Mb.
#1746807
1   ...   128   129   130   131   132   133   134   135   ...   223
Bog'liq
@de android telegram Pro Android with Kotlin Developing Modern Mobile

CHAPTER 8: APIs
Here are some notes about this method:

Fetches the reply text by using RemoteInput.getResultsFromIntent() 
using the same key as used for the reply input

Fetches the conversation ID we added as an extra value to the intent

Does whatever is appropriate to handle the reply

Issues a reply to the reply by setting another notification
Notification Progress Bar
To add a progress bar to the notification, add the following to the builder with PROGRESS_MAX 
as the maximum integer value and PROGRESS_CURRENT 0 at the beginning:
.setProgress(PROGRESS_MAX, PROGRESS_CURRENT, false)
Or, if you want an indeterminate progress bar, you instead use the following:
.setProgress(0, 0, true)
In a background thread that does the work, you then update a determinate progress bar by 
periodically executing the following with new currentProgress values:
builder.setProgress(PROGRESS_MAX, currentProgress, false)
notificationManager.notify(
NOTIFICATION_ID, builder.build())
To finish a determinate or an indeterminate progress bar, you can write the following:
builder.setContentText("Download complete")
.setProgress(0,0,false)
notificationManager.notify(
NOTIFICATION_ID, builder.build())
Expandable Notifications
Notifications don’t have to contain short messages only; using the expandable features, it is 
possible to show larger amounts of information to the user.
For details on how to do that, please consult the online documentation. Enter, for 
example, android create expandable notification in your favorite search engine to find the 
corresponding pages.
Rectifying Activity Navigation
To improve the user experience, an activity that was started from inside a notification can 
have its expected task behavior added. For example, if you click the back button, the 
activity down in the stack gets called. For this to work, you must define an activity hierarchy 
inside AndroidManifest.xml, for example, as follows:



Download 5.42 Mb.

Do'stlaringiz bilan baham:
1   ...   128   129   130   131   132   133   134   135   ...   223




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling