Found 1966 Articles for Apps/Applications

How to play ringtone/alarm/notification sound in Android?

George John
Updated on 03-Jul-2020 08:02:25

3K+ Views

This example demonstrate about How to play ringtone/alarm/notification sound 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.     Step 3 − Add the following code to src/MainActivity.javapackage app.tutorialspoint.com.notifyme; import android.app.NotificationManager; import android.content.Context; import android.media.MediaPlayer; import android.media.RingtoneManager; import android.net.Uri; import android.support.v4.app.NotificationCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import java.util.Objects; public class MainActivity extends AppCompatActivity {    private final static String default_notification_channel_id = "default";    @Override    protected void onCreate (Bundle ... Read More

How do I add Vibrate and sound for Notification in Android?

Chandu yadav
Updated on 03-Jul-2020 08:01:46

1K+ Views

This example demonstrate about How do I add Vibrate and sound for Notification in AndroidStep 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.     Step 3 − Add the following code to src/MainActivity.javapackage app.tutorialspoint.com.notifyme; import android.app.NotificationManager; import android.content.Context; import android.media.RingtoneManager; import android.net.Uri; import android.support.v4.app.NotificationCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import java.util.Objects; public class MainActivity extends AppCompatActivity {    private final static String default_notification_channel_id = "default" ;    @Override    protected ... Read More

How to set android notification icon?

Arjun Thakur
Updated on 03-Jul-2020 08:00:31

1K+ Views

This example demonstrate about How to set android notification iconStep 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.     Step 3 − Add the following code to src/MainActivity.javapackage app.tutorialspoint.com.notifyme; import android.app.NotificationManager; import android.content.Context; import android.support.v4.app.NotificationCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import java.util.Objects; public class MainActivity extends AppCompatActivity {    private final static String default_notification_channel_id = "default";    @Override    protected void onCreate (Bundle savedInstanceState) {       super .onCreate(savedInstanceState); ... Read More

How to lock & unlock the iOS device programmatically

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

490 Views

Locking of iOS device cannot be done programmatically without the use of Private API’s. One such private API’s GSEventLockDevice() (private API) from GraphicsServices.framework which might help you achieve your persona but the application would result in rejection from Apple’s App Store.More over there’s no documentation provided by apple for the same.On a final note you cannot achieve this functionality without using the Private API’s and if you are using your application will be rejected by Apple.

How to Ping External host from Swift in iOS?

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

883 Views

Sometime you may require to ping an external website and check whether it’s up and running before you do any processing or fire request on the same.Here we will be seeing how to check whether the external website is up and running.Let’s being by Creating new projectStep 1 − Open Xcode → New Project → Single View Application → Let’s name it “PingMe”Step 2 − Open ViewController.swift and add the function checkIsConnectedToNetwork() and add the following code.func checkIsConnectedToNetwork() {    let hostUrl: String = "https://google.com"    if let url = URL(string: hostUrl) {       var request = URLRequest(url: ... Read More

How to execute a task repeatedly after fixed time intervals in iOS

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

229 Views

Apple has predefined class Timer, that fires after a certain time interval has elapsed, sending a specified message to a target object.To read more about the Timer class you can check official apple documentation herehttps://developer.apple.com/documentation/foundation/timerTo execute the task repeatedly after fixed interval of time we are going to use timer class. We are going to develop a sample application where the application prints hello Tutorials Point after every 5 seconds.So let’s get started, Step 1  − Open Xcode → New Project → Single View Application → Let’s name it “HelloTutotrialsPoint”Step 2  − Open ViewController.swift and write one method doSomething() below ... Read More

Working with Xcode Auto Layout in Swift and iOS

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

2K+ Views

Auto layout is constraint based layout system used for development of User Interfaces for iOS Devices. This layout based constraint system also known as Auto Layout is basically an adaptive UI which adapts to screens of different sizes and orientations.Auto layout is completely dependent on constraints where developer defines a relation between neighbouring or parent element to seize it position.Why Auto Layout?While designing an iOS application you need to make sure, the UI which you’re developing should be equally compatible with all screen sizes and orientation. Auto layout comes handy when you wish to do so.Consider below images. A centrally ... Read More

Where are the app cookies stored on the iPhone?

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

4K+ Views

Cookies are small files which are stored on a user's device while browsing internet.When we talk about cookies in iPhone we usually talk about application using the Web Views or the browser applications.A normal iOS application does not contains cookies. An app will have cookies only if the application has one or more web views.To check where are the app cookies stored on iPhone, On an iPhone, go to Settings -> Safari -> Advanced -> Website Data and you will see all cookies stored on your device.For iOS Application using web view The UIWebView will automatically store the cookies in the sharedHTTPCookieStorage.Read More

How to lock Screen Orientation programmatically in iOS?

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

2K+ Views

You might come across a scenario where you need to show the UI in a specific orientation may be Landscape or Portrait.We will be seeing how to lock orientation programmatically using Swift in iOS.Open Xcode → New Project → ViewController.swift write the below code.// Set the shouldAutorotate to False override open var shouldAutorotate: Bool {    return false } // Specify the orientation. override open var supportedInterfaceOrientations: UIInterfaceOrientationMask {    return .portrait }

How to check if Location Services are enabled in iOS App?

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

1K+ Views

Location services as the name suggests gather the user information via GPS, Wifi and cell towers. Every iOS device has on board GPS, WiFi, cell tower location data and Bluetooth to determine the location of the iPhone or iPad. The user can enable or disable location services from the Settings app by toggling the Location Services switch in General.You should check the return value of locationServiceEnabled() method before starting location updates to determine whether the user has location services enabled for the current device.To check if Location Services are enabled in iOS app checkout the codeOpen Xcode → New Project ... Read More

Advertisements