Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated object in MainActivity #16

Open
hugoseri opened this issue Nov 22, 2019 · 1 comment
Open

Deprecated object in MainActivity #16

hugoseri opened this issue Nov 22, 2019 · 1 comment
Assignees
Labels
invalid This doesn't seem right wontfix This will not be worked on
Milestone

Comments

@hugoseri
Copy link
Collaborator

    private fun checkConnectivity(context: Context) {
        val cm = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager 
        val activeNetwork: NetworkInfo? = cm.activeNetworkInfo
        val isConnected: Boolean = activeNetwork?.isConnectedOrConnecting == true
        //Alert Dialog box
        val alertDialog: AlertDialog? = this.let {
            val builder = AlertDialog.Builder(it)
            builder.apply {
                setPositiveButton(R.string.OK,
                    DialogInterface.OnClickListener { dialog, id ->
                        // User clicked OK button
                    })
            }
            builder.setTitle(R.string.no_internet_connexion)
            builder.setMessage(R.string.offline_message)
            // Create the AlertDialog
            builder.create()
        }
        if (!isConnected) {
            alertDialog?.show()
        }
    }

Line in bold is deprecated according to Android Studio.

@hugoseri hugoseri added the invalid This doesn't seem right label Nov 22, 2019
@hugoseri hugoseri added this to the Front-End milestone Nov 22, 2019
@hugoseri hugoseri self-assigned this Nov 22, 2019
@hugoseri
Copy link
Collaborator Author

The deprecated NetworkInfo object is currently in progress as shows this discussion.
This issue is then pending.

@hugoseri hugoseri added the wontfix This will not be worked on label Nov 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant