# Lint Report

Check performed at Tue May 22 12:52:31 CST 2018.
2 errors and 6 warnings found:

| Correctness
2 | MissingPermission: Missing Permissions
1 | CommitPrefEdits: Missing `commit()` on `SharedPreference` editor
1 | GradleDynamicVersion: Gradle Dynamic Version
| Security
3 | HardwareIds: Hardware Id Usage
1 | ExportedReceiver: Receiver does not require permission
| Disabled Checks (16)

Correctness
MissingPermission: Missing Permissions
../../src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java:64: Missing permissions required by WifiManager.getConnectionInfo: android.permission.ACCESS_WIFI_STATE

      61   private WifiInfo getWifiInfo() {
      62     if (this.wifiInfo == null) {
      63       WifiManager manager = (WifiManager) reactContext.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
      64       this.wifiInfo = manager.getConnectionInfo();
      65     }
      66     return this.wifiInfo;

../../src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java:295: Missing permissions required by TelephonyManager.getLine1Number: android.permission.READ_PHONE_STATE or android.permission.READ_SMS or android.permission.READ_PHONE_NUMBERS

     292             getCurrentActivity().checkCallingOrSelfPermission(Manifest.permission.READ_SMS) == PackageManager.PERMISSION_GRANTED ||
     293             getCurrentActivity().checkCallingOrSelfPermission("android.permission.READ_PHONE_NUMBERS") == PackageManager.PERMISSION_GRANTED)) {
     294       TelephonyManager telMgr = (TelephonyManager) this.reactContext.getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
     295       constants.put("phoneNumber", telMgr.getLine1Number());
     296     }
     297     constants.put("carrier", this.getCarrier());

Note: This issue has an associated quickfix operation in Android Studio/IntelliJ
Priority: 9 / 10
Category: Correctness
Severity: Error
Explanation: Missing Permissions.
This check scans through your code and libraries and looks at the APIs being used, and checks this against the set of permissions required to access those APIs. If the code using those APIs is called at runtime, then the program will crash.
Furthermore, for permissions that are revocable (with targetSdkVersion 23), client code must also be prepared to handle the calls throwing an exception if the user rejects the request for permission at runtime.
More info:
To suppress this error, use the issue id "MissingPermission" as explained in the Suppressing Warnings and Errors section.
CommitPrefEdits: Missing `commit()` on `SharedPreference` editor
../../src/main/java/com/learnium/RNDeviceInfo/RNDeviceReceiver.java:17: Consider using `apply()` instead; `commit` writes its data to persistent storage immediately, whereas `apply` will handle it in the background

      14       SharedPreferences sharedPref = context.getSharedPreferences("react-native-device-info", Context.MODE_PRIVATE);
      15       SharedPreferences.Editor editor = sharedPref.edit();
      16       editor.putString("installReferrer", intent.getStringExtra("referrer"));
      17       editor.commit();
      18     }
      19   }

Note: This issue has an associated quickfix operation in Android Studio/IntelliJ
Priority: 6 / 10
Category: Correctness
Severity: Warning
Explanation: Missing `commit()` on `SharedPreference` editor.
After calling `edit()` on a `SharedPreference`, you must call `commit()` or `apply()` on the editor to save the results.
More info:
To suppress this error, use the issue id "CommitPrefEdits" as explained in the Suppressing Warnings and Errors section.
GradleDynamicVersion: Gradle Dynamic Version
../../build.gradle:30: Avoid using + in version numbers; can lead to unpredictable and unrepeatable builds (com.facebook.react:react-native:+)

      27 dependencies {
      28     def googlePlayServicesVersion = project.hasProperty('googlePlayServicesVersion') ? project.googlePlayServicesVersion : DEFAULT_GOOGLE_PLAY_SERVICES_VERSION
      29
      30     compile 'com.facebook.react:react-native:+'
      31     compile "com.google.android.gms:play-services-gcm:$googlePlayServicesVersion"
      32 }

Note: This issue has an associated quickfix operation in Android Studio/IntelliJ
Priority: 4 / 10
Category: Correctness
Severity: Warning
Explanation: Gradle Dynamic Version.
Using `+` in dependencies lets you automatically pick up the latest available version rather than a specific, named version. However, this is not recommended; your builds are not repeatable; you may have tested with a slightly different version than what the build server used. (Using a dynamic version as the major version number is more problematic than using it in the minor version position.)
More info:
To suppress this error, use the issue id "GradleDynamicVersion" as explained in the Suppressing Warnings and Errors section.
Security
HardwareIds: Hardware Id Usage
../../src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java:139: Using `getMacAddress` to get device identifiers is not recommended.

     136
     137   @ReactMethod
     138   public void getMacAddress(Promise p) {
     139     String macAddress = getWifiInfo().getMacAddress();
     140
     141     String permission = "android.permission.INTERNET";

../../src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java:275: Using `getString` to get device identifiers is not recommended.

     272     constants.put("apiLevel", Build.VERSION.SDK_INT);
     273     constants.put("deviceLocale", this.getCurrentLanguage());
     274     constants.put("deviceCountry", this.getCurrentCountry());
     275     constants.put("uniqueId", Secure.getString(this.reactContext.getContentResolver(), Secure.ANDROID_ID));
     276     constants.put("systemManufacturer", Build.MANUFACTURER);
     277     constants.put("bundleId", packageName);

../../src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java:295: Using `getLine1Number` to get device identifiers is not recommended.

     292             getCurrentActivity().checkCallingOrSelfPermission(Manifest.permission.READ_SMS) == PackageManager.PERMISSION_GRANTED ||
     293             getCurrentActivity().checkCallingOrSelfPermission("android.permission.READ_PHONE_NUMBERS") == PackageManager.PERMISSION_GRANTED)) {
     294       TelephonyManager telMgr = (TelephonyManager) this.reactContext.getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
     295       constants.put("phoneNumber", telMgr.getLine1Number());
     296     }
     297     constants.put("carrier", this.getCarrier());

Priority: 6 / 10
Category: Security
Severity: Warning
Explanation: Hardware Id Usage.
Using device identifiers is not recommended other than for high value fraud prevention and advanced telephony use-cases. For advertising use-cases, use `AdvertisingIdClient$Info#getId` and for analytics, use `InstanceId#getId`.
More info: https://developer.android.com/training/articles/user-data-ids.html
To suppress this error, use the issue id "HardwareIds" as explained in the Suppressing Warnings and Errors section.
ExportedReceiver: Receiver does not require permission
../../src/main/AndroidManifest.xml:5: Exported receiver does not require permission

       2           package="com.learnium.RNDeviceInfo">
       3
       4     <application>
       5         <receiver
       6             android:name="com.learnium.RNDeviceInfo.RNDeviceReceiver"
       7             android:enabled="true"

Priority: 5 / 10
Category: Security
Severity: Warning
Explanation: Receiver does not require permission.
Exported receivers (receivers which either set `exported=true` or contain an intent-filter and do not specify `exported=false`) should define a permission that an entity must have in order to launch the receiver or bind to it. Without this, any application can use this receiver.
More info:
To suppress this error, use the issue id "ExportedReceiver" as explained in the Suppressing Warnings and Errors section.
Disabled Checks
The following issues were not run by lint, either because the check is not enabled by default, or because it was disabled with a command line flag or via one or more lint.xml configuration files in the project directories.
AppLinksAutoVerifyError
Disabled By: Default
Priority: 5 / 10
Category: Correctness
Severity: Error
Explanation: App Links Auto Verification Failure.
Ensures that app links are correctly set and associated with website.
More info: https://g.co/appindexing/applinks
To suppress this error, use the issue id "AppLinksAutoVerifyError" as explained in the Suppressing Warnings and Errors section.
AppLinksAutoVerifyWarning
Disabled By: Default
Priority: 5 / 10
Category: Correctness
Severity: Warning
Explanation: Potential App Links Auto Verification Failure.
Ensures that app links are correctly set and associated with website.
More info: https://g.co/appindexing/applinks
To suppress this error, use the issue id "AppLinksAutoVerifyWarning" as explained in the Suppressing Warnings and Errors section.
BackButton
Disabled By: Default
Priority: 6 / 10
Category: Usability
Severity: Warning
Explanation: Back button.
According to the Android Design Guide,
"Other platforms use an explicit back button with label to allow the user to navigate up the application's hierarchy. Instead, Android uses the main action bar's app icon for hierarchical navigation and the navigation bar's back button for temporal navigation."
This check is not very sophisticated (it just looks for buttons with the label "Back"), so it is disabled by default to not trigger on common scenarios like pairs of Back/Next buttons to paginate through screens.
More info: http://developer.android.com/design/patterns/pure-android.html
To suppress this error, use the issue id "BackButton" as explained in the Suppressing Warnings and Errors section.
EasterEgg
Disabled By: Default
Priority: 6 / 10
Category: Security
Severity: Warning
Explanation: Code contains easter egg.
An "easter egg" is code deliberately hidden in the code, both from potential users and even from other developers. This lint check looks for code which looks like it may be hidden from sight.
More info:
To suppress this error, use the issue id "EasterEgg" as explained in the Suppressing Warnings and Errors section.
FieldGetter
Disabled By: Default
Priority: 4 / 10
Category: Performance
Severity: Warning
Explanation: Using getter instead of field.
Accessing a field within the class that defines a getter for that field is at least 3 times faster than calling the getter. For simple getters that do nothing other than return the field, you might want to just reference the local field directly instead.
NOTE: As of Android 2.3 (Gingerbread), this optimization is performed automatically by Dalvik, so there is no need to change your code; this is only relevant if you are targeting older versions of Android.
More info: http://developer.android.com/guide/practices/design/performance.html#internal_get_set
To suppress this error, use the issue id "FieldGetter" as explained in the Suppressing Warnings and Errors section.
GoogleAppIndexingApiWarning
Note: This issue has an associated quickfix operation in Android Studio/IntelliJ
Disabled By: Default
Priority: 5 / 10
Category: Usability
Severity: Warning
Explanation: Missing support for Google App Indexing Api.
Adds URLs to get your app into the Google index, to get installs and traffic to your app from Google Search.
More info: https://g.co/AppIndexing/AndroidStudio
To suppress this error, use the issue id "GoogleAppIndexingApiWarning" as explained in the Suppressing Warnings and Errors section.
IconExpectedSize
Disabled By: Default
Priority: 5 / 10
Category: Usability:Icons
Severity: Warning
Explanation: Icon has incorrect size.
There are predefined sizes (for each density) for launcher icons. You should follow these conventions to make sure your icons fit in with the overall look of the platform.
More info: http://developer.android.com/design/style/iconography.html
To suppress this error, use the issue id "IconExpectedSize" as explained in the Suppressing Warnings and Errors section.
LogConditional
Disabled By: Default
Priority: 5 / 10
Category: Performance
Severity: Warning
Explanation: Unconditional Logging Calls.
The BuildConfig class (available in Tools 17) provides a constant, "DEBUG", which indicates whether the code is being built in release mode or in debug mode. In release mode, you typically want to strip out all the logging calls. Since the compiler will automatically remove all code which is inside a "if (false)" check, surrounding your logging calls with a check for BuildConfig.DEBUG is a good idea.
If you really intend for the logging to be present in release mode, you can suppress this warning with a @SuppressLint annotation for the intentional logging calls.
More info:
To suppress this error, use the issue id "LogConditional" as explained in the Suppressing Warnings and Errors section.
MangledCRLF
Note: This issue has an associated quickfix operation in Eclipse/ADT
Disabled By: Default
Priority: 2 / 10
Category: Correctness
Severity: Error
Explanation: Mangled file line endings.
On Windows, line endings are typically recorded as carriage return plus newline: \r\n.
This detector looks for invalid line endings with repeated carriage return characters (without newlines). Previous versions of the ADT plugin could accidentally introduce these into the file, and when editing the file, the editor could produce confusing visual artifacts.
More info: https://bugs.eclipse.org/bugs/show_bug.cgi?id=375421
To suppress this error, use the issue id "MangledCRLF" as explained in the Suppressing Warnings and Errors section.
MissingRegistered
Disabled By: Default
Priority: 8 / 10
Category: Correctness
Severity: Error
Explanation: Missing registered class.
If a class is referenced in the manifest or in a layout file, it must also exist in the project (or in one of the libraries included by the project. This check helps uncover typos in registration names, or attempts to rename or move classes without updating the manifest file properly.
More info: http://developer.android.com/guide/topics/manifest/manifest-intro.html
To suppress this error, use the issue id "MissingRegistered" as explained in the Suppressing Warnings and Errors section.
NegativeMargin
Disabled By: Default
Priority: 4 / 10
Category: Usability
Severity: Warning
Explanation: Negative Margins.
Margin values should be positive. Negative values are generally a sign that you are making assumptions about views surrounding the current one, or may be tempted to turn off child clipping to allow a view to escape its parent. Turning off child clipping to do this not only leads to poor graphical performance, it also results in wrong touch event handling since touch events are based strictly on a chain of parent-rect hit tests. Finally, making assumptions about the size of strings can lead to localization problems.
More info:
To suppress this error, use the issue id "NegativeMargin" as explained in the Suppressing Warnings and Errors section.
NewerVersionAvailable
Note: This issue has an associated quickfix operation in Android Studio/IntelliJ
Disabled By: Default
Priority: 4 / 10
Category: Correctness
Severity: Warning
Explanation: Newer Library Versions Available.
This detector checks with a central repository to see if there are newer versions available for the dependencies used by this project. This is similar to the `GradleDependency` check, which checks for newer versions available in the Android SDK tools and libraries, but this works with any MavenCentral dependency, and connects to the library every time, which makes it more flexible but also much slower.
More info:
To suppress this error, use the issue id "NewerVersionAvailable" as explained in the Suppressing Warnings and Errors section.
SelectableText
Note: This issue has an associated quickfix operation in Android Studio/IntelliJ
Disabled By: Default
Priority: 7 / 10
Category: Usability
Severity: Warning
Explanation: Dynamic text should probably be selectable.
If a `<TextView>` is used to display data, the user might want to copy that data and paste it elsewhere. To allow this, the `<TextView>` should specify `android:textIsSelectable="true"`.
This lint check looks for TextViews which are likely to be displaying data: views whose text is set dynamically. This value will be ignored on platforms older than API 11, so it is okay to set it regardless of your `minSdkVersion`.
More info:
To suppress this error, use the issue id "SelectableText" as explained in the Suppressing Warnings and Errors section.
StopShip
Note: This issue has an associated quickfix operation in Android Studio/IntelliJ
Disabled By: Default
Priority: 10 / 10
Category: Correctness
Severity: Warning
Explanation: Code contains `STOPSHIP` marker.
Using the comment `// STOPSHIP` can be used to flag code that is incomplete but checked in. This comment marker can be used to indicate that the code should not be shipped until the issue is addressed, and lint will look for these.
More info:
To suppress this error, use the issue id "StopShip" as explained in the Suppressing Warnings and Errors section.
TypographyQuotes
Note: This issue has an associated quickfix operation in Android Studio/IntelliJ & Eclipse/ADT
Disabled By: Default
Priority: 5 / 10
Category: Usability:Typography
Severity: Warning
Explanation: Straight quotes can be replaced with curvy quotes.
Straight single quotes and double quotes, when used as a pair, can be replaced by "curvy quotes" (or directional quotes). This can make the text more readable.
Note that you should never use grave accents and apostrophes to quote, `like this'.
(Also note that you should not use curvy quotes for code fragments.)
More info: http://en.wikipedia.org/wiki/Quotation_mark
To suppress this error, use the issue id "TypographyQuotes" as explained in the Suppressing Warnings and Errors section.
UnusedIds
Disabled By: Default
Priority: 1 / 10
Category: Performance
Severity: Warning
Explanation: Unused id.
This resource id definition appears not to be needed since it is not referenced from anywhere. Having id definitions, even if unused, is not necessarily a bad idea since they make working on layouts and menus easier, so there is not a strong reason to delete these.
More info:
To suppress this error, use the issue id "UnusedIds" as explained in the Suppressing Warnings and Errors section.
Suppressing Warnings and Errors
Lint errors can be suppressed in a variety of ways:
1. With a `@SuppressLint` annotation in the Java code
2. With a `tools:ignore` attribute in the XML file
3. With ignore flags specified in the `build.gradle` file, as explained below
4. With a `lint.xml` configuration file in the project
5. With a `lint.xml` configuration file passed to lint via the --config flag
6. With the --ignore flag passed to lint.
To suppress a lint warning with an annotation, add a `@SuppressLint("id")` annotation on the class, method or variable declaration closest to the warning instance you want to disable. The id can be one or more issue id's, such as `"UnusedResources"` or `{"UnusedResources","UnusedIds"}`, or it can be `"all"` to suppress all lint warnings in the given scope.
To suppress a lint warning in an XML file, add a `tools:ignore="id"` attribute on the element containing the error, or one of its surrounding elements. You also need to define the namespace for the tools prefix on the root element in your document, next to the `xmlns:android` declaration:
`xmlns:tools="http://schemas.android.com/tools"`
To suppress a lint warning in a `build.gradle` file, add a section like this:
android {
lintOptions {
disable 'TypographyFractions','TypographyQuotes'
}
}
Here we specify a comma separated list of issue id's after the disable command. You can also use `warning` or `error` instead of `disable` to change the severity of issues.
To suppress lint warnings with a configuration XML file, create a file named `lint.xml` and place it at the root directory of the project in which it applies.
The format of the `lint.xml` file is something like the following:
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<!-- Disable this given check in this project -->
<issue id="IconMissingDensityFolder" severity="ignore" />
<!-- Ignore the ObsoleteLayoutParam issue in the given files -->
<issue id="ObsoleteLayoutParam">
<ignore path="res/layout/activation.xml" />
<ignore path="res/layout-xlarge/activation.xml" />
</issue>
<!-- Ignore the UselessLeaf issue in the given file -->
<issue id="UselessLeaf">
<ignore path="res/layout/main.xml" />
</issue>
<!-- Change the severity of hardcoded strings to "error" -->
<issue id="HardcodedText" severity="error" />
</lint>
To suppress lint checks from the command line, pass the --ignore flag with a comma separated list of ids to be suppressed, such as:
`$ lint --ignore UnusedResources,UselessLeaf /my/project/path`
For more information, see http://g.co/androidstudio/suppressing-lint-warnings