Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
io.github.nishkarsh:android-permissions
Advanced tools
An android library that makes it really easy to deal with dynamic permissions. Based on the context, the library automatically decides whether to show a dialog (in case the app is in foreground) or a notification (in case permission is required by a background service).
An android library that makes it really easy to deal with dynamic permissions. Based on the context, library automatically decides whether to show a dialog (in case app is in foreground) or a notification (in case permission is required by a background service).
After migration of artifacts to Maven Central, the newer builds would be published under group id
io.github.nishkarsh
. To include into the project, please select a particular published version and follow the instructions provided for the dependency management tool used: https://search.maven.org/artifact/io.github.nishkarsh/android-permissions
PermissionManager
using PermissionManager#getInstance()
PermissionManager#checkPermissions(Collection<String> permissions, PermissionRequestListener listener)
PermissionRequestListener#onPermissionGranted()
is called directly.Service
follows the same principle.Deny
for any of the permissions asked by the app, PermissionRequestListener#onPermissionDenied(DeniedPermissions deniedPermissions)
is called.Allow
for all the permissions asked by the app, PermissionRequestListener#onPermissionGranted()
is called. This behaviour is per set of permissions asked.Don't ask again
is checked by the user in the permission dialog displayed, DeniedPermission#shouldShowRationale()
returns false.The notification shown to ask for permissions when the app is in background, could be customised using NotificationSettings
. An instance of NotificationSettings
can be created using NotificationsSettings.Builder
to customise the title, message and/or a small icon for the notification.
PermissionManager instance = PermissionManager.getInstance(this);
NotificationSettings.Builder builder = new NotificationSettings.Builder();
NotificationSettings notificationSettings = builder
.withTitle(R.string.title_action_needed)
.withMessage(R.string.message_permission_required)
.withSmallIcon(R.drawable.app_icon).build();
instance.setNotificationSettings(notificationSettings);
In the above example, the R.string.title_action_needed
, R.string.message_permission_required
and R.drawable.app_icon
are the custom resources created in the project.
PermissionManager permissionManager = PermissionManager.getInstance(context);
permissionManager.checkPermissions(singleton(Manifest.permission.CAMERA), new PermissionManager.PermissionRequestListener() {
@Override
public void onPermissionGranted() {
Toast.makeText(context, "Permissions Granted", Toast.LENGTH_SHORT).show();
}
@Override
public void onPermissionDenied(DeniedPermissions deniedPermissions) {
String deniedPermissionsText = "Denied: " + Arrays.toString(deniedPermissions.toArray());
Toast.makeText(context, deniedPermissionsText, Toast.LENGTH_SHORT).show();
for (DeniedPermission deniedPermission : deniedPermissions) {
if(deniedPermission.shouldShowRationale()) {
// Display a rationale about why this permission is required
}
}
}
});
Permissions must be separated per functionality. After getting the instance of PermissionManager
, the call to PermissionManager#checkPermissions(Collection<String> permissions, PermissionRequestListener listener)
must be made for each set of permissions that are required for specific features.
For example, if you need to access location for scanning beacons and need to access contacts and storage to perform another operation, ask for location permission and other permissions separately. This would help you focus only on a particular functionality at a time.
Gradle: implementation 'io.github.nishkarsh:android-permissions:2.0.54'
Add android-permissions as dependency inside app module build.gradle under dependencies block. Your app level build.gradle should look like:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'io.github.nishkarsh:android-permissions:2.1.6'
}
FAQs
An android library that makes it really easy to deal with dynamic permissions. Based on the context, the library automatically decides whether to show a dialog (in case the app is in foreground) or a notification (in case permission is required by a background service).
We found that io.github.nishkarsh:android-permissions demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.