Showing posts with label Android M. Show all posts
Showing posts with label Android M. Show all posts

Wednesday, 23 May 2018

Android Runtime Permission with MyPermission Library in Kotlin

Android run time permission with MyPermission Library in Kotlin .
You can get Code from github DOWNLOAD

I am writing below Main Activity Code to have Access Permisssion

MainActivity.java
import android.Manifest
import android.os.Bundle
import com.stacklearning.mypermissionlibrary.MyPermission
import com.stacklearning.mypermissionlibrary.onPermisssionResult
class MainActivity : MyPermission() , onPermisssionResult {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        var permissionList = ArrayList<String>()
        permissionList.add( Manifest.permission.CAMERA)
        permissionList.add( Manifest.permission.WRITE_EXTERNAL_STORAGE)
        setPermission(this,permissionList,this)
    }
    override fun onPermissionGranted() {
        // open camera() and ...
        // ... etc what you want to do as per permission
    }
}


Here, We extend MainActivity from MyPermission() and Implement onPermissionResult
and we have to override onPermissionGranted() method .   to proceed with our code .

we have to pass PermissionList, like if we need camea permission, External Storage Permission and any other . Just pass this list to function   setPermission(this,permissionList,this) .


 If any problem in implementation, Please comment .












Thursday, 22 February 2018

Android Runtime Permissions with Dexter Library (Simple Approach)

App Permission with Dexter Library

Android Runtime Permission With Dexter Library


Implementing Android runtime permissions intoduces in Mashmallow is a hard process and developer needs to write lot of code just to get a single permission.
User has to allow or deny any permission at runtime.

We are going to Use Dexter library to   simplify the process of adding the runtime permissions . 


With Dexter Library , we can have get "Single" runtime permission as well as "Multiple" runtime permission with just a

Monday, 5 September 2016