Found 1631 Articles for Android

How to get current time from Network provider in android?

Smita Kapse
Updated on 30-Jul-2019 22:30:25

835 Views

This example demonstrate about How to get current time from Network provider in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken a text view to show time.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.Manifest; import android.content.pm.PackageManager; import android.location.Address; import android.location.Geocoder; import android.location.Location; import android.location.LocationManager; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; import java.io.IOException; ... Read More

What is Android background music service?

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

1K+ Views

What is Android background music service?Before getting into an example, we should know what service is in android. Service is going to do background operation without interacting with UI and it works even after activity destroy.This example demonstrates what is Android background music service.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. In the above code, we have taken text view, when user click on text view, it will start ... Read More

How to implementing start Foreground for a service?

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

1K+ Views

Before getting into example, we should know what service is in android. Service is going to do back ground operation without interact with UI and it works even after activity destroyThis example demonstrate about How to implementing start Foreground for a service.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. In the above code, we have taken text view, when user click on text view, it will start startForeground().Step 3 ... Read More

How to implementing START_STICKY for a service?

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

1K+ Views

Before getting into an example, we should know what service is in android. Service is going to do back ground operation without interacting with UI and it works even after activity destroy.START_STICKY -  If service is started with START_STICKY return type, it going to work in back ground even if activity is not foreground if android forcefully closed service due to memory problem or some other cases, it will restart service without interaction of the user.This example demonstrates How to implementing START_STICKY for a service.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and ... Read More

How to Create Background Service in Android?

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

7K+ Views

Before getting into example, we should know what service is in android. Service is going to do back ground operation without interact with UI and it works even after activity destroy.This example demonstrate about how to Create Background Service in Android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken text view, when user click on text view, it will start service and stop service.Step 3 ... Read More

How to check if a service is running on Android?

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

5K+ Views

Before getting into example, we should know what service is in android. Service is going to do back ground operation without interact with UI and it works even after activity destroy.This example demonstrate about How to check if a service is running on Android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken text view, when user click on text view, it will start service and ... Read More

How to get current postal code from Network provider in android?

Nishtha Thakur
Updated on 30-Jul-2019 22:30:25

563 Views

This example demonstrates about How to get the current postal code from Network provider in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken a text view to show postal code information.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.Manifest; import android.content.pm.PackageManager; import android.location.Address; import android.location.Geocoder; import android.location.Location; import android.location.LocationManager; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import ... Read More

How to get current location provider information in android?

Anvi Jain
Updated on 30-Jul-2019 22:30:25

424 Views

This example demonstrate about How to get current location provider information in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken a text view to show the current network location provider.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.Manifest; import android.content.pm.PackageManager; import android.location.Address; import android.location.Geocoder; import android.location.Location; import android.location.LocationManager; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; ... Read More

How to get current country name from Network provider in android?

Smita Kapse
Updated on 30-Jul-2019 22:30:25

126 Views

This example demonstrate about How to get current country name from Network provider in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken a text view to show the current country name.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.Manifest; import android.content.pm.PackageManager; import android.location.Address; import android.location.Geocoder; import android.location.Location; import android.location.LocationManager; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import ... Read More

How can I create an android service that dalvik will not kill?

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

301 Views

Before getting into example, we should know what service is in android. Service is going to do back ground operation without interact with UI and it works even after activity destroy.This example demonstrate about How can I create an android service that dalvik will not kill.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken text view, when user click on text view, it will start ... Read More

Advertisements