locked
Is it possible to refresh Acr.DeviceInfo after enabling permissions? RRS feed

  • Question

  • User236965 posted

    I am using the deviceinfo pluging by @AllanRitchie to get a unique deviceID using:

    string id = DeviceInfo.Hardware.DeviceId;
    

    If the phone permission isn't granted this returns null. So I request this permission using the permissions plugin:

    var status = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Phone);
    if (status != PermissionStatus.Granted) {
        var results = await CrossPermissions.Current.RequestPermissionsAsync(new[] { Permission.Phone });
        status = results[Permission.Phone];
        if (status == PermissionStatus.Granted) {
            //RESTART APP OR SOMETHING HERE
        }
    }
    

    However, the user is required to close and reopen the app before I can access DeviceInfo.Hardware.DeviceId (it will return null even though the permission is granted). (Only tested on Android). Is it possible to perform some sort of refresh so that this isn't necessary? If not, how do I restart the app programmatically?

    Thanks, Calvin Fong

    Sunday, July 10, 2016 4:16 PM

Answers

  • User187527 posted

    @CalvinFong.7458 It is not currently. Things like this you should file on the github repo, so I can remember to look into them. I'm actually in the middle of working on v4 now.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Sunday, July 10, 2016 5:17 PM