• Support
  • Connection issues with Mobile App on Android

Greetings from Zimbabwe. We have been using the MoodleBox for remote area teaching and students have been using the Moodle mobile app on their phones to work "ofline" at home. It has been working great up to now.
Since I upgraded to Moodle 3.11 new users are struggling to get connected via the app. The only thing I can think of is that the Moodle app may be looking for online verification (which cannot happen as MoodleBox is working totally off grid.)
Has anyone else experienced this? Any proposed solutions would help please.

  • Ratna replied to this.
  • Okay, I found a solution!

    See https://docs.moodle.org/311/en/Moodle_app_guide_for_admins#Enable_mobile_services_on_your_site

    For sites using https, mobile access is enabled by default in new installations of Moodle 3.0 onwards.
    For http sites, mobile access can be enabled by an administrator as follows:
    In Site administration > Mobile app > Mobile settings tick the 'Enable web services for mobile devices' checkbox
    Click the button to save changes.
    If your site uses a SSL certificate, it must be a trusted certificate. For security reasons the app doesn't work with self-signed certificates.

    The Moodle app does not work with self-signed certificates. But the Moodle app works with web sites without https. To switch off https I edited the nginx configuration sudo nano /etc/nginx/sites-available/default

    # Default server configuration
    #
    server {
            listen 80 default_server;
            listen [::]:80 default_server;
    
    #       listen 443 ssl;
    #       listen [::]:443 ssl;
    #       ssl_certificate /etc/nginx/ssl/moodlebox.pem;
    #       ssl_certificate_key /etc/nginx/ssl/moodlebox.key;
    
            root /var/www/moodle;

    I set a comment sign # in front of every line with ssl and port 443.
    After a reboot of the MoodleBox I can connect with the Android Moodle app. Great!

    Yes, we will get other problems while modern browsers will show error messages for web sites without https.

    Ian That would be very interesting!

    No, I don't have the environment to test, but this is definitely a question for the Moodle for mobile forum on moodle.org https://moodle.org/mod/forum/view.php?id=7798.

    P.S. Also mention the Moodle App version, I think it has undergone some changes too.

      Hi Ian,
      The Moodle HQ changed the conditions for the Moodle App in the last year.

      Only 50 mobile devices can be connected for mobile notifications. And only two courses can be downloaded for offline usage. https://moodle.com/app/

      I don't know if the Moodle app will work for free with an older MoodleBox image.

      Ralf

      3 months later

      Hello everyone, we are currently working as Consultants to Save the Children to ensure Continuity of Education in LMIC countries. We are now considering MoodleBox for our projects in Papua New Guinea and Cambodia. While testing I came across the same issue as Ian when connecting the Moodle App to a MoodleBox. So I created a tracker Item of the developers of Moodle Mobile App. Please view this issue and UPVOTE it.
      https://tracker.moodle.org/projects/MOBILE/issues/MOBILE-3880?filter=allissues

      In my first test I'm using the MoodleBox 3.13.0-dev1 (64bits) because this is the current version on the microsd card in my Raspberry Pi. Nicolas made this image version for testing the MoodleBox with Debian Bullseye. https://github.com/moodlebox/moodlebox/issues/213#issuecomment-903275347

      My MoodleBox is running the current Moodle 3.11.3+ (20210924). The Moodle App 3.9.5 is installed on an iPhone, an iPad and an old Samsung Tab S2. Yes, I can connect to the MoodleBox without any problem on all three devices. And I'm able to get two courses saved locally in the app. I can get only two courses because my MoodleBox only uses the Moodle App plan "Free". https://moodle.com/app/#plans

      When I try to get downloaded the third course the app shows an error message with a hint to the Moodle App plans.

      I hope that this post answers your questions.

      Best regards, Ralf



      Now I also tested the MoodleBox 3.11.0 and 3.12.0 versions. I added a new user to the list of Moodle users. And I logged in into Moodle with this new user. I also logged in into Moodle with the mobile app. I got no problem.

      Could the problem be that the MoodleBox does not allow more than only a low number of devices?
      https://discuss.moodlebox.net/d/36-low-number-of-wi-fi-concurrent-connected-users

      Nicolas is working hard to get a solution. He added a very old wifi driver to the newer MoodleBox images. And also the Raspberry Pi community knows about the problem with the low number of devices which you can connect to a Raspberry Pi in access point mode.

        ralfkrause Thanks for all the testing! I'm completely held up by another project - and also mobile devices is not my field.

        So the question is whether MoodleBox hits the always sinking number of wi-fi devices limit of newer Raspberry Pi OS or it this a (new) limit set in the free version of Moodle Mobile App or is it something else. I can't see how MoodleBox per se adding its own limitations since the Moodle in MB is just the stock Moodle.

        ralfkrause Thanks for your testing. What I have found is that users of the app can connect to their 2 courses (per free app conditions) only when the moodlebox is connected to the internet. When it is used remotely (offline) it appears that the app does not allow connection - maybe because it cannot verify the site or the number of courses subscribed?
        Not sure why it does not work but it would be good to have an answer and guidance for my remote students.

          Ian What I have found is that users of the app can connect (…) only when the moodlebox is connected to the internet.

          This is interesting. I'd be glad to know more about this Moodle App behaviour.

          Ian
          No. I can't confirm this. My MoodleBox 3.12.0 currently has not cable to the internet. My iPhone uses iOS 14.8 and the mobile Moodle app is 3.9.5.

          My iPhone is in flight mode to have no contact to moodle.org or something else via cellular network. I switched on the wifi and connected to the MoodleBox wifi. The MoodleBox works and offers all content both in the browser and in the mobile app. I can open new courses, I can download files and I write a forum post. There is no problem with the MoodleBox and the mobile app.

            ralfkrause Thanks for the info. Maybe I am on the wrong track... Could it be that I cannot validate my mobile app on apps.moodle.com? My online site app is validated and works well but my various moodlebox sites do not. It seems that chatterbox.home does not validate as a site - for me anyway.

              Next test.
              The iPhone is still in flight mode. I deleted the account of my test user Eva Eilig in the mobile Moodle app. Now I want to add the MoodleBox for Eva Eilig in the Moodle app again. I open the hamburger menu and choose "Change web site". I can enter the url "moodlebox.home" and I get the form to write the username and the password. I tap on "Log in" and everything is okay.

              Please check if the Moodle app is activated for your MoodleBox.
              http://moodlebox.home/admin/settings.php?section=mobilesettings

              Ian
              You can't validate the MoodleBox because the MoodleBox has a private ip address. And also the MoodleBox can't be connected from the internet. But you only need to registrate your web site on messages.moodle.net if your web site should send push notification. While the MoodleBox uses private ip address it can't send any push notification.

              You don't need to validate you Moodle app. The subscription plan is only used to send push notifications to more than 50 devices. And it's used to save more than two courses locally in the app. And because you can't register, validate and subscribe your MoodleBox for the Moodle app therefore you get no push notifications and you only can save two courses.

                ralfkrause Again, thanks. Thanks for clarification about registering the app/validating the site.
                I checked the settings which were enabled and I have tried on two different android devices and can connect to my moodlebox when the moodlebox is not plugged into the internet via ethernet - ie running local wifi only. The only problem was that it took a long time to recognise the site and connect on both devices (2 minutes on one and 3 on the other).
                Really not sure why I have been having problems at remote sites - I will try to get students connected onto the app when I am next out at a site. Will let you know.

                a month later

                Two weeks ago I had a workshop with teachers for using the MoodleBox.

                In my workshop concept I started with the MoodleBox and no internet connection. Yes, they also should try to connect with the Moodle app. No problem to connect and to view the cozrses.

                After this first test with 15 really different devices I connected the MoodleBox to the internet and all devices could use the connection.

                4 months later

                A friend of mine asked me if the current Moodle app 3.9.5 will work together with the current MoodleBox 4.1.0.

                For my tests I took my iPad Air 4. The iPad has no SIM card so there is no other way to the internet when it's connected with the MoodleBox. I deleted the Moodle app so all app settings are deleted, too. I restarted the iPad. I connected to the internet and installed the Moodle app again but I did not start the app.

                I copied a fresh microSD card with the MoodleBox 4.1.0 image. Then I started this fresh MoodleBox an a Raspberry Pi 4B (4GB) which no ethernet connection. After a moment I could connect the iPad to the MoodleBox wifi. My system setting told me that there is no internet connection with the MoodleBox wifi.

                In the next step I opened the url moodlebox.home in a web browser, got the start page, and logged in with the default moodlebox user. I added a new course with a forum and a folder. I uploaded some files into the folder. And I wrote a message with a photo into the forum. And I opened the MoodleBox dashboard to see the MoodleBox version and the connected devices. There was an iPad and no ethernet connection. The time setting was January 5th, 2022 ... the time when Nicolas produced the image.

                Now I started the Moodle app ... no connection to the internet! I could connect to moodlebox.home and I could log in with the moodlebox user. I could see the start page and I could open the test course. I wrote a message into the forum and I loaded the files from the folder. I tested to download the compete course for offline learning. No problem!

                In a next step I should test the same things in the Moodle app with an Android device. Perhaps there is a problem with Android and some coding in the app. I don't know if any library wants to connect to the internet before the app can be started.

                And now my frustrating results with Android

                For my Android tablet I tried to do the same experiments as I did with the iPad. I deleted the Moodle app and restarted the tablet. Then I installed the Moodle app 3.9.5 from the Google Play Store again.

                Now I switched to the MoodleBox wifi. The system tool told me that this wifi has no internet connection. The tablet got an ip address, the network mask and the router address. I started the web browser and opened the url moodlebox.home ... no problem. And I could also reach the start page with 10.0.0.1. I logged in and got all the things from the test course. In the MoodleBox dashboard I could see the correct ip addresses of the connected tablets ... the iPad and the Android tablet.

                In the next step I started the Moodle app on the Android tablet. I got the url input but the app could not reach the url. I tried moodlebox, moodlebox/, moodlebox.home, moodlebox.home/, http://moodlebox.home, http://moodlebox.home/, 10.0.0.1, 10.0.0.1/. No connection in the Android Moodle app!

                After a timeout of about 5 minutes I got the error message:"Cannot connect. We're having trouble connecting to your site. Please check the address is correct. 10.0.0.1/". The ip address is correct but there is no connection in the app.

                No, I also got no connection with the ethernet cable connected to the router. It is frustrating! Could it be that the Android Moodle app does not work with Moodle sites which can be opened without https? Or is there a problem with the certificate?

                I tested to connect some other Moodle sites with the Android Moodle app and I got no problem. But I could not connect to the MoodleBox.

                Is this a hint to the problem? https://tracker.moodle.org/browse/MOBILE-3859

                Okay, I found a solution!

                See https://docs.moodle.org/311/en/Moodle_app_guide_for_admins#Enable_mobile_services_on_your_site

                For sites using https, mobile access is enabled by default in new installations of Moodle 3.0 onwards.
                For http sites, mobile access can be enabled by an administrator as follows:
                In Site administration > Mobile app > Mobile settings tick the 'Enable web services for mobile devices' checkbox
                Click the button to save changes.
                If your site uses a SSL certificate, it must be a trusted certificate. For security reasons the app doesn't work with self-signed certificates.

                The Moodle app does not work with self-signed certificates. But the Moodle app works with web sites without https. To switch off https I edited the nginx configuration sudo nano /etc/nginx/sites-available/default

                # Default server configuration
                #
                server {
                        listen 80 default_server;
                        listen [::]:80 default_server;
                
                #       listen 443 ssl;
                #       listen [::]:443 ssl;
                #       ssl_certificate /etc/nginx/ssl/moodlebox.pem;
                #       ssl_certificate_key /etc/nginx/ssl/moodlebox.key;
                
                        root /var/www/moodle;

                I set a comment sign # in front of every line with ssl and port 443.
                After a reboot of the MoodleBox I can connect with the Android Moodle app. Great!

                Yes, we will get other problems while modern browsers will show error messages for web sites without https.

                  And now I found the next thing.

                  If the MoodleBox https is switched off, any mobile device can connect, whether it is an iPhone, iPad or Android device. And once the mobile devices are connected to the MoodleBox, they seem to stay connected permanently even if https is switched back on.

                  In another test, I reactivated https in my MoodleBox. All of my mobile devices were still able to access the MoodleBox with the Moodle App and use the digital courses. There were no issues syncing data between the MoodleBox and the Moodle App.

                  Only when I delete my MoodleBox data in the Moodle app the connection gets lost and I can't log in again with Android because of the https problem. In this case I must temporarily switch off https on the MoodleBox to reconnect.

                  Since I assume that there are a lot of Moodle servers with self-signed certificates in the world, there should be a switch in the Moodle app to trust a self-signed certificate. The user of the digital device knows his teacher and his MoodleBox. He can trust both. The MoodleBox is not a server somewhere in the world offering its data.

                  Ralf