Prepare, build and deploy the app with the following commands.
cordova run android
cordova run ios
If using an Android emulator, the emulator's location will need to be passed to it. To do this, switch to the DDMS view, select the emulator under devices, select Emulator Control, press the Send button. Then press the Get Location button on the emulator. On an iOS simulator the location can be changed under Debug > Location.
Depending on the device, the location may not be returned before the timeout occurs. On Android, ensure that the Location is enabled under Settings > Location > On. The Mode can also be set. Finally under recent location requests should appear LocationDemo if you have previously pressed the Get Location button. On iOS, ensure that Location is enabled under Settings > Privacy > Location > Location Service > On
Copy the contents of the www folder to the platform specific www folder of the project using prepare.
Deploy the Kapsel app to an Android emulator based on the Google APIs or an Android device. On startup the app will register with Google and receive a registration ID. This registration ID can be used to send the app notifications.
Copy notify.js to C:\Kapsel_Projects\PushDemo2\notify.js. Edit notify.js and fill in the registration ID on line 20. The registration ID can be copied from the Android logcat or the Web Inspector console by searching for registrationId and then selecting the line containing it and pressing Ctrl C. Also provide the API key on line 5.
Press the home button to place the app in the background. Type
to send a notification. Notice that a notification appears on the device.
Open the notifications and then click on the notification.
Note, try also sending a notification while the app is displayed (foreground notification) and after closing the app via the back button (cold start notification)