简体   繁体   English

手动更改权限后如何在android棉花糖中重新启动应用

[英]How to Restart the app in android marshmallow when permission changed manually

I have an android application which was supporting till lollipop. 我有一个支持棒棒糖的Android应用程序。 Now I'm migrating it to support Marshmallow. 现在,我正在迁移它以支持棉花糖。

I am stuck in a case where if we manually changed the app permission in marshmallow it kills all the process. 我陷入了一种情况,如果我们在棉花糖中手动更改应用程序权限,它将杀死所有进程。

I get it as explained by @CommonsWare in similar question here . 我明白了在类似的问题由@CommonsWare作为解释在这里

But in my case I have to kill the app and need to restart the app. 但就我而言,我必须终止该应用程序并需要重新启动该应用程序。 Because my app each activity is dependent on previous activity some data is shared. 因为我的应用程序的每个活动都依赖于先前的活动,所以某些数据是共享的。 I just need to know when we manually change the permission is there a way our app get noticed.? 我只需要知道当我们手动更改权限时,是否有一种方法可以引起我们的应用程序的注意。

I meant any callback occurs. 我的意思是发生任何回调。 if Not is there anyway I can handle this case.? 如果不是,我可以处理此案。 Please Let me know if the question is too broad I'll update my question 请让我知道问题是否太广泛了,我将更新我的问题

Thanks in advance 提前致谢

I just need to know when we manually change the permission is there a way our app get noticed.? 我只需要知道当我们手动更改权限时,是否有一种方法可以引起我们的应用程序的注意。

Your process is terminated. 您的过程已终止。 This is indistinguishable from any other reason why your process might be terminated. 这与您的进程可能终止的任何其他原因都没有区别。

I meant any callback occurs. 我的意思是发生任何回调。

No. You get ordinary lifecycle callbacks (eg, onPause() , onStop() ) as the user navigates over to Settings to be able to revoke the permission, but that's it. 不会。当用户导航到Settings可以撤消权限时,您会收到普通的生命周期回调(例如onPause()onStop() ),仅此而已。 There is no specific callback related to losing the permission. 没有与丢失许可相关的特定回调。

Also note that the user could leave your app, your process could be terminated for other reasons, the user could then go into Settings and revoke your permission, then the user could return to your app. 还要注意,用户可以离开您的应用程序,由于其他原因您的进程可能会终止, 然后用户可以进入“设置”并撤消您的许可,然后用户可以返回到您的应用程序。 If all of that happens within ~30 minutes, Android will still try to rebuild the outstanding task. 如果所有这些操作都在约30分钟内发生,Android仍将尝试重建未完成的任务。 You certainly would not get a callback of any sort in this case, as your process was not running before the permission was revoked, let alone after. 在这种情况下,您肯定不会得到任何类型的回调,因为您的进程在撤销权限之前没有运行,更不用说之后了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 棉花糖应用程序权限:android.location.PROVIDERS_CHANGED未触发 - Marshmallow app-permission: android.location.PROVIDERS_CHANGED is not fired 当用户处于二次活动状态并更改了Android中的语言时,如何重新启动应用程序 - How to restart the app when user is in secound actvity and changed language in android 如何在运行时在Android Marshmallow中获取CLEAR_APP_CACHE权限? - How to take CLEAR_APP_CACHE permission in Android Marshmallow at runtime? Android marshmallow中“身份”的App权限在哪里 - Where is the App permission for “identity” in android marshmallow 拒绝Android棉花糖崩溃应用程序中的运行时权限 - Denying Runtime Permission in Android Marshmallow Crashes App 何时在运行时为 Android Marshmallow 6.0 请求权限? - When to request permission at runtime for Android Marshmallow 6.0? 在 Android 应用程序中重新启动后尝试打开文件夹时出现权限错误 - Permission error when trying to open folder after restart in Android app 在Android Marshmallow上包含预先填充的sqlite数据库与应用程序时的权限问题 - Permission trouble when including pre-populated sqlite database with app on Android Marshmallow Android棉花糖权限 - android marshmallow permission 棉花糖中的Android GPS许可 - Android GPS Permission in Marshmallow
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM