requestPermissions()没有调用onRequestPermissionsResult()

时间:2016-07-14 22:15:39

标签: java android permissions

为什么不会调用onRequestPermissionsResult()?

在活动A中说,我有requestPermission(权限A,权限A代码)。 在活动B中,我有onRequestPermissionsResult,它有一个

SELECT
  COUNT(DISTINCT MO.user_id) * 100 /
   (SELECT COUNT(DISTINCT user_id)
    FROM (
      SELECT
        user_id
        , message_id
        , id
        , (CASE WHEN @user_id != user_id THEN @rank := 1 ELSE @rank := @rank + 1 END) AS rank,
          (CASE WHEN @user_id != user_id THEN @user_id := user_id ELSE @user_id END) AS _
      FROM (SELECT * FROM MessageSent ORDER BY user_id, id) T
      JOIN (SELECT @cnt := 0) c
      JOIN (SELECT @user_id := 0) u
    ) R2
    WHERE rank < 3
   ) AS percentage_who_read_one_of_the_first_messages
FROM MessageOpened MO
JOIN
   (SELECT
      user_id
      , message_id
    FROM (
      SELECT
        user_id
        , message_id
        , id
        , (CASE WHEN @user_id != user_id THEN @rank := 1 ELSE @rank := @rank + 1 END) AS rank,
          (CASE WHEN @user_id != user_id THEN @user_id := user_id ELSE @user_id END) AS _
      FROM (SELECT * FROM MessageSent ORDER BY user_id, id) T
      JOIN (SELECT @cnt := 0) c
      JOIN (SELECT @user_id := 0) u
    ) R
    WHERE rank < 3) MR
  ON MO.user_id = MR.user_id
  AND MO.message_id = MR.message_id
;

这不应该没有任何问题吗?或者我做错了什么。

我通过调试调试日志进行检查,并调用requestPermission()并显示公开UI(要求接受和拒绝权限)但是在按下Accept后没有任何反应,即使它应该恢复我想要做的任何事情。

1 个答案:

答案 0 :(得分:2)

  

这不应该没有任何问题吗?

没有。如果您为活动A调用requestPermissions(),则会在活动A中触发onRequestPermissionsResult(),而不是活动B.