Skip to content

Instantly share code, notes, and snippets.

View iniyanmurugavel's full-sized avatar
🎯
Focusing

Iniyan Murugavel iniyanmurugavel

🎯
Focusing
View GitHub Profile
@iniyanmurugavel
iniyanmurugavel / DeadSystemException throws from os
Last active September 17, 2020 16:42
deadsystemexception-start-service-android
This crash is present on:
all Samsung devices 7.0
all Nexus devices on 7.1.2
When the device is being restarted, you cannot run an app. Any app, not just yours but any given app cannot run when the device is restarting. AFAIK it occurs when you try to do something when the system crashes.
Meaning if the system crashes and as it restarts your app starts a service or does something you get that error.
@iniyanmurugavel
iniyanmurugavel / Security verdicts
Created September 17, 2020 09:12
Temparing code to find in android code
And now you just need to call the method isHacked from your onCreate method in your initial Activity to check that your application was renamed or relocated.
public boolean isHacked(Context context, String myPackageName, String google, String amazon)
{
//Renamed?
if (context.getPackageName().compareTo(myPackageName) != 0) {
return true; // BOOM!
}
//Relocated?
@iniyanmurugavel
iniyanmurugavel / gist:2f8a006a47682076eccb19c0765ff5e4
Last active September 3, 2020 18:20
Live Template in android studio for common use case
File and code templates option in android studio to automate creation of recyclerview adapter.
AndroidStudio -> Preference->Editor->File and Code Template
Click plus icon at the top then you will see a panel with name, extension and code template editor. All you need to do is enter the template name, mention the extension(kt, java or xml) and paste the above template here and click OK. It’s done, all you need to do is just navigate to the package where you want to create the adapter and right click on it and select then you should see a file with name you mentioned while creating file template.
Feel free to comment if there any suggestions or improvements
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}#end
@iniyanmurugavel
iniyanmurugavel / gist:91bf8e62a87826a69e9f6eced615873a
Created June 29, 2020 08:10
Application Url or User credentials Security after Reverse Engineering
#About Security
Absolute security does not exist. Security is a set of measures, being piled up and combined, trying to slow down the inevitable.
https://medium.com/google-developer-experts/a-follow-up-on-how-to-store-tokens-securely-in-android-e84ac5f15f17
NDK Decode :-
String key1 = new String(Base64.decode(getNativeKey1(),Base64.DEFAULT));
String key2 = new String(Base64.decode(getNativeKey2(),Base64.DEFAULT));
https://medium.com/@abhi007tyagi/storing-api-keys-using-android-ndk-6abb0adcadad
https://medium.com/@himanshusoni501/safest-way-to-secure-your-app-server-credentials-7894fb4f4fe4
@iniyanmurugavel
iniyanmurugavel / Androidx migration
Created June 29, 2020 08:09
Androidx migration issues and Gson vs Moshi upgrade
If you have this in your gradle :
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
then you are telling android to use java 8.
@iniyanmurugavel
iniyanmurugavel / File methods
Created June 29, 2020 08:08
About FileStorage in android
Methods to store in Internal Storage(GT):
Both these methods are present in Context class
File getDir (String name, int mode)
File getFilesDir ()
Methods to store in Primary External Storage i.e. Internal Storage(UT):
@iniyanmurugavel
iniyanmurugavel / publish apk
Created June 29, 2020 08:06
Apk publish automation useful links
https://console.developers.google.com/apis/credentials?project=api-5298280870467023733-962021
https://proandroiddev.com/how-to-automate-google-play-store-releases-c4c2a4b19435
https://unicorn-utterances.com/posts/travis-ci-for-android/#Part-B-Dummy-files
https://proandroiddev.com/change-language-programmatically-at-runtime-on-android-5e6bc15c758
$ git tag -a v1.4 -m "my version 1.4"
$ git tag
Useful Links
./gradlew publishApkRelease
@iniyanmurugavel
iniyanmurugavel / work manager
Last active April 19, 2024 12:15
Work Manager Understanding
Work Manager
WorkManager is an API that makes it easy to schedule deferrable, asynchronous tasks that are expected to run even if the app exits or the device restarts. The WorkManager API is a suitable and recommended replacement for all previous Android background scheduling APIs
Device support from 14 -22 it will work on alarm manager with broadcast to process scheduling and GCM NetworkManager
Device above 23 + all uses JobSchedular
usecases :
Dynamic Feature modules and clean architecture
Backup chat like whatsapp after a hours or 1 in a day
update news in any news app - phone in charge or connect with constraint and executes the task and impl
@iniyanmurugavel
iniyanmurugavel / gist:8e90b654391d30e463ca0a9915e950fb
Created June 29, 2020 08:05
LiveData Useful for Understanding
https://blog.mindorks.com/understanding-livedata-in-android
LiveData considers an observer, which is represented by the Observer class, to be in an active state if its lifecycle is in the STARTED or RESUMED state. LiveData only notifies active observers about updates. Inactive observers registered to watch LiveData objects aren't notified about changes.
Features
Ensures your UI matches your data state
No memory leaks
No crashes due to stopped activities
No more manual lifecycle handling
@iniyanmurugavel
iniyanmurugavel / proguard
Created June 29, 2020 08:04
DEXGUARD VS Proguard
ProGuard is a generic optimizer for Java bytecode.
DexGuard is a specialized tool for the protection of Android applications.
ProGuard is a versatile optimizer for Java bytecode. It enables you to shrink, optimize and obfuscate desktop applications, embedded applications and mobile applications (Android)
DexGuard, on the other hand, is specifically designed to protect and optimize Android applications. The multilayered protection DexGuard provides is adapted to the distributed and quickly evolving environment in which mobile applications are used. In addition, DexGuard offers functionality that helps you to make optimal use of the Android platform. It comes with a tuned configuration for the Android runtime and for common libraries (Google Play Services, Dagger, Realm, SQLCipher etc.) and automatically splits DEX files that exceed the size limits imposed by the format (MultiDex).