Commit 259434fa by Sebastián Katzer

Upgrade to version 0.8.0rc2

parent 603e6b30
......@@ -108,6 +108,27 @@
<sortByType />
</navigator>
<panes>
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="cordova-example-local-notifications" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="cordova-example-local-notifications" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="android" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
<pane id="PackagesPane" />
<pane id="AndroidView">
<subPane>
<PATH>
......@@ -150,28 +171,7 @@
</PATH>
</subPane>
</pane>
<pane id="PackagesPane" />
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="cordova-example-local-notifications" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="cordova-example-local-notifications" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="android" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
......@@ -335,12 +335,13 @@
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Build Variants" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Gradle Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32900432" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32756132" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Android" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32756132" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.2532189" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.2274678" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.23319027" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32756132" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Memory Monitor" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3997114" sideWeight="0.53648067" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
......@@ -349,7 +350,6 @@
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32756132" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32756132" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
</layout>
</component>
......
......@@ -10,17 +10,17 @@
</intent-filter>
</activity>
<service android:name="de.appplant.cordova.plugin.background.ForegroundService" />
<receiver android:exported="false" android:name="de.appplant.cordova.plugin.localnotification.TriggerReceiver" />
<receiver android:exported="false" android:name="de.appplant.cordova.plugin.localnotification.ClearReceiver" />
<activity android:exported="false" android:launchMode="singleInstance" android:name="de.appplant.cordova.plugin.localnotification.ClickActivity" android:theme="@android:style/Theme.NoDisplay" />
<receiver android:exported="false" android:name="de.appplant.cordova.plugin.notification.TriggerReceiver" />
<receiver android:exported="false" android:name="de.appplant.cordova.plugin.notification.ClearReceiver" />
<receiver android:name="de.appplant.cordova.plugin.localnotification.RestoreReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver android:exported="false" android:name="de.appplant.cordova.plugin.localnotification.TriggerReceiver" />
<receiver android:exported="false" android:name="de.appplant.cordova.plugin.localnotification.ClearReceiver" />
<activity android:launchMode="singleInstance" android:name="de.appplant.cordova.plugin.localnotification.ClickActivity" android:theme="@android:style/Theme.NoDisplay" />
<receiver android:exported="false" android:name="de.appplant.cordova.plugin.notification.TriggerReceiver" />
<receiver android:exported="false" android:name="de.appplant.cordova.plugin.notification.ClearReceiver" />
<activity android:launchMode="singleInstance" android:name="de.appplant.cordova.plugin.notification.ClickActivity" android:theme="@android:style/Theme.NoDisplay" />
<activity android:exported="false" android:launchMode="singleInstance" android:name="de.appplant.cordova.plugin.notification.ClickActivity" android:theme="@android:style/Theme.NoDisplay" />
</application>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
......
......@@ -40,7 +40,7 @@ module.exports.metadata =
{
"de.appplant.cordova.plugin.background-mode": "0.6.2",
"nl.x-services.plugins.toast": "2.0.3",
"de.appplant.cordova.plugin.local-notification": "0.8.0rc",
"de.appplant.cordova.plugin.local-notification": "0.8.0rc2",
"org.apache.cordova.device": "0.3.1-dev"
}
// BOTTOM OF METADATA
......
......@@ -46,10 +46,17 @@ import de.appplant.cordova.plugin.notification.*;
*/
public class LocalNotification extends CordovaPlugin {
private static CordovaWebView webView = null;
private static Boolean deviceready = false;
// Reference to the web view for static access
private static CordovaWebView webView = null;
// Indicates if the device is ready (to receive events)
private static Boolean deviceready = false;
// To inform the user about the state of the app in callbacks
protected static Boolean isInBackground = true;
private static ArrayList<String> eventQueue = new ArrayList<String>();
// Queues all events before deviceready
private static ArrayList<String> eventQueue = new ArrayList<String>();
/**
* Called after plugin construction and fields have been initialized.
......@@ -81,6 +88,16 @@ public class LocalNotification extends CordovaPlugin {
public void onResume(boolean multitasking) {
super.onResume(multitasking);
isInBackground = false;
deviceready();
}
/**
* The final call you receive before your activity is destroyed.
*/
@Override
public void onDestroy() {
deviceready = false;
isInBackground = true;
}
/**
......@@ -177,14 +194,14 @@ public class LocalNotification extends CordovaPlugin {
* Properties for each local notification
*/
private void schedule (JSONArray notifications) {
for (int i = 0; i < notifications.length(); i++) {
JSONObject options = notifications.optJSONObject(i);
for (int i = 0; i < notifications.length(); i++) {
JSONObject options = notifications.optJSONObject(i);
Notification notification =
getNotificationMgr().schedule(options, TriggerReceiver.class);
fireEvent("schedule", notification);
}
}
}
/**
......@@ -251,7 +268,7 @@ public class LocalNotification extends CordovaPlugin {
* Clear all triggered notifications without canceling them.
*/
private void clearAll() {
getNotificationMgr().clearAll();
getNotificationMgr().clearAll();
fireEvent("clearall");
}
......@@ -441,14 +458,14 @@ public class LocalNotification extends CordovaPlugin {
* Optional local notification to pass the id and properties.
*/
static void fireEvent (String event, Notification notification) {
String state = getApplicationState();
String state = getApplicationState();
String params = "\"" + state + "\"";
if (notification != null) {
params = notification.toString() + "," + params;
}
String js = "cordova.plugins.notification.local.fireEvent(" +
String js = "cordova.plugins.notification.local.fireEvent(" +
"\"" + event + "\"," + params + ")";
sendJavascript(js);
......@@ -460,7 +477,7 @@ public class LocalNotification extends CordovaPlugin {
* @param js
* JS code snippet as string
*/
private static void sendJavascript(final String js) {
private static synchronized void sendJavascript(final String js) {
if (!deviceready) {
eventQueue.add(js);
......
......@@ -40,7 +40,7 @@ module.exports.metadata =
{
"de.appplant.cordova.plugin.background-mode": "0.6.2",
"nl.x-services.plugins.toast": "2.0.3",
"de.appplant.cordova.plugin.local-notification": "0.8.0rc",
"de.appplant.cordova.plugin.local-notification": "0.8.0rc2",
"org.apache.cordova.device": "0.3.1-dev"
}
// BOTTOM OF METADATA
......
......@@ -47,7 +47,7 @@
"count": 1
},
{
"xml": "<activity android:launchMode=\"singleInstance\" android:name=\"de.appplant.cordova.plugin.localnotification.ClickActivity\" android:theme=\"@android:style/Theme.NoDisplay\" />",
"xml": "<activity android:exported=\"false\" android:launchMode=\"singleInstance\" android:name=\"de.appplant.cordova.plugin.localnotification.ClickActivity\" android:theme=\"@android:style/Theme.NoDisplay\" />",
"count": 1
},
{
......@@ -63,7 +63,7 @@
"count": 1
},
{
"xml": "<activity android:launchMode=\"singleInstance\" android:name=\"de.appplant.cordova.plugin.notification.ClickActivity\" android:theme=\"@android:style/Theme.NoDisplay\" />",
"xml": "<activity android:exported=\"false\" android:launchMode=\"singleInstance\" android:name=\"de.appplant.cordova.plugin.notification.ClickActivity\" android:theme=\"@android:style/Theme.NoDisplay\" />",
"count": 1
}
],
......
{"source":{"type":"local","path":"../cordova-plugin-local-notifications/"}}
\ No newline at end of file
......@@ -3,13 +3,16 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="de.appplant.cordova.plugin.local-notification"
version="0.8.0rc">
version="0.8.0rc2">
<name>LocalNotification</name>
<description>The purpose of the plugin is to create an platform independent javascript interface for Cordova based mobile applications to access the specific Notification API on each platform.</description>
<repo>https://github.com/katzer/cordova-plugin-local-notifications.git</repo>
<keywords>notification, local notification, alarm, scheduler, tile, live tiles, ios, android, windows phone 8, wp8</keywords>
<keywords>appplant, notification, local notification</keywords>
<license>Apache 2.0</license>
<author>Sebastián Katzer</author>
......@@ -19,9 +22,8 @@
<engine name="cordova" version=">=3.0.0" />
</engines>
<dependency
id="org.apache.cordova.device"
url="https://github.com/apache/cordova-plugin-device" />
<!-- dependencies -->
<dependency id="org.apache.cordova.device" />
<!-- js -->
<js-module src="www/local-notification.js" name="LocalNotification">
......@@ -31,6 +33,7 @@
<!-- ios -->
<platform name="ios">
<config-file target="config.xml" parent="/*">
<feature name="LocalNotification">
<param name="ios-package" value="APPLocalNotification" onload="true" />
......@@ -52,10 +55,12 @@
<header-file src="src/ios/UILocalNotification+APPLocalNotification.h" />
<source-file src="src/ios/UILocalNotification+APPLocalNotification.m" />
</platform>
<!-- android -->
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="LocalNotification">
<param name="android-package" value="de.appplant.cordova.plugin.localnotification.LocalNotification"/>
......@@ -75,7 +80,8 @@
<activity
android:name="de.appplant.cordova.plugin.localnotification.ClickActivity"
android:launchMode="singleInstance"
android:theme="@android:style/Theme.NoDisplay" />
android:theme="@android:style/Theme.NoDisplay"
android:exported="false" />
<receiver
android:name="de.appplant.cordova.plugin.notification.TriggerReceiver"
......@@ -94,7 +100,8 @@
<activity
android:name="de.appplant.cordova.plugin.notification.ClickActivity"
android:launchMode="singleInstance"
android:theme="@android:style/Theme.NoDisplay" />
android:theme="@android:style/Theme.NoDisplay"
android:exported="false" />
</config-file>
......
......@@ -46,10 +46,17 @@ import de.appplant.cordova.plugin.notification.*;
*/
public class LocalNotification extends CordovaPlugin {
private static CordovaWebView webView = null;
private static Boolean deviceready = false;
// Reference to the web view for static access
private static CordovaWebView webView = null;
// Indicates if the device is ready (to receive events)
private static Boolean deviceready = false;
// To inform the user about the state of the app in callbacks
protected static Boolean isInBackground = true;
private static ArrayList<String> eventQueue = new ArrayList<String>();
// Queues all events before deviceready
private static ArrayList<String> eventQueue = new ArrayList<String>();
/**
* Called after plugin construction and fields have been initialized.
......@@ -81,6 +88,16 @@ public class LocalNotification extends CordovaPlugin {
public void onResume(boolean multitasking) {
super.onResume(multitasking);
isInBackground = false;
deviceready();
}
/**
* The final call you receive before your activity is destroyed.
*/
@Override
public void onDestroy() {
deviceready = false;
isInBackground = true;
}
/**
......@@ -177,14 +194,14 @@ public class LocalNotification extends CordovaPlugin {
* Properties for each local notification
*/
private void schedule (JSONArray notifications) {
for (int i = 0; i < notifications.length(); i++) {
JSONObject options = notifications.optJSONObject(i);
for (int i = 0; i < notifications.length(); i++) {
JSONObject options = notifications.optJSONObject(i);
Notification notification =
getNotificationMgr().schedule(options, TriggerReceiver.class);
fireEvent("schedule", notification);
}
}
}
/**
......@@ -251,7 +268,7 @@ public class LocalNotification extends CordovaPlugin {
* Clear all triggered notifications without canceling them.
*/
private void clearAll() {
getNotificationMgr().clearAll();
getNotificationMgr().clearAll();
fireEvent("clearall");
}
......@@ -441,14 +458,14 @@ public class LocalNotification extends CordovaPlugin {
* Optional local notification to pass the id and properties.
*/
static void fireEvent (String event, Notification notification) {
String state = getApplicationState();
String state = getApplicationState();
String params = "\"" + state + "\"";
if (notification != null) {
params = notification.toString() + "," + params;
}
String js = "cordova.plugins.notification.local.fireEvent(" +
String js = "cordova.plugins.notification.local.fireEvent(" +
"\"" + event + "\"," + params + ")";
sendJavascript(js);
......@@ -460,7 +477,7 @@ public class LocalNotification extends CordovaPlugin {
* @param js
* JS code snippet as string
*/
private static void sendJavascript(final String js) {
private static synchronized void sendJavascript(final String js) {
if (!deviceready) {
eventQueue.add(js);
......
......@@ -293,7 +293,7 @@
* The IDs of the notifications
*/
- (void) getIds:(CDVInvokedUrlCommand*)command
byType:(APPLocalNotificationType)type;
byType:(APPLocalNotificationType)type;
{
[self.commandDelegate runInBackground:^{
CDVPluginResult* result;
......@@ -410,7 +410,7 @@
- (void) registerPermission:(CDVInvokedUrlCommand*)command
{
if ([[UIApplication sharedApplication]
respondsToSelector:@selector(registerUserNotificationSettings:)])
respondsToSelector:@selector(registerUserNotificationSettings:)])
{
_command = command;
......@@ -486,18 +486,18 @@
}
/**
* Cancels all local notification with are older then
* Cancels all non-repeating local notification older then
* a specific amount of seconds
*/
- (void) cancelAllNotificationsWhichAreOlderThen:(float)seconds
{
NSArray* notifications;
notifications = [self.app scheduledLocalNotifications];
notifications = [self.app localNotifications];
for (UILocalNotification* notification in notifications)
{
if (notification && [notification isRepeating]
if (![notification isRepeating]
&& notification.timeIntervalSinceFireDate > seconds)
{
[self.app cancelLocalNotification:notification];
......@@ -530,20 +530,7 @@
if ([event isEqualToString:@"click"] && ![notification isRepeating])
{
[self.app cancelLocalNotification:notification];
[self fireEvent:@"cancel" notification:notification];
return;
}
if ([event isEqualToString:@"click"])
return;
timeInterval = [notification timeIntervalSinceFireDate];
if (timeInterval > 1 && [notification isRepeating])
{
[self fireEvent:@"fireUpdateEvent" notification:notification];
return;
}
}
......@@ -636,8 +623,8 @@
}
/**
* Simply invokes the callback without any parameter.
*/
* Simply invokes the callback without any parameter.
*/
- (void) execCallback:(CDVInvokedUrlCommand*)command
{
CDVPluginResult *result = [CDVPluginResult
......
......@@ -95,25 +95,6 @@
}
/**
* List of all local notifications which have been scheduled
* and not yet removed from the notification center.
*/
- (NSArray*) scheduledLocalNotifications2
{
NSArray* scheduledNotifications = self.scheduledLocalNotifications;
NSMutableArray* notifications = [[NSMutableArray alloc] init];
for (UILocalNotification* notification in scheduledNotifications)
{
if (notification && [notification isScheduled]) {
[notifications addObject:notification];
}
}
return notifications;
}
/**
* List of all triggered local notifications which have been scheduled
* and not yet removed the notification center.
*/
......
{
"de.appplant.cordova.plugin.local-notification": {
"source": {
"type": "local",
"path": "/Users/sebastian/Documents/github/cordova-plugin-local-notifications"
}
}
}
\ No newline at end of file
{
"version": "0.3.0",
"name": "org.apache.cordova.device",
"cordova_name": "Device",
"description": "Cordova Device Plugin",
"license": "Apache 2.0",
"repo": "https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git",
"issue": "https://issues.apache.org/jira/browse/CB/component/12320648",
"keywords": [
"cordova",
"device"
],
"platforms": [
"firefoxos",
"tizen",
"android",
"amazon-fireos",
"ubuntu",
"ios",
"blackberry10",
"wp7",
"wp8",
"windows8",
"windows",
"browser"
],
"engines": [],
"englishdoc": "<!---\n Licensed to the Apache Software Foundation (ASF) under one\n or more contributor license agreements. See the NOTICE file\n distributed with this work for additional information\n regarding copyright ownership. The ASF licenses this file\n to you under the Apache License, Version 2.0 (the\n \"License\"); you may not use this file except in compliance\n with the License. You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing,\n software distributed under the License is distributed on an\n \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n KIND, either express or implied. See the License for the\n specific language governing permissions and limitations\n under the License.\n-->\n\n# org.apache.cordova.device\n\nThis plugin defines a global `device` object, which describes the device's hardware and software.\nAlthough the object is in the global scope, it is not available until after the `deviceready` event.\n\n document.addEventListener(\"deviceready\", onDeviceReady, false);\n function onDeviceReady() {\n console.log(device.cordova);\n }\n\n## Installation\n\n cordova plugin add org.apache.cordova.device\n\n## Properties\n\n- device.cordova\n- device.model\n- device.platform\n- device.uuid\n- device.version\n\n## device.cordova\n\nGet the version of Cordova running on the device.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Browser\n- Firefox OS\n- iOS\n- Tizen\n- Windows Phone 7 and 8\n- Windows 8\n\n## device.model\n\nThe `device.model` returns the name of the device's model or\nproduct. The value is set by the device manufacturer and may be\ndifferent across versions of the same product.\n\n### Supported Platforms\n\n- Android\n- BlackBerry 10\n- Browser\n- iOS\n- Tizen\n- Windows Phone 7 and 8\n- Windows 8\n\n### Quick Example\n\n // Android: Nexus One returns \"Passion\" (Nexus One code name)\n // Motorola Droid returns \"voles\"\n // BlackBerry: Torch 9800 returns \"9800\"\n // Browser: Google Chrome returns \"Chrome\"\n // Safari returns \"Safari\"\n // iOS: for the iPad Mini, returns iPad2,5; iPhone 5 is iPhone 5,1. See http://theiphonewiki.com/wiki/index.php?title=Models\n //\n var model = device.model;\n\n### Android Quirks\n\n- Gets the [product name](http://developer.android.com/reference/android/os/Build.html#PRODUCT) instead of the [model name](http://developer.android.com/reference/android/os/Build.html#MODEL), which is often the production code name. For example, the Nexus One returns `Passion`, and Motorola Droid returns `voles`.\n\n### Tizen Quirks\n\n- Returns the device model assigned by the vendor, for example, `TIZEN`\n\n### Windows Phone 7 and 8 Quirks\n\n- Returns the device model specified by the manufacturer. For example, the Samsung Focus returns `SGH-i917`.\n\n## device.platform\n\nGet the device's operating system name.\n\n var string = device.platform;\n\n### Supported Platforms\n\n- Android\n- BlackBerry 10\n- Browser4\n- Firefox OS\n- iOS\n- Tizen\n- Windows Phone 7 and 8\n- Windows 8\n\n### Quick Example\n\n // Depending on the device, a few examples are:\n // - \"Android\"\n // - \"BlackBerry 10\"\n // - Browser: returns \"MacIntel\" on Mac\n // returns \"Win32\" on Windows\n // - \"iOS\"\n // - \"WinCE\"\n // - \"Tizen\"\n var devicePlatform = device.platform;\n\n### Windows Phone 7 Quirks\n\nWindows Phone 7 devices report the platform as `WinCE`.\n\n### Windows Phone 8 Quirks\n\nWindows Phone 8 devices report the platform as `Win32NT`.\n\n## device.uuid\n\nGet the device's Universally Unique Identifier ([UUID](http://en.wikipedia.org/wiki/Universally_Unique_Identifier)).\n\n var string = device.uuid;\n\n### Description\n\nThe details of how a UUID is generated are determined by the device manufacturer and are specific to the device's platform or model.\n\n### Supported Platforms\n\n- Android\n- BlackBerry 10\n- iOS\n- Tizen\n- Windows Phone 7 and 8\n- Windows 8\n\n### Quick Example\n\n // Android: Returns a random 64-bit integer (as a string, again!)\n // The integer is generated on the device's first boot\n //\n // BlackBerry: Returns the PIN number of the device\n // This is a nine-digit unique integer (as a string, though!)\n //\n // iPhone: (Paraphrased from the UIDevice Class documentation)\n // Returns a string of hash values created from multiple hardware identifies.\n // It is guaranteed to be unique for every device and can't be tied\n // to the user account.\n // Windows Phone 7 : Returns a hash of device+current user,\n // if the user is not defined, a guid is generated and will persist until the app is uninstalled\n // Tizen: returns the device IMEI (International Mobile Equipment Identity or IMEI is a number\n // unique to every GSM and UMTS mobile phone.\n var deviceID = device.uuid;\n\n### iOS Quirk\n\nThe `uuid` on iOS is not unique to a device, but varies for each\napplication, for each installation. It changes if you delete and\nre-install the app, and possibly also when you upgrade iOS, or even\nupgrade the app per version (apparent in iOS 5.1). The `uuid` is not\na reliable value.\n\n### Windows Phone 7 and 8 Quirks\n\nThe `uuid` for Windows Phone 7 requires the permission\n`ID_CAP_IDENTITY_DEVICE`. Microsoft will likely deprecate this\nproperty soon. If the capability is not available, the application\ngenerates a persistent guid that is maintained for the duration of the\napplication's installation on the device.\n\n## device.version\n\nGet the operating system version.\n\n var string = device.version;\n\n### Supported Platforms\n\n- Android 2.1+\n- BlackBerry 10\n- Browser\n- iOS\n- Tizen\n- Windows Phone 7 and 8\n- Windows 8\n\n### Quick Example\n\n // Android: Froyo OS would return \"2.2\"\n // Eclair OS would return \"2.1\", \"2.0.1\", or \"2.0\"\n // Version can also return update level \"2.1-update1\"\n //\n // BlackBerry: Torch 9800 using OS 6.0 would return \"6.0.0.600\"\n //\n // Browser: Returns version number for the browser\n //\n // iPhone: iOS 3.2 returns \"3.2\"\n //\n // Windows Phone 7: returns current OS version number, ex. on Mango returns 7.10.7720\n // Tizen: returns \"TIZEN_20120425_2\"\n var deviceVersion = device.version;\n\n"
}
\ No newline at end of file
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