Git Product home page Git Product logo

contentstack-android's People

Contributors

aravindbuilt avatar chinmayacharya28 avatar contentstack-admin avatar hiteshbal91 avatar ishaileshmishra avatar nandeesh-gajula avatar nikhilgohil11 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

nithinay

contentstack-android's Issues

Fatal Exception: java.lang.OutOfMemoryError(CSAppUtils.java line 97)

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!

Issue with updating my app targated version to 31

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!

For Setting the Branch for a Region

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.

Is not able to change the region if we use the method stack for getting the object Stack

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

Null Pointer Exception in Android SDK when accessing "publish_details" array

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:

  1. Integrate ContentStack Android SDK into an Android project.
  2. Fetch a JSON object that does not contain the "publish_details" array or contains a null value for it.
  3. Attempt to access and iterate through the "publish_details" array using the provided SDK code.

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.

Screen Shot 2023-03-16 at 4 30 56 PM

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");
}

Publish to maven central

Can you publish this lib to maven central? It would:

  1. Make it easier to add/update the dependency
  2. Make it easier to manage transitive dependencies. ie: Depend on okhttp instead of shading it in the repo.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.