contentstack / contentstack-android Goto Github PK
View Code? Open in Web Editor NEWAndroid SDK for Contentstack's Content Delivery API
License: MIT License
Android SDK for Contentstack's Content Delivery API
License: MIT License
We integrated CS in my Android app, and release the app to play store
We saw crashes in firebase in class CSAppUtils.
Here is log
Fatal Exception: java.lang.OutOfMemoryError
Failed to allocate a 80 byte allocation with 13200 free bytes and 12KB until OOM, target footprint 268435456, growth limit 268435456; giving up on allocation because <1% of heap free after GC.
com.contentstack.sdk.utilities.CSAppUtils.getJsonFromCacheFile (CSAppUtils.java:97)
com.contentstack.sdk.utilities.CSAppUtils.getResponseTimeFromCacheFile (CSAppUtils.java:45)
com.contentstack.sdk.Query.execQuery (Query.java:1781)
com.contentstack.sdk.Query.find (Query.java:1553)
com.modere.data.model.Content.continueGetContent (Content.kt:401)
com.modere.data.model.Content.access$continueGetContent (Content.kt:21)
com.modere.data.model.Content$getContent$1.onCompletion (Content.kt:355)
com.contentstack.sdk.QueryResultsCallBack.onRequestFinish (QueryResultsCallBack.java:12)
com.contentstack.sdk.Query.setCacheModel (Query.java:1934)
com.contentstack.sdk.Query.execQuery (Query.java:1790)
com.contentstack.sdk.Query.find (Query.java:1553)
myAppCalss.getContent (Content.kt:333)
Could you please help us to fix the issue! we have 62 crashes with this issue in last couple of days!
When we tried to publish our first release on the Play store, unfortunately, we got a security error pointing to the ContentStack Android SDK. We investigated more on this and found the implementation of the Contentstack::clearCache(Context)
method has a PendingIntent which is causing this issue.
The Google Guidelines for the same can be found here: https://support.google.com/faqs/answer/10437428
I am using 'com.contentstack.sdk:android:3.10.0' in my app, and my app targetedSDKversion is 30
Its working fine
Now I am updating my app targetedSDKversion to 31 because of Content stack SDK manifest file is not compatible to sdk version 31 I unable to run/compile the app
it is throwing error says
android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. src/main/AndroidManifest.xml
This is because of content stack manifest file receivers do not specified android:exported in their receivers , I did it locally in generated Content stack sdk:android:3.10.0 manifest
Could you please help me!
Hi, Contentstack team,
The v3.12.1 SDK couldn't be downloaded.
This issue can be reproduced on your contentstack-android-ecommerce-app sample app.
Please check this download issue.
The Android section of the Contentstack documentation mentions the part "For Setting the Branch for a Region". It suggests that if you want to use a specific branch during the SDK initialization process, you should use the Config::setBranch()
method.
However, I cannot find the Config::setBranch()
method in the Contentstack SDK for Android. Could you please provide guidance on how to utilize a specific branch during SDK initialization?
The following sample code is extracted from the "For Setting the Branch for a Region" section of the Contentstack documentation:
Config config = Config();
config.setRegion(ContentstackRegion.<<add_your_region>>);
config.setBranch("branch");
Stack stack = Contentstack.stack("api_key", "delivery_token", "environment_name", config);
Please provide me with the correct method or approach to set a specific branch during SDK initialization in the Contentstack SDK for Android.
Hi, I faced this problem this morning.
When I try to change the region to EU after set in the config object, the region by default is still being US.
I saw the code inside the Contentstack.java and the problem is the line 73, because any config I set in the method
public static Stack stack(@NotNull Context context, @NotNull String apiKey, @NotNull String deliveryToken, @NotNull String environment, @NotNull Config config) throws Exception {
is replaced by the line 73 creating another new config object and that's wrong.
public static Stack stack(@NotNull Context context, @NotNull String apiKey, @NotNull String deliveryToken, @NotNull
String environment, @NotNull Config config) throws Exception {
if (!TextUtils.isEmpty(apiKey) || !TextUtils.isEmpty(deliveryToken) || !TextUtils.isEmpty(environment)) {
config = new Config(); //This is the line 73
config.setEnvironment(environment);
return initializeStack(context, apiKey, deliveryToken, config);
} else {
throw new Exception(SDKConstant.EMPTY_CREDENTIALS_NOT_ALLOWED);
}
}
The version I am using is the last one, 3.12.0
Description:
While using the ContentStack Android SDK version 3.10.0, we encountered a null pointer exception when attempting to access the "publish_details" array from a JSON object. This issue occurs when the JSON object does not contain the "publish_details" array or when the array is null. It leads to a warning in the app when trying to call the length() method on a null object.
Steps to reproduce:
Expected behavior:
The SDK should handle cases where the "publish_details" array is not present or is null without throwing a null pointer exception.
Actual behavior:
A null pointer exception is thrown when trying to call the length() method on a null object, leading to warnings in the app.
Proposed solution:
Add a null check before iterating through the publishArray. Here's a suggested modification to the SDK code:
if (publishArray != null) {
for (int i = 0; i < publishArray.length(); i++) {
JSONObject publishObject = publishArray.optJSONObject(i);
Iterator<String> iterator = publishObject.keys();
HashMap<String, Object> hashMap = new HashMap<>();
while (iterator.hasNext()) {
String key = iterator.next();
hashMap.put(key, publishObject.opt(key));
}
}
} else {
Log.e("ContentStack", "publish_details array not found or is null");
}
Can you publish this lib to maven central? It would:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.