@@ -599,15 +599,27 @@ public void requestPermission(String permission) {
599599
600600
601601 public void requestPermission (String permission , String callback ) {
602- if (!hasPermission (permission )) {
603- Method handleMethod = null ;
604- try {
605- Class <?> callbackClass = this .getClass ();
606- handleMethod = callbackClass .getMethod (callback , new Class [] { boolean .class });
607- } catch (NoSuchMethodException nsme ) {
608- System .err .println (callback + "() could not be found" );
609- }
610- if (handleMethod != null ) {
602+ Method handleMethod = null ;
603+ try {
604+ Class <?> callbackClass = this .getClass ();
605+ handleMethod = callbackClass .getMethod (callback , new Class [] { boolean .class });
606+ } catch (NoSuchMethodException nsme ) {
607+ System .err .println (callback + "() could not be found" );
608+ }
609+ if (handleMethod != null ) {
610+ if (hasPermission (permission )) {
611+ // If the app already has permission, still call the handle method as it
612+ // may be doing some initialization
613+ try {
614+ handleMethod .invoke (this , new Object [] { true });
615+ } catch (IllegalAccessException e ) {
616+ e .printStackTrace ();
617+ } catch (IllegalArgumentException e ) {
618+ e .printStackTrace ();
619+ } catch (InvocationTargetException e ) {
620+ e .printStackTrace ();
621+ }
622+ } else {
611623 permissionMethods .put (permission , handleMethod );
612624 // Accumulating permissions so they requested all at once at the end
613625 // of draw.
0 commit comments