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
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 .
You can get Code from github DOWNLOAD
I am writing below Main Activity Code to have Access Permisssion
MainActivity.java
import android.Manifestimport android.os.Bundleimport com.stacklearning.mypermissionlibrary.MyPermissionimport com.stacklearning.mypermissionlibrary.onPermisssionResultclass 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 .