17/05/2021
Advertisements

Make Sketchware Project FTP Client For Upload Big Size File

Dalam postingan ini akan menjelaskan beberapa langkah tambahan untuk implementasi proyek FTP Client di Sketchware. Selain itu dalam postingan ini anda bisa mengunduh contoh proyeknya yang sudah saya buat.

In this post, we will explain some additional steps for implementing an FTP client project in Sketchware. In addition, in this post, you can download a sample project that I have created.

Untuk membuat proyek ini kalian harus menambahkan beberapa kode di file SketchApplication.java yang ada di proyek kalian. Untuk menambahkannya kalian bisa menggunakan menu DIRECT CODE EDITOR yang ada di Sketchware Pro. Dibawah ini adalah code yang perlu kalian tambahkan dan dimana harus menambahkannya, dan jika kalian bingung bisa cek video saya di channel YouTube saya.

To create this project you have to add some code in the SketchApplication.java file in your project. To add it, you can use the DIRECT CODE EDITOR menu in Sketchware Pro. Below is the code that you need to add and where to add it, and if you are confused, check my video on my YouTube channel.

//custom add for initialize ftp server
if (BuildConfig.DEBUG) {
    enableStrictMode();
}
createNotificationChannel();
UploadServiceConfig.initialize(this, SketchApplication.CHANNEL, BuildConfig.DEBUG);
UploadServiceConfig.setRetryPolicy(new RetryPolicyConfig(1, 10, 2, 3));
UploadServiceConfig.setPlaceholdersProcessor(new CustomPlaceholdersProcessor());
new GlobalRequestObserver(this, new GlobalRequestObserverDelegate());

//custom add for initialize ftp server
private void createNotificationChannel() {
    if (Build.VERSION.SDK_INT >= 26) {
        NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        NotificationChannel channel = new NotificationChannel(CHANNEL, "Upload Service Demo", NotificationManager.IMPORTANCE_LOW);
        notificationManager.createNotificationChannel(channel);
    }
}
private void enableStrictMode() {
    StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                               .detectAll()
                               .penaltyLog()
                               .penaltyDialog().build());
    StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll()
                           .penaltyLog().build());
}

Setelah kita selesai mengatur SketchApplication.java, selanjutnya kita tambahkan beberapa file JAVA seperti gambar di bawah ini.

Advertisements

After we finish setting up SketchApplication.java, then we add some JAVA files like the image below.

Untuk file BuildConfig.java kalian harus edit nama paket dengan milik kalian sendiri seperti penjelasan gambar di bawa ini.

For the BuildConfig.java file, you have to edit the package name with your own as explained in the image below.

Seluruh file penunjang proyek saya sertakan di sini, kalian bisa mengunduhnya secara gratis. Jika kalian merasa terbantu dengan apa yang saya buat dan berikan jangan sungkan untuk memberikan dukungan dengan subscribe Channel YouTube saya.

I include all the project support files here, you can download them for free. If you feel helped by what I have made and give, don’t hesitate to provide support by subscribing to my YouTube Channel.

%d blogger menyukai ini: