Upload Images to OwnCloud and NextCloud in Phimpme Android

As increasing the stack of account manager in Phimpme Android. We have now two new items OwnCloud and NextCloud to add. Both are open source storage services. Provides complete source code of their official apps and libraries on Github. You can check below OwnCloud: https://github.com/owncloud NextCloud: https://github.com/nextcloud This requires a hosting server, where you can deploy it and access it through their web app and Mobile apps. I added a feature in Phimpme to upload images directly to the server right from the app using their android-library. Steps (How I did in Phimpme) Add library in Application gradle file Firstly, to work with, we need to add the android-library they provide. compile "com.github.nextcloud:android-library:$rootProject.nextCloudVersion" Check the new version from here and apply over it: https://github.com/nextcloud/android-library/releases Login from Account Manager As per our Phimpme app flow, User first connect itself from the account manager and then share image from app using these credentials. Added a new Login activity for OwnCloud and NextCloud both.            Saved credentials in Database To use that further in android-library, I store the credentials in Realm database. account.setServerUrl(data.getStringExtra(getString(R.string.server_url))); account.setUsername(data.getStringExtra(getString(R.string.auth_username))); account.setPassword(data.getStringExtra(getString(R.string.auth_password))); Uploading image using library As per the official guide of OwnCloud, used Created an object of OwnCloudClient. Set the username and password. private OwnCloudClient mClient; mClient = OwnCloudClientFactory.createOwnCloudClient(serverUri, this, true); mClient.setCredentials( OwnCloudCredentialsFactory.newBasicCredentials( username, password ) ); Passed the image path which we are getting in the SharingActivity. Modified with adding the separator. File fileToUpload = new File(saveFilePath); String remotePath = FileUtils.PATH_SEPARATOR + fileToUpload.getName(); Used the UploadRemoteOperation Class and just need to pass the path, mimeType and timeStamp. The library have already defined functions to execute the upload operations. UploadRemoteFileOperation uploadOperation = new UploadRemoteFileOperation(fileToUpload.getAbsolutePath(), remotePath, mimeType, timeStamp); uploadOperation.execute(mClient, this, mHandler); Setup Account using Docker and Digital Ocean I have already a previous blog post on how to setup NextCloud or OwnCloud account on server using Digital Ocean and Docker. Link: .//how-to-use-digital-ocean-and-docker-to-setup-test-cms-for-phimpme/ Resource: NextCloud Developer Mannual: https://docs.nextcloud.com/server/9/developer_manual/index.html OwnCloud Library installation: https://doc.owncloud.org/server/9.0/developer_manual/android_library/library_installation.html Examples: https://doc.owncloud.org/server/9.0/developer_manual/android_library/examples.html

Continue ReadingUpload Images to OwnCloud and NextCloud in Phimpme Android

How to use Digital Ocean and Docker to setup Test CMS for Phimpme

One of the core feature of Phimpme app is sharing images to other different accounts, including various open source CMS such as Wordpress, Drupal etc and other open source data storage account such as OwnCloud, NextCloud etc. One can not have everything at place, but for development and testing purpose it is required in our end. So problem I was facing to get things done in most optimize way. I thought setting things on hosted server would be good, because it saves lots of time in setting locally in our system, adding all the dependencies. And also we cannot share the account as it is limited to our local environment. Digital Ocean caught my attention in providing hosting service. It is very easy to use with their droplet creation. Select as per your system requirement and service requirement, the droplet will be ready in few moments and we can use it anywhere. Note: DigitalOcean is a paid service. Student can use Github Education Pack for free credits on Digital Ocean. I used the same. I currently worked on Nextcloud integration so here in this blog I will tell how to quickly create nextcloud server using Digital Ocean and Docker. Step 1: Creating Droplet DigitalOcean completely work on droplets and one can anytime create and destroy different droplets associated with their account. Choose an Image So there are three options of choosing the image of Droplet. Distributions : Which is other operating systems you want to use One Click app: It is a very good feature as it creates everything for use in just one click. But again, it doesn’t provide everything, like there is no NextCloud. That’s why I used docker to take its image. Snapshots: This is if you saved your droplet already, so it will pick it and creates similar to the saved image. Here I selected Docker from one-click apps section. Selecting the size This is for selecting the size of the server we are creating, For small development purpose $5 plan is good. There is a good thing in DigitalOcean as it didn’t charge on the monthly basis to the use. It works on hourly basis and charge according to that. Also providing the SSD Disk for fast IO operations. Choose a datacenter Region Add SSH This is very important to add a ssh key. Otherwise you have to setup root password or used the shell they provide. To work on your computer terminal, its good that you setup an ssh key already and it to the account. How to get ssh key in your system: https://help.github.com/ Rename the number of droplet and name of the droplet and create. Now it will show there in your droplet section Step 2: Access the Server As we have already added the ssh key to our droplet. Now we can access it from our terminal. Open the terminal and type this ➜  ~ ssh root@<your IP> It will logged in to you root@docker-512mb-blr1-01:~# Our objective is setting a NextCloud Account.…

Continue ReadingHow to use Digital Ocean and Docker to setup Test CMS for Phimpme