ionic-team / capacitor

Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web ⚡️
https://capacitorjs.com
MIT License
11.24k stars 955 forks source link

[Bug]: Capacitor Preferences API not worked when Trash the App. #7424

Closed chaklasiyanikunj closed 3 weeks ago

chaklasiyanikunj commented 3 weeks ago

Capacitor Version

I read this documentation, which is capacitor JS provided

/*
 * this function is used for the set Value
 */
async setUser(data: any) {
  await Preferences.set({
        key: 'value',
        value: JSON.stringify(data)
  });
}

/*
 * this function is used for the get-Value
 */
async getUser() {
  const user: any = await Preferences.get({ key: 'value' });
  this.UsersDetails = user.value;
}

This is working fine when my app is running in the background. When I trash my app in the background and call for getUser(). It's giving a null value. It's not work.

Can anyone suggest if I am missing anything, or is there any other way available to Store the data in Capacitor JS?

Other API Details

No response

Platforms Affected

Current Behavior

It works with the When I app in the background.

Expected Behavior

It needs to work with me when I trash the app.

Project Reproduction

Angular

Additional Information

No response

ionitron-bot[bot] commented 3 weeks ago

This issue needs more information before it can be addressed. In particular, the reporter needs to provide a minimal sample app that demonstrates the issue. If no sample app is provided within 15 days, the issue will be closed. Please see the Contributing Guide for how to create a Sample App. Thanks! Ionitron 💙

chaklasiyanikunj commented 3 weeks ago

It's solved