Show
Testing requires an Android or iOs phone with the Moodle Mobile app installed.
It also requires to have the testing Moodle installation under a local domain accesible by the mobile device.
Configure and enable the "Mobile notifications" message output, you can find and access key in the comments bellow (comment restricted)
Once configured (you only need to add the access key), remember to enable the plugin.
Access with the Mobile app to your Moodle site using a student account
Log in with the same student account in the Moodle site (using the browser), go to your messaging preferences and enable receive Mobile notifications for internal messages. Check that your mobile device is listed at the bottom of the page
Now, since there is not a public instance of Airnotifier v2 for testing, we need to test that Moodle is sending the Push message data correctoy, so I've created a PHP file that "emulates" Airnotifier push handler you need to:
Create a new folder in your web server document root called "notification"
Copy there this index.php file: https://gist.github.com/jleyva/ef5a30f93b0fffa17e12/download
Grant 777 permissions or web server user write permissions to that directory (a new log.txt file will be created)
As and admin user, log in in Moodle, edit the "Mobile notifications" plugin and change the host and port to point to your local server, i.e: http://localhost and 80 (Notice, that you should point to your www root not to the notification directory) Notice also that the URL shouldn't have a slash at the end
As and admin user send an internal message to the student account
Go to the "notification" directory, you should see a log.txt file, open that file
Confirm that:
In the log.txt file you see the message: JSON data correctly received and parsed and a PHP array like (with your custom message)
stdClass::__set_state(array(
'device' => 'Android',
'token' => 'APA91bGp6PnO-Pzgw2E9cUXQuJ-U09MVKguLWdMcEaT4AdcitimY4Td3vUwP2ZAroVJaBUKpqY2Ngp3Q1hnTQ7UiRE9Yz-N2GZtlmQknKT1I4Ao78E3EJOX0CSPWKa6nL1FAfky97Je7z6pWHuLmWljJqY_SdrxJlsIurZSNokxYfpeMW7MGrao',
'extra' =>
stdClass::__set_state(array(
'component' => 'moodle',
'name' => 'instantmessage',
'subject' => 'New message from Admin User',
'fullmessage' => 'ho hoy there
---------------------------------------------------------------------
This is a copy of a message sent to you at "Moodle Bugs". Go to http://localhost/moodlebugs/message/index.php?user=4&id=2 to reply.',
'fullmessagehtml' => '',
'fullmessageformat' => '0',
'smallmessage' => 'ho hoy there',
'timecreated' => 1410781172,
'notification' => '0',
'savedmessageid' => 94,
'userfromid' => '2',
'userfromfullname' => 'Admin User',
'usertoid' => '4',
'processor' => 'moodle',
'site' => '11bf3b646c9106f51fd67ae97139d458',
'date' => 1410781172,
)),
))