parse-push-plugin icon indicating copy to clipboard operation
parse-push-plugin copied to clipboard

Installation not saving?

Open andrescruz opened this issue 10 years ago • 30 comments

I'm getting the following error after running the subscribe function

When I run the ParsePushPlugin.getInstallationObjectId() function, I receive a null value which makes me believe that it's not saving the installation.

Any idea how I can resolve this or what I should be looking into?

andrescruz avatar Jul 09 '16 18:07 andrescruz

Which platform is this happening on and are you able to verify in the database that an installation has not been saved?

taivo avatar Jul 09 '16 20:07 taivo

It's happening on an ionic app for iOS. And yes I can confirm that the installation is not saving the new row.

Sent from my iPhone

On Jul 9, 2016, at 1:34 PM, taivo [email protected] wrote:

Which platform is this happening on and are you able to verify in the database that an installation has not been saved?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

andrescruz avatar Jul 09 '16 21:07 andrescruz

Same here, followed all instructions. new installation not being saved. Running ionic1 app

mymanga avatar Jul 11 '16 05:07 mymanga

I'm on Ionic v 1.3 as well using back4app.com services for Parse. I've gone through the steps and recreated the certificates and provisioning profiles multiple times.

andrescruz avatar Jul 11 '16 15:07 andrescruz

Looks like a recent commit may have been the cause. For now, can you try one of 2 things?

  1. roll back and use an older commit of this plugin b7af55f1810f6492c879a899e2d8e527509f844b
  2. in your config.xml, add <preference name="ParseAutoRegistration" value="true" />

Let me know if that works. I'm a bit swamped right now but will get a permanent solution out next week or so.

taivo avatar Jul 11 '16 23:07 taivo

How to "roll back" Im a beginner at git

mymanga avatar Jul 12 '16 00:07 mymanga

you roll back by cordova plugin add https://github.com/taivo/parse-push-plugin#b7af55f1810f6492c879a899e2d8e527509f844b

@taivo I attempted both and neither solution worked for me. I can wait it out and see if you're able to get this resolved soon. Thanks!

andrescruz avatar Jul 12 '16 16:07 andrescruz

Same issue here.

cleever avatar Jul 27 '16 03:07 cleever

same problem , someone has managed to turn the ionic v1 ?

movibe avatar Jul 29 '16 04:07 movibe

I was not able to replicate this problem with the included example app. I did some rewrite though to make the device registration + installation saving steps more robust. Please try the latest commit.

If the problem persists, I'm going to need some logs from you guys.

taivo avatar Jul 29 '16 08:07 taivo

Hi @taivo , thanks for the answer, I will be creating another ionic application for testing and make the maximum possible debug and share github source code and access to the server to assist in the contribution of this solution

movibe avatar Jul 29 '16 10:07 movibe

Thank you @movibe. If you want, this repo has an example directory. There are code and docs in that directory to help you quickly rig up a test app. Javascript handlers for push notifications are also included. That app can be a good template to start if you want to save some time.

taivo avatar Jul 29 '16 18:07 taivo

When I run:

 ParsePushPlugin.getInstallationId(function(id) {
         // note that the javascript client has its own installation id,
         // which is different from the device installation id.
          alert("device installationId: " + id);
      }, function(e) {
          alert('error');
      });

The alert dialog shows the installationId correctly. However nothing is saved to Installation table in my Parse Server.

cleever avatar Aug 01 '16 15:08 cleever

adb logcat noticeable output:

W/System(26686): Ignoring header X-Parse-Client-Key because its value was null.


E/com.parse.ManifestInfo(25598): 
Cannot use GCM for push because the app manifest is missing some required declarations. 
Please make sure that these permissions are declared as children of the root <manifest> element:

08-01 17:03:31.158: E/com.parse.PushService(31115): Tried to use push, but this app is not configured for push due to: Push is not configured for this app because the app manifest is missing required declarations. 
Please add the following declarations to your app manifest to support either GCM or PPNS for push (or both). To enable GCM support, please make sure that these permissions are declared as children of the root <manifest> element:

08-01 17:03:30.869: I/ActivityManager(1854): Start proc 31115:com.limbic.towermadness2/u0a250 for broadcast com.limbic.towermadness2/com.parse.ParseBroadcastReceiver
08-01 17:03:31.156: E/com.parse.ManifestInfo(31115): <service android:name="com.parse.PushService" />
08-01 17:03:31.156: E/com.parse.ManifestInfo(31115): <receiver android:name="com.parse.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
08-01 17:03:31.158: E/com.parse.PushService(31115): <service android:name="com.parse.PushService" />
08-01 17:03:31.158: E/com.parse.PushService(31115): <receiver android:name="com.parse.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
08-01 17:03:31.158: E/com.parse.PushService(31115): <service android:name="com.parse.PushService" />
08-01 17:03:31.158: E/com.parse.PushService(31115): <receiver android:name="com.parse.ParseBroadcastReceiver">
08-01 17:03:31.296: I/ActivityManager(1854): Start proc 31138:com.basf.suvinil/u0a215 for broadcast com.basf.suvinil/com.parse.ParseBroadcastReceiver
08-01 17:03:38.394: V/AlarmManager(1854): sending alarm {1cb5405 type 2 *walarm*:com.parse.RetryGcmRegistration}
08-01 17:03:38.410: V/AlarmManager(1854): done {1cb5405, *walarm*:com.parse.RetryGcmRegistration} [16ms]
08-01 17:04:00.873: V/AlarmManager(1854): sending alarm {1cb5405 type 2 *walarm*:com.parse.RetryGcmRegistration}
08-01 17:04:00.893: V/AlarmManager(1854): done {1cb5405, *walarm*:com.parse.RetryGcmRegistration} [20ms]
08-01 17:04:01.976: I/ActivityManager(1854): Start proc 31388:com.cleanup.cleanupapp/u0a311 for broadcast com.cleanup.cleanupapp/com.parse.GcmBroadcastReceiver

AndroidManifest.xml

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="900" android:versionName="0.0.1" package="com.ionic.ionicapp" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:name="github.taivo.parsepushplugin.ParsePushApplication" android:supportsRtl="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <service android:name="com.parse.PushService" />
        <receiver android:exported="false" android:name="github.taivo.parsepushplugin.ParsePushPluginReceiver">
            <intent-filter>
                <action android:name="com.parse.push.intent.RECEIVE" />
                <action android:name="com.parse.push.intent.DELETE" />
                <action android:name="com.parse.push.intent.OPEN" />
            </intent-filter>
        </receiver>
        <receiver android:name="com.parse.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                <category android:name="com.ionic.ionicapp" />
            </intent-filter>
        </receiver>
        <meta-data android:name="com.parse.push.gcm_sender_id" android:value="id:CORRECT_GCM" />
    </application>
    (...)
</manifest>

cleever avatar Aug 01 '16 20:08 cleever

ParsePushPlugin.getInstallationId() itself does not save the installation id to the database. It merely reads the id generated by Parse client sdk.

Thanks for the log and manifest. I'm reviewing them now.

taivo avatar Aug 02 '16 09:08 taivo

Hi @cleever, regarding this line in the manifest:

<meta-data android:name="com.parse.push.gcm_sender_id" android:value="id:CORRECT_GCM" />

Did you edit the id out for privacy reason? Or was the config.xml preference ParseGcmSenderId mistakenly set as "CORRECT_GCM"

taivo avatar Aug 02 '16 10:08 taivo

Hello @taivo. Thank you for your support. I've edited the id for privacy reason.

cleever avatar Aug 02 '16 11:08 cleever

Hello @taivo , plugin worked perfectly, what I noticed is that needs to verify the config.xml file with the example you put

Thank you for sharing your work

movibe avatar Aug 02 '16 12:08 movibe

Hi @movibe. You are welcome!

Can you share with us what led to the original problem? Also, was your issue on ios or android?

taivo avatar Aug 02 '16 13:08 taivo

@cleever, can you do me a favor and try to replicate this problem with the included test app in the 'example' directory? View that directory on github and you will see instructions to build that app

taivo avatar Aug 02 '16 13:08 taivo