Reputation: 4458
I am developing an app for Samsung Watch 6 (WearOS), based on the Sample Excercise app.
I installed it first time, it asked for all the permissions. Then I uninstalled it and installed it again and it did not ask for any permissions. I even restarted the watch, and then installed, it still does not ask for permissions.
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
// Bind to our service. Views will only update once we are connected to it.
ExerciseService.bindService(requireContext().applicationContext, serviceConnection)
bindViewsToService()
binding.startButton.setOnClickListener {
checkNotNull(serviceConnection.exerciseService) {
"Failed to achieve ExerciseService instance"
}.startExercise()
findNavController().navigate(R.id.exerciseFragment)
}
// Check permissions first.
Log.d(TAG, "Checking permissions")
permissionLauncher.launch(REQUIRED_PERMISSIONS)
}
What is going on ? If I go to settings > Apps > myApp > Permission, I see no permissions allowed. When I allow all, and start the app, it still says Missing Permission
.
Upvotes: 0
Views: 48
Reputation: 4458
I placed a beakpoint at permissionLauncher.launch(REQUIRED_PERMISSIONS)
and then let it run, I saw that the app then asked for permissions. So I added a delay to it like this
Handler(Looper.getMainLooper()).postDelayed(1000) {
permissionLauncher.launch(REQUIRED_PERMISSIONS)
}
and the app was now asking for permissions fine.
Upvotes: 0