PHP code example of nativephp / mobile-ota

1. Go to this page and download the library: Download nativephp/mobile-ota library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nativephp / mobile-ota example snippets


use Nativephp\MobileOta\Facades\Ota;

$update = Ota::check();

if ($update['available']) {
    Ota::downloadAndApply();
}

Ota::rollback();

Ota::status();         // ['pending' => true, 'hasPrevious' => true, ...]
Ota::currentRelease(); // The release this app is running, or null if it's still on the version it shipped with

use Native\Mobile\Testing\Native;

it('queues an update when the user taps the button', function () {
    Native::fakeBridge()->withOtaUpdate();

    Native::test(Settings::class)
        ->tap('Check for updates')
        ->assertOtaChecked()
        ->assertOtaDownloaded()
        ->assertOtaQueued();
});

it('does nothing when the app is up to date', function () {
    Native::fakeBridge()->withOtaUpToDate();

    Native::test(Settings::class)
        ->tap('Check for updates')
        ->assertOtaChecked()
        ->assertNothingOtaDownloaded();
});