Skip to content

Instantly share code, notes, and snippets.

Célio Vasconcelos celiovasconcelos

Block or report user

Report or block celiovasconcelos

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View exception-notification.java
//When sending exception manually, PushLink doesn't print it in logcat. You have to print it by yourself.
try {
...
} catch (Throwable t) {
Log.e("MyApp", "Some", t);
PushLink.sendAsyncException(t);
//or
Map<String, String> moreInfo = ...
PushLink.sendAsyncException(t, moreInfo);
}
View manual-ckecking.java
/**
* This method checks if there is a downloaded but not applied update. It
* also notify the user again. It is useful for "Check for updates"
* button.
*
* @return true if there is a pending update
*/
PushLink.hasPendingUpdate();
View globalinfo.java
//This information will be shown in two places: "Installations" and "Exceptions" tabs of the web administration
PushLink.addMetadata("Ip", getIp());
PushLink.addMetadata("Phone Number", getPhoneNumber());
PushLink.addMetadata("Brand", Build.BRAND);
PushLink.addMetadata("Model", Build.MODEL);
PushLink.addMetadata("OS Version", Build.VERSION.RELEASE);
PushLink.addMetadata("Logged in user", getUserName());
...
//This information will be shown ONLY in the "Exceptions" tab of the web administration
View pushlink-advanced.java
View popups.java
//Only for popups (FRIENDLY_POPUP or ANNOYING_POPUP)
//You MUST do this, otherwise popups will not work.
//Call it in the Activity you want to show the popup.
//You can show the popup in many screens by adding this in more than one Activity.
@Override
protected void onResume() {
super.onResume();
PushLink.setCurrentActivity(this);
}
View internet-permission.java
<uses-permission android:name="android.permission.INTERNET" />
@celiovasconcelos
celiovasconcelos / cordova.js
Last active Jun 11, 2018
pushlink-cordova
View cordova.js
//this new start API was introduced in pushlink-cordova-6.0.1
var successCallback = function success() { console.log('PushLink started successfully'); };
var errorCallback = function error() { console.log('An error occurred.'); };
PushLink.start({
apiKey: 'api-key',
deviceId: 'device-id',
successCallback: successCallback,
errorCallback: errorCallback
View android-7.xml
<provider android:name="com.pushlink.android.FileProvider" android:authorities="your.package.name" android:exported="true" />
View custom-sample.java
registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Uri apkUri = (Uri) intent.getExtras().get("uri");
//enjoy the apk uri
//notice this will be called every 30s (more or less). You need to handle this.
}
}, new IntentFilter(getPackageName() + ".pushlink.APPLY"));
View gradle.groovy
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
dependencies {
implementation 'com.pushlink:pushlink-android:5.5.3'
}
You can’t perform that action at this time.