You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You don't need any permissions to save files on the internal storage. Your app always has permission to read and write files in its internal storage directory.
To create a new file in one of these directories, you can use the File() constructor, passing the File provided by one of the above methods that specifies your internal storage directory. For example:
how to use alarms to trigger tasks at specific times, whether or not your app is running when the alarms go off.
For example, you can use a repeating alarm to schedule a download every day at the same time.
To create alarms, you use the AlarmManager class. Alarms in Android have the following characteristics:
Alarms let you send an Intent at set times or intervals. You can use alarms with broadcast receivers to start services and perform other operations.
Alarms operate outside your app. You can use them to trigger events or actions even when your app isn't running, and even if the device is asleep.
When used correctly, alarms can help you minimize your app's resource requirements. For example, you can schedule operations without relying on timers or continuously running background services.
In the Settings app on an Android-powered device, users can adjust the notifications they receive. Starting with Android 8.0 (API level 26), you can assign each of your app's notifications to a notification channel. Each notification channel represents a type of notification, and you can group several notifications in each channel.
check the device's SDK version before building the notification channel.
When you create a notification channel in your code, you set behavior for that channel, and the behavior is applied to all of the notifications in the channel. For example, your app might set the notifications in a channel to play a sound, blink a light, or vibrate. Whatever behavior you set for a notification channel, the user can change it, and they can turn off notifications from your app altogether.
Broadcasts are messages that the Android system and Android apps send when events occur that might
affect the functionality of other apps. For example, the Android system sends an event when the system
boots up, when power is connected or disconnected, and when headphones are connected or disconnected.
Your Android app can also broadcast events, for example when new data is downloaded.
In general, broadcasts are messaging components used for communicating across apps when events of
interest occur. There are two types of broadcasts:
Internet connection - hide keyboard - Parsing JSON data
Internet Connection
getting data from the internet using
see the NetworkUtils class to see how to get data from internet.
also we can use the volley library to fetch data.
Hiding the keyboard Programatically
//Hiding the keyboard after the button pressed.InputMethodManagerinputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (inputManager != null) {
Android - Hide keyboard Programatically - Get data from internet class - checking network status
Asynctask
getting data from the internet using
see the NetworkUtils class to see how to get data from internet.
Hiding the keyboard Programatically
//Hiding the keyboard after the button pressed.InputMethodManagerinputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (inputManager != null) {
inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);