Skip to content

Instantly share code, notes, and snippets.

View mahdi-malv's full-sized avatar

Mahdi Malvandi mahdi-malv

  • Framna (Formerly Shape)
  • Copenhagen, Denmark
  • 23:51 (UTC +02:00)
View GitHub Profile
@mahdi-malv
mahdi-malv / pushe_preferred_service.xml
Created November 10, 2020 14:21
Config for setting prior service (hms or fcm)
<meta-data android:name="pushe_preferred_service"
android:value="hms" />
@mahdi-malv
mahdi-malv / PusheHmsChecking.kt
Created November 10, 2020 14:23
Pushe checks for HMS
val isHmsAvailable = HuaweiApiAvailability.getInstance()
.isHuaweiMobileServicesAvailable(context) == ConnectionResult.SUCCESS
@mahdi-malv
mahdi-malv / PusheChecksFcm.kt
Created November 10, 2020 14:24
Pushe checking for Fcm
val isFirebaseAvailable = GoogleApiAvailability.getInstance()
.isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS
@mahdi-malv
mahdi-malv / add_ronash.xml
Created November 11, 2020 17:35
Add ronash to unity jar resolver XML
<dependencies>
<androidPackages>
<androidPackage spec="co.ronash.android:pushe-base:1.6.3">
<repositories>
<repository>https://maven.google.com</repository>
</repositories>
</androidPackage>
</androidPackages>
</dependencies>
This file has been truncated, but you can view the full file.
--------- beginning of system
12-08 15:08:25.093 2105 2105 D Telephony-AccountEntry: isEmergencyPreferredAccount: subId=-1, activeData=-1
12-08 15:08:25.093 2105 2105 D Telephony-AccountEntry: isEmergencyPreferredAccount: Device does not require preference.
12-08 15:08:25.093 2105 3153 D Mapcon : TelephonyAdapter: [getWfcMode]slotId=1, isRoaming=false, mode=WIFI_PREFER
12-08 15:08:25.093 2105 3153 D Mapcon : VoiceManager-5-ImsDomainConfig: [start]start,modemDomain=WIFI_PREFER
12-08 15:08:25.093 2105 3153 D Mapcon : TelephonyAdapter: [setImsDomainConfig]phoneId=1, domain=WIFI_PREFER
12-08 15:08:25.094 2105 2105 D Telephony-AccountEntry: isEmergencyPreferredAccount: subId=-1, activeData=-1
12-08 15:08:25.094 2105 2105 D Telephony-AccountEntry: isEmergencyPreferredAccount: Device does not require preference.
12-08 15:08:25.094 2105 2105 D Telephony-AccountEntry: isEmergencyPreferredAccount: subId=-1, activeData=-1
12-08 15:08:25.094 2105 2105 D Telephony-AccountEntry: isEmergencyPreferredAcc
@mahdi-malv
mahdi-malv / pushe_modules_size.csv
Last active December 14, 2020 06:04
Pushe modules
Module name Size(KB) Description
base 15 Integrates other module that are common
base-mini 1B Same as base but imports custom minifed java
core 700 Responsible to provide core functionality of the SDK
analytics 255 Analytics functions providing Segmentation feature
notification 476 Adds notification related features
datalytics 260 Responsible for collecting analytical data for console charts
inappmessaging 280 InAppMessaging feature
fcm 72 FCM service. Adds support for sending and receiving messages using Firebase cloud messaging (Google play devices)
hms 56 HMS service. Adds support for sending and receiving messages using Huawei PushKit (Hms core devices)

Sign application with signKey (Best way)

  • signed with parameters via command line, use them
  • If not signed with parameters, use the key.properties

Prerequisites

  • Add the following snippet to app:build.gradle -> android { }
android {
@mahdi-malv
mahdi-malv / remove-build.sh
Created July 8, 2021 12:27
Remove build directories of IntelliJ projects with python3
python3 -c """
import shutil
import glob
for i in glob.glob('**/build/',recursive=True):
print(f'Deleting {i}')
try:
shutil.rmtree(i)
except OSError:
print(f'Failed to remove {i}')
static boolean isApplicationForeground(Context context) {
KeyguardManager keyguardManager =
(KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
if (keyguardManager != null && keyguardManager.isKeyguardLocked()) {
return false;
}
ActivityManager activityManager =
(ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
@mahdi-malv
mahdi-malv / configure_dns.sh
Created July 11, 2022 21:03 — forked from smhdhsn/configure_dns.sh
Dynamic shecan.ir configurator.
#! /bin/bash
#####################################################
# Fetch DNS configurations from shecan.ir #
#####################################################
set -e
reset=`tput sgr0`
red=`tput setaf 1`