Need Help for integration Mobilcore

Hello

My name is Miguel, I have very big problem when I try to integrate Mobilcore or Startapp in my app.
I was made me crazy many days …I have the problem in the java file, because androidmanifest is not problem.

I wil try to paste here the code of my app…and I hope anyone can help me

this is de code of java file
################

package com.librodeh.book.AOUI;

import android.kit.WebViewClient;
import android.widget.Toast;
import com.appnext.appnextsdk.Appnext;

public class FriarBook extends Activity {
private static final String DEV_HASH = null;
// Requires trailing slash!
final String BASE_URL = “file:///android_asset/book/”;
final String MIME_TYPE = “text/html”;
final String ENCODING = “iso-8859-1”;

        WebView webView;
        List<String> htmlFiles = new ArrayList<String>();
        HashMap<String, Integer> htmlMap = new HashMap<String, Integer>();
        int currentPage = 0;
        int totalPages = 0;
		Appnext appnext;

        GestureDetector gestureDetector;
        SimpleOnGestureListener gestureListener = new SimpleOnGestureListener() {
                    private final int SWIPE_MIN_DISTANCE = 100;
                    private final int SWIPE_MAX_DISTANCE = 350;
                    private final int SWIPE_MIN_VELOCITY = 100;

                    @Override
                    public boolean onDown(MotionEvent event) {
                                return false;
                    }

                    @Override
                    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
                                final float xDistance = Math.abs(e1.getX() - e2.getX());
                                final float yDistance = Math.abs(e1.getY() - e2.getY());

                                if (xDistance > this.SWIPE_MAX_DISTANCE || yDistance > this.SWIPE_MAX_DISTANCE) {
                                            return false;
                                }

                                velocityX = Math.abs(velocityX);
                                velocityY = Math.abs(velocityY);

                                if (velocityX > this.SWIPE_MIN_VELOCITY && xDistance > this.SWIPE_MIN_DISTANCE) {
                                            if (e1.getX() > e2.getX()) { // right to left
                                                        if (currentPage + 1 >= totalPages) {
                                                                    showToast("This is the last page of the book.");
                                                        } else {
                                                                    showUrl(++currentPage);
                                                                    return true;
                                                        }
                                            } else {
                                                        if (currentPage - 1 < 0) {
                                                                    showToast("This is the first page of the book.");
                                                        } else {
                                                                    showUrl(--currentPage);
                                                                    return true;
                                                        }
                                            }
                                }

                                return false;
                    }
        };

        /** Called when the activity is first created. */
        @Override
        public void onCreate(final Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                    setContentView(R.layout.main);
                    public static void MobileCore.init(Activity activity, String devHash, LOG_TYPE logLevel, MobileCore.AD_UNITS...)
              

                    htmlFiles = loadBook();
                    totalPages = htmlFiles.size();

                    int count = 0;
                    for (String filename : htmlFiles) {
                                htmlMap.put(filename, count++);
                    }
                   
                    webView = (WebView) findViewById(R.id.webview);
                    webView.setWebViewClient(new FriarWebViewClient());
                    webView.getSettings().setJavaScriptEnabled(true);
                    webView.getSettings().setPluginState(WebSettings.PluginState.ON);

                    gestureDetector = new GestureDetector(getBaseContext(), gestureListener);
                    webView.setOnTouchListener(new View.OnTouchListener() {
                                public boolean onTouch(View wv, MotionEvent event) {
                                            gestureDetector.onTouchEvent(event);
                                            return false;
                                }
                    });

                    if (savedInstanceState != null && savedInstanceState.get("currentPage") != null) {
                                currentPage = savedInstanceState.getInt("currentPage");
                    }
                    webView.loadUrl(BASE_URL + htmlFiles.get(currentPage));
                    System.out.println(BASE_URL + htmlFiles.get(currentPage));
					
					appnext = new Appnext(this);
					appnext.setAppID("44444444444444444444"); // Set your AppID
					appnext.showBubble(); // show the interstitia

					
        }
        

        // Handle Android physical back button.
        @Override
        public boolean onKeyDown(int keyCode, KeyEvent event) {
                    if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) {
                                webView.goBack();
                                return true;
                    }
                    return super.onKeyDown(keyCode, event);
        }

        @Override
        public void onSaveInstanceState(Bundle savedInstanceState) {
                    super.onSaveInstanceState(savedInstanceState);
                    savedInstanceState.putInt("currentPage", currentPage);
        }

        @Override
        public void onRestoreInstanceState(Bundle savedInstanceState) {
                    super.onRestoreInstanceState(savedInstanceState);
                    currentPage = savedInstanceState.getInt("currentPage");
        }

        private List<String> loadBook() {
                    try {
                                InputStream instream = getAssets().open("book/book.json");
                                String json = convertStreamToString(instream);
                                JSONObject jsonObject = (JSONObject) new JSONTokener(json).nextValue();
                                JSONArray contents = jsonObject.getJSONArray("contents");

                                for (int index = 0; index < contents.length(); index++) {
                                            htmlFiles.add(contents.getString(index));
                                }
                    } catch (IOException e) {
                                e.printStackTrace();
                    } catch (JSONException e) {
                                e.printStackTrace();
                    }
                    return htmlFiles;
        }

        private String convertStreamToString(InputStream is) {
                    return new Scanner(is).useDelimiter("\\A").next();
        }

        private void showUrl(int pageNum) {
                    assert pageNum >= 0 && pageNum < totalPages;

                    String filename = htmlFiles.get(pageNum);
                    String url = BASE_URL + filename;
                    webView.loadUrl(url);
                    showToast(currentPage + "");
        }

        private void showToast(final String text) {
                    Toast t = Toast.makeText(getBaseContext(), text, Toast.LENGTH_SHORT);
                    t.show();
                    System.out.println(text);
        }

        class FriarWebViewClient extends WebViewClient {
                    @Override
                    public void onPageStarted(WebView view, String url, Bitmap favicon) {
                                try {
                                            URI uri = new URI(url);
                                            String[] segments = uri.getPath().split("/");
                                            String filename = segments[segments.length - 1];
                                            currentPage = htmlMap.get(filename);
                                } catch (URISyntaxException e) {
                                            e.printStackTrace();
                                }
                                System.out.println(currentPage + " " + url);
                    }

           }
        }

}

Change this line

public static void MobileCore.init(Activity activity, String devHash, LOG_TYPE logLevel, MobileCore.AD_UNITS…)

to something like this (adjust to your needs)

MobileCore.init(this, “your hash”, LOG_TYPE.PRODUCTION, MobileCore.AD_UNITS.INTERSTITIAL);

Download their sample app in the resources page. Use the source code as code snippets. You’d only need to change the developer hash.

thanks Ryan

I did that…and export to andor app apk…the app open but intertitial doesent work…
I put in the attachment the java file clean with no intertitial code…maybe can help me to see where inster the code…all things that I did was bad.
I have not experience

the codes that I have to put in the file are in this link Android InApp Documentation · StartApp-SDK/Documentation Wiki · GitHub they are startapp codes

I wold like to put correctly the codes in my app, startapp and if anyone can help me mobilcore.

Im very disapointed because I am a exwebmaster trying to do andoird apps and its being very dificult for me…

Thanks for all

javafile.txt (6.08 KB)