Dear Sir,

When I call cn1 function 
"com.codename1.impl.android.AndroidNativeUtil.checkForPermission" for 
granting permission on android 6.0 in event "Post Show" from another page, 
the form will be flicked backward on allowing one permission.

For example

Form "First" there is button to form "Second"

@Override
protected void onFirst_ButtonAction(Component c, ActionEvent event) {

    Form gui = showForm("Second", null);
    gui.getMenuBar().removeAll();
}

In Second form
@Override
protected void postSecond(Form f) {
    MobileNative mobileNative = (MobileNative) 
NativeLookup.create(MobileNative.class);
        mobileNative.checkPermissions();

}

When I call the function to allow permissions, it flick from "Second" to 
"First" for each permission clicking allow
It is native function
public class MobileNativeImpl {

    public boolean checkPermissions() {

        
if(!com.codename1.impl.android.AndroidNativeUtil.checkForPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE,
 "WRITE_EXTERNAL_STORAGE")){
            // you didn't get the permission, you might want to return here
            return false;
        }
        // you have the permission, do what you need

        
if(!com.codename1.impl.android.AndroidNativeUtil.checkForPermission(Manifest.permission.SEND_SMS,
 "SEND_SMS")){
            return false;
        }

        
if(!com.codename1.impl.android.AndroidNativeUtil.checkForPermission(Manifest.permission.WRITE_CONTACTS,
 "WRITE_CONTACTS")){
            return false;
        }

        
if(!com.codename1.impl.android.AndroidNativeUtil.checkForPermission(Manifest.permission.READ_CONTACTS,
 "READ_CONTACTS")){
            return false;
        }

        return true;
    }

}


Please advice how to solve the problem, it may cause me not going to 
"Second" form in some circumstance.

Thanks and Regards,
Ronald

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/67872ee1-ffad-4554-8cbb-fcf2af74f890%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to