Open Fanom2813 opened 8 months ago
Please, if possible, provide more explanations step by step
In my manifest
<!--region Parse SDK-->
<service android:name="com.parse.fcm.ParseFirebaseInstanceIdService" android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service android:name="com.parse.fcm.ParseFirebaseMessagingService"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<receiver
android:name="com.parse.ParsePushBroadcastReceiver"
android:exported="false">
<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>
<!--endregion-->
I initialize like this
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
await Parse().initialize(
"key",
"url",
debug: true,
coreStore: await CoreStoreSharedPreferences.getInstance(),
);
ParsePush.instance.initialize(FirebaseMessaging.instance, parseNotification:
ParseNotification(onShowNotification: (message) async {
print(message);
}));
FirebaseMessaging.onMessage
.listen((message) => ParsePush.instance.onMessage(message));
FirebaseMessaging.onBackgroundMessage(onBackgroundMessage);
currentUser = await ParseUser.currentUser();
if (currentUser != null) {
await initInstallation();
}
Future<void> initInstallation() async {
final ParseInstallation installation =
await ParseInstallation.currentInstallation();
final ParseResponse response = await installation.create();
print(response);
}
when i do a fresh install i get java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.File com.parse.ParsePlugins.getFilesDir()' on a null object reference
however when i run the app a second time the error doesnt appear
i dont know it is a miss configration but install object is not saved in the database yet deviceToken
is set and the object is well populated here is the log
I/flutter (27336): API Request (_Installation : ParseApiRQ.save) : I/flutter (27336): Uri: http://192.168.8.101:1337/parse/installations/Ipgt3ngJJt I/flutter (27336): Body: {"deviceToken":"token","pushType":"gcm","deviceType":"android","localeIdentifier":"en_US","timeZone":"Indian/Mayotte","appName":"app","appVersion":"0","appIdentifier":"id","parseVersion":"5.1.3"} I/flutter (27336): ----
server response :
{"code":101,"stack":"Error: Object not found for update.\n api/node_modules/parse-server/lib/RestWrite.js:1027:15\n at processTicksAndRejections (node:internal/process/task_queues:96:5)"}
In my manifest
<!--region Parse SDK--> <service android:name="com.parse.fcm.ParseFirebaseInstanceIdService" android:exported="true"> <intent-filter> <action android:name="com.google.firebase.INSTANCE_ID_EVENT" /> </intent-filter> </service> <service android:name="com.parse.fcm.ParseFirebaseMessagingService" android:exported="true"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT"/> </intent-filter> </service> <receiver android:name="com.parse.ParsePushBroadcastReceiver" android:exported="false"> <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> <!--endregion-->
I initialize like this
await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, ); await Parse().initialize( "key", "url", debug: true, coreStore: await CoreStoreSharedPreferences.getInstance(), ); ParsePush.instance.initialize(FirebaseMessaging.instance, parseNotification: ParseNotification(onShowNotification: (message) async { print(message); })); FirebaseMessaging.onMessage .listen((message) => ParsePush.instance.onMessage(message)); FirebaseMessaging.onBackgroundMessage(onBackgroundMessage); currentUser = await ParseUser.currentUser(); if (currentUser != null) { await initInstallation(); }
Future<void> initInstallation() async { final ParseInstallation installation = await ParseInstallation.currentInstallation(); final ParseResponse response = await installation.create(); print(response); }
when i do a fresh install i get
java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.File com.parse.ParsePlugins.getFilesDir()' on a null object reference
however when i run the app a second time the error doesnt appeari dont know it is a miss configration but install object is not saved in the database yet
deviceToken
is set and the object is well populated here is the logI/flutter (27336): API Request (_Installation : ParseApiRQ.save) : I/flutter (27336): Uri: http://192.168.8.101:1337/parse/installations/Ipgt3ngJJt I/flutter (27336): Body: {"deviceToken":"token","pushType":"gcm","deviceType":"android","localeIdentifier":"en_US","timeZone":"Indian/Mayotte","appName":"app","appVersion":"0","appIdentifier":"id","parseVersion":"5.1.3"} I/flutter (27336): ----
server response :
{"code":101,"stack":"Error: Object not found for update.\n api/node_modules/parse-server/lib/RestWrite.js:1027:15\n at processTicksAndRejections (node:internal/process/task_queues:96:5)"}
These items you added in the manifest are for Parse Android, these items are not needed for Parse Flutter, please check the push notifications document again.
after removing the manifest, the app doesnt crash on fresh install , but initinstallation
only works the first time when i reload the app i get
at least one ID field (deviceToken, installationId) must be specified in this operation {"code":135,"stack":"Error: at least one ID field (deviceToken, installationId) must be specified in this operation\n at RestWrite.handleInstallation (node_modules/parse-server/lib/RestWrite.js:954:11)\n at node_modules/parse-server/lib/RestWrite.js:105:17\n at runMicrotasks (
thanks for your help
after removing the manifest, the app doesnt crash on fresh install , but
initinstallation
only works the first time when i reload the app i getat least one ID field (deviceToken, installationId) must be specified in this operation {"code":135,"stack":"Error: at least one ID field (deviceToken, installationId) must be specified in this operation\n at RestWrite.handleInstallation (node_modules/parse-server/lib/RestWrite.js:954:11)\n at node_modules/parse-server/lib/RestWrite.js:105:17\n at runMicrotasks ()\n at processTicksAndRejections (node:internal/process/task_queues:96:5)"}
thanks for your help
Is the current user logged in?
after removing the manifest, the app doesnt crash on fresh install , but
initinstallation
only works the first time when i reload the app i get at least one ID field (deviceToken, installationId) must be specified in this operation {"code":135,"stack":"Error: at least one ID field (deviceToken, installationId) must be specified in this operation\n at RestWrite.handleInstallation (node_modules/parse-server/lib/RestWrite.js:954:11)\n at node_modules/parse-server/lib/RestWrite.js:105:17\n at runMicrotasks ()\n at processTicksAndRejections (node:internal/process/task_queues:96:5)"} thanks for your helpIs the current user logged in?
when user is not logged in initinstallation
completes normally , when i reload with user logged in it brings the above message
New Issue Checklist
Issue Description
Attempt to invoke virtual method 'java.io.File com.parse.ParsePlugins.getFilesDir()' on a null object reference
after following steps for push notificationActual Outcome
it fails the first time the apk getting install , the second time i run debug , the app opens perfectly
Expected Outcome
Environment
Parse Flutter SDK
7.0.0
3.16.3
3.2.3
macos 14.2 (23C64)
Server
6.4.0
Logs