/**
For user security and privacy reasons, Palio.io for Android will not run under the following conditions:
1. Rooted Devices
2. Emulators
3. Android version below 6.0 (API 23). Please make sure you have set minSdkVersion 23 in your build.gradle (:app)
For user satisfaction, all features provided in Palio have been tested to meet certain performance, reliability, and availability standards. If you need to test these features (Audio Call, Video Call, Conference, Online Seminar, etc.), please download catchUp from Google Play Store. catchUp is a Social Media built entirely using Palio.io to demonstrate Palio's performance, reliability, and availability standards.
*/
// import Toast
import android.widget.Toast;
// Import Palio.io Libraries
import io.newuniverse.PalioLibrary.Callback;
import io.newuniverse.PalioLibrary.PalioBaseActivity;
// Extend the MainActivity with PalioBaseActivity
public class MainActivity extends PalioBaseActivity {
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_main);
/***********************************************************************************************************
Connect to our server with your Palio.io Account, and implement the required Callback.
Please Subscribe or contact us to get your Palio.io Account.
Do not share your Palio.io Account or ever give it out to someone outside your organization.
************************************************************************************************************/
connect("***REPLACE***WITH***YOUR***PALIO***ACCOUNT***", this, new Callback() {
@Override
public void onSuccess(final String userId) {
/******************************************************************************************************************
The userId parameter in the onSuccess method will provide an identification of the Palio User ID
which is generated automatically and it can be mapped to the User ID on the application level.
For example, Palio User ID (e.g. User001) can be mapped into your Application User ID (e.g. John Doe),
so you don't have to share your Application User ID with Palio.io, but you can still monitor your user activities.
******************************************************************************************************************/
/*** do something ***/
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(getBaseContext(), "Your Palio User ID: " + userId, Toast.LENGTH_LONG).show();
}
});
}
@Override
public void onFailed(final String reasonCode) {
/*** do something ***/
runOnUiThread(new Runnable() {
@Override
public void run() {
if (reasonCode.equals("66")) {
Toast.makeText(getBaseContext(), reasonCode + ": Invalid Palio.io Account!", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getBaseContext(), reasonCode + ": Something went wrong...", Toast.LENGTH_LONG).show();
}
}
});
}
});
}
}
...
// Please add the following lines to your gradle properties
artifactory_username=palio
artifactory_password=AP3jy1BHS6ViFkCXZeAjhqf43zA
// Please make sure you have set minSdkVersion to 23.
// Add the following lines to include the Palio.io repository into your app
repositories {
maven {
url "https://palio.io/artifactory/libs-release-local"
credentials {
username = "***REPLACE***WITH***YOUR***MAVEN***USERNAME***"
password = "***REPLACE***WITH***YOUR***MAVEN***PASSWORD***"
}
}
}
dependencies {
// *** Add Palio Lite dependencies ***
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'net.zetetic:android-database-sqlcipher:3.5.7@aar'
implementation 'io.palio:bolumadu:1.0.39'
implementation('com.github.bumptech.glide:glide:4.6.1@aar') {
transitive = true
}
implementation('com.google.apis:google-api-services-gmail:v1-rev67-1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
}
// ...
allprojects {
repositories {
// ...
// Please add this maven to your allprojects repositories in project level build.gradle
maven {
url "https://palio.io/artifactory/libs-release-local"
credentials {
username = "universe"
password = "AP3jy1BHS6ViFkCXZeAjhqf43zA"
}
}
}
}
/**
You can customize the look and layout of our live streaming, online seminar, and audio-video call features.
To do so, follow these steps:
1. Download the activity layout (.xml) files at this link: activity_layouts.zip
2. Extract the .xml files into your project folder -> app -> src -> main -> res -> layout folder.
3. Edit the activity layouts as you need.
Notice:
Please refrain from deleting view components or altering their id's as it may cause errors to the application.
**/
/**
You can create push notifications for your users via instant messaging by using our API.
It is recommended that you are familiar with REST API (https://restfulapi.net/) and at least one of its tools, such as cURL (https://curl.se/)
or Postman (https://www.postman.com/).
The URL endpoint for our push notifications API is https://palio.io/webrest/.
To start using our push notifications API, please follow these steps:
A. If you are using cURL:
1. Open Command Prompt for Windows or Terminal if you are on a Linux based OS.
2. Enter this command line:
curl -X POST -H "Content-Type: application/json" d '{JSON content}' https://palio.io/webrest/
B. If you are using Postman:
1. Create a new request by clicking New on the Postman window, or create an untitled request by pressing new tab (+) in your current workspace.
2. Select POST method to the left of "Enter request URL" form.
3. Paste the URL endpoint above into "Enter request URL" form.
4. Below "Enter request URL" form, select "Body" and then "raw".
5. Postman will open a text area for you. Paste the code that is explained below into the text area.
6. Click "Send". You will be able to see the response in the "Response" section of Postman.
You can use this command to send messages as push notifications or retrieve them.
A. Sending Messages
Paste the code below to replace {JSON content} in the command line above or into Postman to send messages:
{
"code": "SNDMSG",
"data": {
"from": "user01",
"to": "user02",
"message_text": "this is a test message 12312"
}
}
Replace user01 and user02 with the unique user ID generated by Palio Lite (see MainActivity.java), and the value of "message_text" with your intended message.
If successful, you will receive a response text "Message sent".
B. Retrieving Messages
Paste the code below to replace {JSON content} in the command line above or into Postman to retrieve messages:
{
"code": "GETMSG",
"data": {
"user_id": "user01",
"from_date": 1608012999753,
"limit": 10
}
}
Replace user01 value with the unique user ID generated by Palio Lite (see MainActivity.java), the value of "from_date" with your preferred date and time in long integer millisecond format, and "limit" with
the max amount of messages you want to retrieve.
If successful, you will receive a response as such:
[
{
"message_date": "1609137228393",
"from": "user01",
"id": "0274b37071176a80d8a69",
"to": "user02",
"message": "this is a test message 12312"
},
{
"message_date": "1608276310844",
"from": "user01",
"id": "0274b3707117674bcfb3c",
"to": "user02",
"message": "this is a test message 12312"
},
{
"message_date": "1608275825624",
"from": "user01",
"id": "0274b3707117674b593d8",
"to": "user02",
"message": "this is a test message 5"
},
{
"message_date": "1608275793867",
"from": "user01",
"id": "0274b3707117674b517cb",
"to": "user02",
"message": "this is a test message 3"
},
{
"message_date": "1608275774500",
"from": "user02",
"id": "0274ae40ed17674b4cc24",
"to": "user01",
"message": "this is a test message 2"
}
]
**/