Skip to content

Commit

Permalink
feat(android): Add getLong helper on PluginCall (#5235)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile committed Jan 5, 2022
1 parent 88ff44b commit 26261fb
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions android/capacitor/src/main/java/com/getcapacitor/PluginCall.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,24 @@ public Integer getInt(String name, @Nullable Integer defaultValue) {
return defaultValue;
}

@Nullable
public Long getLong(String name) {
return this.getLong(name, null);
}

@Nullable
public Long getLong(String name, @Nullable Long defaultValue) {
Object value = this.data.opt(name);
if (value == null) {
return defaultValue;
}

if (value instanceof Long) {
return (Long) value;
}
return defaultValue;
}

@Nullable
public Float getFloat(String name) {
return this.getFloat(name, null);
Expand Down

0 comments on commit 26261fb

Please sign in to comment.