Commit 41b2a5db authored by Pete Clark's avatar Pete Clark Committed by Gant Laborde

Adding support for android's Instance ID (#47)

* adding logging to try to get some more info

* adding instance id

* adding logging to be sure instance id gets created

* import instance id

* adding play services to dependencies

* ignore ide files

* removing dependency

* including dependency properly this time, without comma >:-(

* import all play services

* fixing param to instanceid.getinstance

* i should compile before i commit :-(

* 64k dexer limit; including just base

* finally found docs telling me the right dependency name

* :-(

* can’t wait to squash these commits

* hi

* removing logging

* adding new method to readme

* Release a new version

* Update device names to respect Apple Branding

Apple uses lowercase `s` for all devices since 5s model

* Small updates to README.md to make install easier

* More specific Android import

Users shouldn't use wildcard imports as they simply import too much. In this case it's much safer to just use a single import since that's all we need.

* Add support for device country

* Release 0.9.0

* Update for iPhone SE and 9.7-inch iPad Pro

* Release 0.9.1

* Update RNDeviceInfo.podspec

Resolved a hard error (missing authors)
Resolved warning (git repo should end in .git)
Updated version to match package.json

* Update README.md

Cocoa pods installation instructions.

* Update README.md

* Add build version

Returns full build version on iOS, use with https://gist.github.com/karlvr/c93a98d7000ecb163895

* Bump to 0.9.2

* Update podspec

* Revert

* Update podspec

* Adding support for Android's Instance ID

* Merge remote-tracking branch 'origin/master'

# Conflicts:
#	README.md

removing logging as well
parent 6a202768
......@@ -26,3 +26,21 @@ DerivedData
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
#
#Pods/
.idea/.name
.idea/compiler.xml
.idea/copyright/profiles_settings.xml
.idea/encodings.xml
.idea/misc.xml
.idea/modules.xml
.idea/react-native-device-info.iml
.idea/vcs.xml
.idea/workspace.xml
......@@ -125,4 +125,6 @@ console.log("User Agent", DeviceInfo.getUserAgent()); // e.g. Dalvik/2.1.0 (Linu
console.log("Device Locale", DeviceInfo.getDeviceLocale()); // e.g en-US
console.log("Device Country", DeviceInfo.getDeviceCountry()); // e.g US
console.log("App Instance ID", DeviceInfo.getInstanceID()); // ANDROID ONLY - see https://developers.google.com/instance-id/
```
......@@ -20,4 +20,5 @@ android {
dependencies {
compile 'com.facebook.react:react-native:0.11.+'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
}
......@@ -6,6 +6,8 @@ import android.content.pm.PackageManager;
import android.os.Build;
import android.provider.Settings.Secure;
import com.google.android.gms.iid.InstanceID;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
......@@ -77,6 +79,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
e.printStackTrace();
}
constants.put("instanceId", InstanceID.getInstance(this.reactContext).getId());
constants.put("deviceName", deviceName);
constants.put("systemName", "Android");
constants.put("systemVersion", Build.VERSION.RELEASE);
......
......@@ -8,6 +8,9 @@ module.exports = {
getUniqueID: function () {
return RNDeviceInfo.uniqueId;
},
getInstanceID: function() {
return RNDeviceInfo.instanceId;
},
getDeviceId: function () {
return RNDeviceInfo.deviceId;
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment