Skip to content

Instantly share code, notes, and snippets.

View parthitechnotion's full-sized avatar

parth Darji parthitechnotion

  • https://github.com/itechnotion
  • India
View GitHub Profile
public static AlertDialog showConfirmDialog(String message, Context context,
String btnPositiveName, final DialogInterface.OnClickListener okClickListener,
String btnNegavtiveName, final DialogInterface.OnClickListener cancelClickListener) {
TextView msgView = new TextView(context);
msgView.setText(message);
msgView.setTextSize(18);
msgView.setPadding(100, 10, 10, 10);
msgView.setGravity(Gravity.LEFT);
msgView.setTextColor(Color.BLACK);
import com.onesignal.OneSignal;
public class YourAppClass extends Application {
@Override
public void onCreate() {
super.onCreate();
// OneSignal Initialization
OneSignal.startInit(this)
.inFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification)
@parthitechnotion
parthitechnotion / gist:42e5075d8895bcf4a39e70327a6203bc
Created July 13, 2018 11:48
Launch Application Using packageName
https://www.programcreek.com/java-api-examples/android.content.ComponentName
------------
public void openApplication(Context context, String packageName) {
PackageInfo pi;
try {
pi = context.getPackageManager().getPackageInfo(packageName, 0);
} catch (PackageManager.NameNotFoundException e) {
pi = null;
e.printStackTrace();
@parthitechnotion
parthitechnotion / create hash key for google apis
Created May 15, 2018 12:39
create hash key for google apis
keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
keytool -exportcert -alias androiddebugkey -keystore "C:\Documents and Settings\Administrator\.android\debug.keystore" | "C:\OpenSSL\bin\openssl" sha1 -binary |"C:\OpenSSL\bin\openssl" base64
keytool -exportcert -alias <RELEASE_KEY_NAME> -keystore D:\Github_Code\Chambu-Android-New\app\certificate\Chambu_keystore | "C:\OpenSSL\bin\openssl" sha1 -binary | "C:\OpenSSL\bin\openssl" base64
@parthitechnotion
parthitechnotion / phone gap generate release apk
Last active May 9, 2018 12:45
phone gap generate release apk
https://stackoverflow.com/questions/20402818/build-android-release-apk-on-phonegap-3-x-cli
http://docs.phonegap.com/phonegap-build/signing/android/
https://gist.github.com/rocco/59e98b10643d55b11bc3
https://chris-allen-lane.com/blog/post/phonegap-compiling-a-release-apk-without-using-phonegap-build
https://cordova.apache.org/docs/en/latest/guide/platforms/android/upgrade.html
@parthitechnotion
parthitechnotion / checkPlayServices and show dialog to update forcefully
Created May 8, 2018 05:47
checkPlayServices and show dialog to update forcefully
/**
* Check the device to make sure it has the Google Play Services APK. If
* it doesn't, display a dialog that allows users to download the APK from
* the Google Play Store or enable it in the device's system settings.
*/
private boolean checkPlayServices() {
GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
int resultCode = apiAvailability.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (apiAvailability.isUserResolvableError(resultCode)) {
https://documentation.onesignal.com/docs/customize-notification-icons
@parthitechnotion
parthitechnotion / RecyclerView with SwipeLeft & Right
Created March 17, 2018 16:04
RecyclerView with SwipeLeft & Right
https://codeburst.io/android-swipe-menu-with-recyclerview-8f28a235ff28
@parthitechnotion
parthitechnotion / Alert dialog from Utils
Created March 14, 2018 10:30
Alert dialog from Utils
// Put this in your actvity or fragment
ViewUtils.showConfirm("Are you sure you want to logout?", getActivity(), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
AppSetting.getCurrent().clearLogin();
App.showLogin(getActivity());
}
}, null);
----------------------------------------------
@parthitechnotion
parthitechnotion / Library for Image Compress
Last active March 12, 2018 19:48
Library for Image Compress
https://github.com/zetbaitsu/Compressor
https://github.com/nanchen2251/CompressHelper