Skip to content

Commit

Permalink
Merge pull request #226 from douglasjunior/patch-3
Browse files Browse the repository at this point in the history
Make 'com.google.android.gms:play-services-gcm' optional.
  • Loading branch information
GantMan committed Oct 20, 2017
2 parents 3ff4845 + 7377c83 commit 8a351c9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions RNDeviceInfo/RNDeviceInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ @implementation RNDeviceInfo

@synthesize isEmulator;

@synthesize isEmulator;

RCT_EXPORT_MODULE()

+ (BOOL)requiresMainQueueSetup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
import android.telephony.TelephonyManager;
import android.text.format.Formatter;

import com.google.android.gms.iid.InstanceID;

import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
Expand Down Expand Up @@ -141,7 +139,13 @@ public void getMacAddress(Promise p) {
e.printStackTrace();
}

constants.put("instanceId", InstanceID.getInstance(this.reactContext).getId());
try {
if (Class.forName("com.google.android.gms.iid.InstanceID") != null) {
constants.put("instanceId", com.google.android.gms.iid.InstanceID.getInstance(this.reactContext).getId());
}
} catch (ClassNotFoundException e) {
constants.put("instanceId", "N/A: Add com.google.android.gms:play-services-gcm to your project.");
}
constants.put("serialNumber", Build.SERIAL);
constants.put("deviceName", deviceName);
constants.put("systemName", "Android");
Expand Down

0 comments on commit 8a351c9

Please sign in to comment.