Giter Club home page Giter Club logo

Comments (14)

mohamdio avatar mohamdio commented on July 24, 2024

also, after tried to use it inside [ app.components ] i get error when build

OverAppsService.java:82: error: cannot find symbol
         overAppsHead = inflater.inflate(R.layout.service_over_apps_head, null, false);
symbol:   variable layout
  location: class R

also why you import your default or test app like that :

import com.ionicframework.overapp809848.R;

maybe this make the error ?

from cordova-plugin-drawoverapps.

ahmedwahba avatar ahmedwahba commented on July 24, 2024

This is a quick solution you can use this link
http://stackoverflow.com/questions/41087376/how-to-use-non-native-cordova-plugins-in-ionic-2
to add the plugin to your ionic 2 project as this plugin not an ionic native one
i hope it works with you

from cordova-plugin-drawoverapps.

mohamdio avatar mohamdio commented on July 24, 2024

I know how to use non native plugin in ionic and about [ app id ] i didn't changed it also however i removed platform and added it again also i changed the app id inside the plugin and added platform again nothing changed and still get this error, so app id not changed automatically !

can you show me example for how and where i can add your code ?
so what i did is :
1- i changed the app id like that :

import com.ionicframework.MY_APP_HERE.R;

2- added platform again
3- i used your plugin like that in [ app.components ] like that :

declare var window;
declare let OverApps: any;
declare let overApps: any;

@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  @ViewChild(Nav) nav: Nav;

  rootPage: any = HomePage;

  pages: Array<{title: string, component: any}>;

  constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen) {
    this.initializeApp();

    // used for an example of ngFor and navigation
    this.pages = [
      { title: 'Home', component: HomePage },
      { title: 'List', component: ListPage }
    ];

  }

  initializeApp() {
    this.platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      this.statusBar.styleDefault();
      this.splashScreen.hide();

        OverApps.checkPermission(function(msg){
           console.log(msg);
        });

       // i tried this code also
       // window.overApps.checkPermission(function(msg){
        //    console.log(msg);
        // });

        var options = {
          path: "test.html",    // file path to display as view content.
          hasHead: true,        // display over app head image which open the view up on click.
          dragToSide: false,    // enable auto move of head to screen side after dragging stop.
          enableBackBtn: false, // enable hardware back button to close view.
          enableCloseBtn: true,  //  whether to show native close btn or to hide it.
          verticalPosition: "bottom",    // set vertical alignment of view.
          horizontalPosition: "right"  // set horizontal alignment of view.
         };

         OverApps.startOverApp(options,function (success){
           		console.log(success);
         },function (err){
           		console.log(err);
         });
         // i tried this code also
         //  window.overApps.startOverApp(options,function (success){
        //    		console.log(success);
        //  },function (err){
        //    		console.log(err);
        //  });

    });
  }

  openPage(page) {
    // Reset the content nav to have just this page
    // we wouldn't want the back button to show in this scenario
    this.nav.setRoot(page.component);
  }
}

4- i added [ test.html ] file inside [ www ] folder which contain this code, just for test :

<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
  <meta charset="UTF-8">
  <title>Ionic App</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <meta name="format-detection" content="telephone=no">
  <meta name="msapplication-tap-highlight" content="no">

</head>
<body>

  <img src="assets/icon/favicon.ico" />

</body>
</html>

finally when i build the app by this code :

ionic run android --device

i get this error

BUILD FAILED

Total time: 3.455 secs

Error: 
FULL_URL_TO_PROJECT/platforms/android/src/org/apache/cordova/overApps/Services/OverAppsService.java:81: error: cannot find symbol
         overAppsHead = inflater.inflate(R.layout.service_over_apps_head, null, false);
                                          ^
  symbol:   variable layout
  location: class R
FULL_URL_TO_PROJECT/platforms/android/src/org/apache/cordova/overApps/Services/OverAppsService.java:82: error: cannot find symbol
         overAppsView = inflater.inflate(R.layout.service_over_apps_view, null, false);
                                          ^
  symbol:   variable layout
  location: class R
FULL_URL_TO_PROJECT/platforms/android/src/org/apache/cordova/overApps/Services/OverAppsService.java:83: error: cannot find symbol
         webView = (WebView) overAppsView.findViewById(R.id.webView);
                                                           ^
  symbol:   variable webView
  location: class id
FULL_URL_TO_PROJECT/platforms/android/src/org/apache/cordova/overApps/Services/OverAppsService.java:84: error: cannot find symbol
         imageHead = (ImageView) overAppsHead.findViewById(R.id.imageHead);
                                                               ^
  symbol:   variable imageHead
  location: class id
FULL_URL_TO_PROJECT/platforms/android/src/org/apache/cordova/overApps/Services/OverAppsService.java:85: error: cannot find symbol
         imgClose = (ImageView) overAppsView.findViewById(R.id.imgClose);
symbol:   variable imgClose
  location: class id
FULL_URL_TO_PROJECT/platforms/android/src/org/apache/cordova/overApps/Services/OverAppsService.java:211: error: cannot find symbol
             keyDispatureView = inflater.inflate(R.layout.key_dispature, null, false);
                                                  ^
  symbol:   variable layout
  location: class R
FULL_URL_TO_PROJECT/platforms/android/src/org/apache/cordova/overApps/Services/OverAppsService.java:213: error: cannot find symbol
         rlKeyDispature = (KeyDispatchLayout) keyDispatureView.findViewById(R.id.tab_left);
                                                                                ^
  symbol:   variable tab_left
  location: class id

FAILURE: Build failed with an exception.

system information:

Cordova CLI: 6.5.0 
Ionic Framework Version: 3.4.2
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.3.8
ios-deploy version: 1.9.1 
ios-sim version: 5.0.13 
OS: macOS Sierra
Node Version: v8.0.0
Xcode version: Xcode 8.3.3 Build version 8E3004b

please can you show me complete example for how make this work ?

thanks for advance

from cordova-plugin-drawoverapps.

ahmedwahba avatar ahmedwahba commented on July 24, 2024

please make sure you have the device plugin in your project , don't put the import line manually
add screen shoot with the exception here

from cordova-plugin-drawoverapps.

mohamdio avatar mohamdio commented on July 24, 2024

are you talking about this native plugin (http://ionicframework.com/docs/native/device/) ?
about import line manually : i told you i did this just for test if will solve the issue because app name didn't changed
and about exception :

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

from cordova-plugin-drawoverapps.

ahmedwahba avatar ahmedwahba commented on July 24, 2024

this is just a quick example in ionic 1 ( still working on ionic 2 )
https://github.com/ahmedwahba/overApp-example
just test it & check if the error of R import is still found

from cordova-plugin-drawoverapps.

mohamdio avatar mohamdio commented on July 24, 2024

i tried your example but still get error about class R, did you tested your plugin with ionic 2 ? or maybe this issue happened because i using [ Ionic Framework Version: 3.4.2 ] ?
but i think the main problem is this error

platforms/android/src/org/apache/cordova/overApps/Services/OverAppsService.java:37: error: package com.ionicframework.overapp809848 does not exist

import com.ionicframework.overapp809848.R;

which can't found the app to access R class, which you said this will be changed after install the plugin but didn't happened !

from cordova-plugin-drawoverapps.

ahmedwahba avatar ahmedwahba commented on July 24, 2024

this example is fully working on

ionic v 2.2.2
cordova v 6.5.0

we still don't have an ionic 2 example

from cordova-plugin-drawoverapps.

bkrajendra avatar bkrajendra commented on July 24, 2024

Any one got it working for ionic 4?
I tried a lot but no success.
Please help!

from cordova-plugin-drawoverapps.

ahmedwahba avatar ahmedwahba commented on July 24, 2024

I did not test it with Ionic 4 but you can share your issue details to help solving it

from cordova-plugin-drawoverapps.

bkrajendra avatar bkrajendra commented on July 24, 2024

in ionic 4 I tried to import instance of plugin but it shows error :
Variable not declared in scope for OverApps.startOverApp
I've already declared this variable on top but still getting error.
No understanding way to use this.

from cordova-plugin-drawoverapps.

ahmedwahba avatar ahmedwahba commented on July 24, 2024

http://stackoverflow.com/questions/41087376/how-to-use-non-native-cordova-plugins-in-ionic-2

Please note second reply about clobber in this topic, i think your issue is about using window object

from cordova-plugin-drawoverapps.

bkrajendra avatar bkrajendra commented on July 24, 2024

Ive tried all suggestions over the forums.
made changes accordingly.

Project compiles ok now, but I get error when executing function : overApps.startOverApp

I grabbed the adb log for this:

[ 10-17 14:01:39.176 18486:18486 E/AndroidRuntime ]
FATAL EXCEPTION: main
Process: in.iocare.itm, PID: 18486
java.lang.RuntimeException: Unable to create service org.apache.cordova.overApps.Services.OverAppsService: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@117abfa -- permission denied for window type 2002
        at android.app.ActivityThread.handleCreateService(ActivityThread.java:3965)
        at android.app.ActivityThread.access$1500(ActivityThread.java:219)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1875)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@117abfa -- permission denied for window type 2002
        at android.view.ViewRootImpl.setView(ViewRootImpl.java:931)
        at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:387)
        at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:95)
        at org.apache.cordova.overApps.Services.OverAppsService.onCreate(OverAppsService.java:127)
        at android.app.ActivityThread.handleCreateService(ActivityThread.java:3953)
        ... 8 more

I have proper permission granted for app.

from cordova-plugin-drawoverapps.

ahmedwahba avatar ahmedwahba commented on July 24, 2024

#11

from cordova-plugin-drawoverapps.

Related Issues (15)

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.